selfhost.directory

The index of self-hostable projects — ranked, categorized and served with live updates.
Own your data and stop giving it to big tech.

GitHub
CLI2API logo

Self-host CLI2API

v0.7.16

OpenAI-compatible API gateway for Qoder and WorkBuddy

BetaOpen SourceMIT
Updated8 hours ago
LanguageGo
Setup difficultyModerate
Stars
282
Port
3010 (HTTP API and web console)
Docker
ghcr.io/caigee-cmd/cli2api
Install with Docker

What is CLI2API?

CLI2API is a self-hosted gateway that lets you use your own Qoder, WorkBuddy, and Trae accounts through a unified OpenAI-compatible API. It runs via Docker Compose and provides a web console for managing accounts, models, and client keys. The Go gateway routes requests across multiple accounts with session affinity, concurrency limits, and failover. Each Qoder account gets an isolated Node worker while other providers use in-process Go adapters. All credentials are stored in SQLite.

Should you self-host CLI2API?

CLI2API scores 45/100 on selfhost.directory (how scoring works) and ranks #25 of 39 in API Gateway. It has 282 GitHub stars.

It shipped 10 stable releases in the past year. The latest, v0.7.16, came out on 28 October 2026.

Setup is moderate: expect some configuration beyond a single command. An official Docker image is available. It is MIT-licensed and written mostly in Go.

Its closest alternative on selfhost.directory is Kong Gateway (82/100, 44 311 stars). It scores higher overall, so compare the two before you pick. See CLI2API vs Kong Gateway side by side.

Features

  • Account check-in automationDisabled by default, per-account opt-in
  • Anthropic Messages API
  • Function Calling
  • Managed updatesLive upgrade/rollback acceptance still pending per documentation
  • Model listing
  • Multi-account routing
  • OpenAI Compatible API
  • OpenAI Responses API
  • SQLite Storage
  • Streaming Support
  • Web Console

CLI2API README

How to install CLI2API

Install CLI2API with Docker

Docker Engine + Compose

docker compose --env-file deploy/.env -f deploy/docker-compose.yml up -d

Direct Docker Compose usage; requires deploy/.env file

How to configure CLI2API

  • CLI2API_UPDATER_SOCKET_DIRplatform-specificHost directory mounted read-only for the Linux updater socket

    Host directory mounted read-only for the Linux updater socket

  • CROSS_PROVIDER_MODEL_POOL0When 1/true, bare model IDs can route across Qoder and WorkBuddy accounts

    When 1/true, bare model IDs can route across Qoder and WorkBuddy accounts

    values: 0 or 1

  • HOST127.0.0.1Bind address for the server

    Bind address for the server

  • PLAIN_TEMPLATE_PATHworker/last-plain.sample.jsonPlain template path

    Plain template path

  • PORT3010Port the server listens on

    Port the server listens on

  • QODERCLI_JSimage defaultPinned Qoder Global CLI bundle

    Pinned Qoder Global CLI bundle

  • QODERCNCLI_JSimage defaultPinned Qoder CN CLI bundle

    Pinned Qoder CN CLI bundle

  • QODER_DATA_DIR/dataSQLite database and durable account credentials directory

    SQLite database and durable account credentials directory

  • QODER_MAX_RETRY_ACCOUNTS4Maximum accounts attempted for one request (1-64)

    Maximum accounts attempted for one request (1-64)

    values: 1-64

  • QODER_NODE_BINARYnodeNode binary path

    Node binary path

  • QODER_PROXY_URLemptyInitial global outbound proxy: http(s)://, direct, or none

    Initial global outbound proxy: http(s)://, direct, or none

    values: http(s)://, direct, none

  • QODER_RUNTIME_DIR/run/cli2apiEphemeral per-account runtime homes for providers that use child processes

    Ephemeral per-account runtime homes for providers that use child processes

  • QODER_SIGNATURE_SECRETbuilt-inOverride the COSY request-signing secret for in-process Qoder

    Override the COSY request-signing secret for in-process Qoder

  • QODER_SSE_DIAGNOSTIC_MODELSemptyComma-separated Qoder model IDs for redacted SSE diagnostics in Runtime Logs; * enables all

    Comma-separated Qoder model IDs for redacted SSE diagnostics in Runtime Logs; * enables all

  • QODER_STREAM_TOTAL_MS300000Qoder worker mid-stream stall timeout in ms

    Qoder worker mid-stream stall timeout in ms

  • QODER_STREAM_TTFB_MS30000Qoder stream first-byte deadline in ms

    Qoder stream first-byte deadline in ms

    values: min 5000

  • QODER_WORKER_BASE_PORT32100Internal child-runtime port range

    Internal child-runtime port range

  • QODER_WORKER_DAEMONworker/src/daemon.mjsWorker daemon script path

    Worker daemon script path

  • UPDATE_AGENT_TOKENemptyDocker Desktop updater token, written by the installer

    Docker Desktop updater token, written by the installer

  • UPDATE_AGENT_URLemptyDocker Desktop host updater URL, written by the installer

    Docker Desktop host updater URL, written by the installer

  • UPDATE_GITHUB_TOKENemptyOptional GitHub token for release checks

    Optional GitHub token for release checks

  • UPDATE_SOCKET_PATH/run/cli2api-updater/updater.sockUpdater socket path

    Updater socket path

CLI2API releases & version history

More in API Gateway

Rate this project

Click to rate — no account needed.

0 comments

Posting as guest
Loading comments…