CLI PROXY SERVER · GO 1.26+ · MIT OPEN SOURCE

Introducing CLIProxyAPI.

One command line. Every frontier model.

A compiled Go command-line proxy server that turns your CLI OAuth subscriptions and API keys into unified OpenAI, Gemini, Claude, Codex, and Grok compatible local endpoints—with round-robin load balancing and a built-in terminal UI.

cli-proxy-api — ttys000 — 80x24
Macintosh CLI Edition · Port 8317
Try:
ONLINE
SYSTEM ARCHITECTURE

Built like a UNIX tool. Speaks every modern AI protocol.

Point Claude Code, Codex CLI, OpenAI SDKs, or Gemini clients at localhost:8317. CLIProxyAPI normalizes reasoning budgets, translates wire protocols, and rotates accounts automatically.

Routing_Topology.txt — Read-Only
+----------------------+      +---------------------------------------------------+      +---------------------------+
|   CLIENTS & TOOLS    |      |             cli-proxy-api (:8317)                 |      |    UPSTREAM PROVIDERS     |
+----------------------+      +---------------------------------------------------+      +---------------------------+
| * Claude Code CLI    | ===> |  POST /v1/messages          [Anthropic Protocol]  | ===> | -> OpenAI / Codex OAuth   |
| * OpenAI Codex CLI   | ===> |  POST /v1/responses         [Responses + WS]      | ===> | -> Anthropic Claude OAuth |
| * OpenAI / cURL SDKs | ===> |  POST /v1/chat/completions  [Chat Completions]    | ===> | -> Gemini / Antigravity   |
| * Gemini SDKs        | ===> |  POST /v1beta/interactions  [Gemini Interactions] | ===> | -> Kimi / xAI / Meta      |
+----------------------+      +---------------------------------------------------+      | -> Devin / OpenRouter     |
                                       |                 |                 |             +---------------------------+
                              [auths/ OAuth Pool] [Round-Robin LB] [Thinking Pipeline]

Canonical Thinking Pipeline -> Protocol Translator -> Per-Provider Runtime Executor (Streaming SSE, Non-Streaming & WebSockets).

BUILT FOR THE COMMAND LINE

Six reasons developers live in CLIProxyAPI.

No bloated GUI wrappers required—just a single compiled Go binary designed for shells, SSH sessions, containers, and local workstations.

Zero-Key CLI OAuth

Authenticate Codex, Claude Code, Antigravity, Kimi, xAI, Meta, and Devin directly from your terminal, including headless --no-browser and device-code flows.

cli-proxy-api --claude-login --no-browser

Universal Protocol Bridge

Expose OpenAI (Chat & Responses), Anthropic Messages, and Gemini (including Interactions) endpoints with streaming SSE, WebSockets, tools, and vision.

/v1/chat/completions · /v1/responses · /v1/messages

Multi-Account Round-Robin

Pool multiple CLI subscriptions and API keys per provider. Requests rotate across healthy credentials automatically to smooth out rate limits.

auths/codex-01.json + auths/codex-02.json

Bubbletea Terminal UI

Launch an interactive full-screen terminal dashboard with --tui --standalone to inspect accounts, manage API keys, trigger OAuth, and tail live logs.

cli-proxy-api --tui --standalone

LAN Gateway Discovery

Run cli-proxy-api discover to scan _ai-gateway._tcp via DNS-SD on your local network, with clean --json output ready for shell pipelines.

cli-proxy-api discover --timeout 3 --json

Embeddable Go SDK & Stores

Embed sdk/cliproxy directly into Go services, hot-reload YAML config, and persist credentials on disk, PostgreSQL, Git, or Object Storage.

import "github.com/router-for-me/CLIProxyAPI/v8/sdk/cliproxy"
SUPPORTED UPSTREAM CHANNELS & CLI FLAGS
OpenAI / Codex
GPT-6 Astra / Sol / Terra / Luna & Codex OAuth
--codex-login
Anthropic
Claude Fable 5.1, Opus 5.5, Sonnet 5.5, Haiku 5.5
--claude-login
Gemini / Antig.
Gemini 4 Argon, 3.8 Flash, AI Studio, Vertex & Antigravity
--antigravity-login
Kimi
Kimi K3.1 Pro, K3 (1M context) via OAuth or API Key
--kimi-login
xAI Grok
Grok 4.7 & Grok Build via CLI OAuth or API Key
--xai-login
Meta Muse
Muse Wonder Full, Muse Wonder & Muse Spark 1.3
--meta-login
Devin
SWE-2, SWE-2 Flash & routed account models
--devin-login
THREE-STEP TERMINAL SETUP

Up and routing in sixty seconds.

Build from Go 1.26+ source or download a prebuilt binary, log in from your shell, and start serving requests locally.

STEP 01 · BUILD & CONFIG [01/03]

Compile the CLI binary

Build the single Go binary and initialize config.yaml from the included template.

go build -o cli-proxy-api ./cmd/server && cp config.example.yaml config.yaml
STEP 02 · AUTHENTICATE [02/03]

Log in via CLI OAuth

Sign in with one flag—credentials are stored cleanly under auths/ for round-robin routing.

./cli-proxy-api --claude-login
STEP 03 · SERVE OR TUI [03/03]

Launch server or Terminal UI

Run headless in the background or open the built-in Bubbletea TUI console.

./cli-proxy-api --tui --standalone