<h1 align="center">cliproxy-rs</h1>
<p align="center">One local endpoint that lets Codex CLI and Claude Code use DeepSeek, GLM, Kimi, OpenRouter and other API keys, with API translation and failover between keys.</p>
<p align="center">
<a href="https://github.com/vayungodara/cliproxy-rs/actions/workflows/ci.yml"><img src="https://github.com/vayungodara/cliproxy-rs/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
<a href="https://github.com/vayungodara/cliproxy-rs/releases/latest"><img src="https://img.shields.io/github/v/release/vayungodara/cliproxy-rs" alt="Release"></a>
<a href="https://crates.io/crates/cliproxy"><img src="https://img.shields.io/crates/v/cliproxy" alt="Crates.io"></a>
<a href="https://github.com/vayungodara/homebrew-tap"><img src="https://img.shields.io/badge/brew-vayungodara%2Ftap%2Fcliproxy--rs-orange" alt="Homebrew"></a>
<a href="https://github.com/vayungodara/cliproxy-rs/stargazers"><img src="https://img.shields.io/github/stars/vayungodara/cliproxy-rs" alt="Stars"></a>
</p>
<p align="center">
<a href="#quick-start">Quick start</a> · <a href="#supported-providers">Providers</a> · <a href="#use-it-with-your-tools">Tools</a> · <a href="#how-it-compares">How it compares</a> · <a href="#documentation">Documentation</a>
</p>
```sh
curl -fsSL https://raw.githubusercontent.com/vayungodara/cliproxy-rs/master/install.sh | sh
```
<p align="center">The command is for macOS and Linux and needs no <code>sudo</code> and no Rust toolchain. Windows, Homebrew, Scoop, Cargo and Docker are under <a href="#other-ways-to-install">Other ways to install</a>.</p>
<p align="center">
<a href="https://github.com/vayungodara/cliproxy-rs/releases/latest"><img src="https://github.com/vayungodara/cliproxy-rs/raw/master/docs/img/hero.gif" alt="cliproxy-rs on 127.0.0.1:8317 translates a Codex CLI Responses request to Chat Completions for DeepSeek and moves it to a second key when the first answers 429. Claude Code's Messages requests reach GLM the same way. Kimi and OpenRouter are the other providers shown." width="880"></a>
</p>
## What is this?
cliproxy-rs is a Rust rewrite of [CLIProxyAPI](https://github.com/router-for-me/CLIProxyAPI). It reads the same `config.yaml` and credential formats and implements the client routes and v8 Management API. Parity with CLIProxyAPI v8.0.35 is partial; [PARITY.md](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/PARITY.md) has the counts and the [upstream changes since then](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/PARITY.md#upstream-changes-since-v8035). CLIProxyAPI's README lists cliproxy-rs under [More choices](https://github.com/router-for-me/CLIProxyAPI#more-choices), its list of ports and projects inspired by it (read on 18 November 2026).
- **API translation.** Codex CLI sends Responses requests, and the proxy sends Chat Completions to providers that only offer those, tool calls included. Claude Code's Messages requests are translated to the selected provider's format the same way.
- **Several keys and providers behind one model name.** By default, a 429 cools that key for the model and the request moves to another ready key or provider with the same alias.
- **One binary with the dashboard built in.** The dashboard shows provider keys and their traffic, request history and tool settings.
## Quick start
1. Run the install command at the top. It checks the release checksum, starts the proxy on `127.0.0.1`, prints the dashboard URL and opens it when it can. The port is 8317, or the next free one up to 8336 when something else has it; `~/.cliproxy-rs/keys.env` records it as `CLIPROXY_PORT`, next to your keys.
2. Open the dashboard and sign in with `CLIPROXY_MANAGEMENT_KEY` from `keys.env`.
3. Add a provider with a model. Open **Provider keys**, choose **OpenAI-compatible** and fill in the form: a group name, the provider's base URL, your API key and the Model, which is the model's name at the provider. Alias is optional. It is the name your tools ask for, and it is the same as the model when you leave it empty. Then press **Add group**. Base URLs for DeepSeek, GLM, Kimi and OpenRouter are listed under [API keys](#api-keys-codex-cli-and-mixed-providers).
4. Open **Use with tools**, pick the model, choose Claude Code or Codex CLI and copy the setup. It has the address you opened the dashboard at, your client key and the selected model filled in. Claude Code gets one block for your shell, which sets the variables and starts `claude`. Codex CLI gets two blocks: one for `~/.codex/config.toml`, and one `export` line to run before `codex`. For these two tools, Copy is disabled while no model is selected.
<details>
<summary>Add the provider in YAML instead</summary>
Add this block to `~/.cliproxy-rs/config.yaml` and keep the rest of the file, or do the same in the dashboard under Configuration, then Edit YAML. The proxy reloads the file when you save it. An OpenAI-compatible entry serves only the models in its `models` list.
```yaml
api-keys:
openai-compatibility:
- name: deepseek
base-url: "https://api.deepseek.com"
keys:
- api-key: "<deepseek-api-key>"
models:
- name: "<deepseek-model-id>"
alias: "deepseek"
```
[API keys](#api-keys-codex-cli-and-mixed-providers) has a block with two providers and the base URLs of the others. YAML also takes what the form has no field for, such as the `headers` entry that OpenCode Go needs.
</details>
<details>
<summary>Set up Codex CLI by hand</summary>
For a provider whose model alias is `deepseek`, `~/.codex/config.toml` looks like this. In `base_url`, use the `CLIPROXY_PORT` value from `keys.env`; it is 8317 unless the installer found that port taken:
```toml
model = "deepseek"
model_provider = "cliproxy"
[model_providers.cliproxy]
name = "cliproxy-rs"
base_url = "http://127.0.0.1:8317/v1"
env_key = "CLIPROXY_CLIENT_KEY"
wire_api = "responses"
```
Then start Codex with the client key from `keys.env`:
```sh
. ~/.cliproxy-rs/keys.env
export CLIPROXY_CLIENT_KEY
codex
```
</details>
<details>
<summary>Set up Claude Code by hand</summary>
Claude Code takes environment variables, and its base URL has no `/v1`. This block reads the port and the client key from `keys.env`, so it also works when the installer chose a port other than 8317. Set `ANTHROPIC_MODEL` to one of your model aliases. `ANTHROPIC_DEFAULT_HAIKU_MODEL` sends Claude Code's Haiku and background requests to the same model. Leave that line out if your proxy serves Claude's own Haiku, for example through a connected Claude account:
```sh
. ~/.cliproxy-rs/keys.env
export ANTHROPIC_BASE_URL="http://127.0.0.1:${CLIPROXY_PORT}"
export ANTHROPIC_AUTH_TOKEN="$CLIPROXY_CLIENT_KEY"
export ANTHROPIC_MODEL="<model-alias>"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="$ANTHROPIC_MODEL"
claude
```
</details>
> **Set it up with your coding agent.** Paste this into Claude Code, Codex or Amp on the machine where the proxy should run:
>
> ```text
> Install cliproxy-rs on this machine by following https://github.com/vayungodara/cliproxy-rs/blob/master/docs/AI-SETUP.md
> ```
<p align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/vayungodara/cliproxy-rs/raw/master/docs/img/overview-dark.png">
<img src="https://github.com/vayungodara/cliproxy-rs/raw/master/docs/img/overview-light.png" alt="The dashboard's Provider keys page on the OpenAI-compatible tab, with demo data from a local mock provider. Four groups, DeepSeek, GLM, Kimi and OpenRouter, each list their keys and a base URL, which is the provider's real one in place of the mock's. Each key has a row of twenty dots for its requests over the last 200 minutes. One DeepSeek key has a run of red dots, where the mock answered 429. Under the groups is the Add group form with five fields: Group name, Base URL, API key, Model and Alias." width="880">
</picture>
</p>
<p align="center"><img src="https://github.com/vayungodara/cliproxy-rs/raw/master/docs/img/demo.gif" alt="A terminal recording. A Responses request to cliproxy-rs on 127.0.0.1:8317 returns the provider's answer, and the provider's log shows two Chat Completions requests: the first key answered 429 and the second 200. A Messages request then returns the same answer with one more request, on the second key." width="880"></p>
<p align="center">A Responses and a Messages request to a stand-in provider whose first key answers 429. <a href="https://github.com/vayungodara/cliproxy-rs/blob/master/docs/demo/README.md">How it was recorded</a>.</p>
## Other ways to install
On Windows, in PowerShell:
```powershell
irm https://raw.githubusercontent.com/vayungodara/cliproxy-rs/master/install.ps1 | iex
```
The installer checks the release checksum, writes `~/.cliproxy-rs/config.yaml`, starts the proxy, prints the dashboard URL and opens it when it can. On Windows, the config is `%USERPROFILE%\.cliproxy-rs\config.yaml`. It saves new keys in `keys.env` without printing them.
There is also [Homebrew](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/INSTALL.md#homebrew) on macOS or Linux and [Scoop](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/INSTALL.md#scoop) on Windows. `cargo install cliproxy` builds the [crate](https://crates.io/crates/cliproxy) and needs the tools listed under [From source](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/INSTALL.md#from-source).
With Docker, put `config.yaml` and an `auth` folder in `./data` ([config for the container](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/INSTALL.md#docker-compose)) and run:
```sh
docker run -d --name cliproxy -p 127.0.0.1:8317:8317 -v "$PWD/data:/data" ghcr.io/vayungodara/cliproxy-rs:latest
```
Run the install command again to upgrade, or `brew upgrade cliproxy-rs` with Homebrew. Both keep your config and keys. [INSTALL.md](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/INSTALL.md) has the rest: start at login, release binaries, Docker Compose and [removing it](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/INSTALL.md#removing-it). [GETTING-STARTED.md](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/GETTING-STARTED.md) has the longer walkthrough.
Your tools use `CLIPROXY_CLIENT_KEY`, not the management key. Instead of an API key, you can connect your own account in the dashboard. Read [Accounts and provider terms](#accounts-and-provider-terms) first.
## Supported providers
| Provider | Connect with | Notes |
| --- | --- | --- |
| Any OpenAI Chat Completions-compatible API: DeepSeek, GLM (Z.ai), Kimi (Moonshot), OpenRouter, OpenCode Go, your own gateway | API key, under `api-keys.openai-compatibility` | The proxy sends Chat Completions upstream. [Base URLs](#api-keys-codex-cli-and-mixed-providers) are below. |
| Anthropic (Claude) | API key, or your own account | |
| OpenAI (Codex) | API key, or your own account | Browser or device-code sign-in |
| Google Gemini | API key | Includes Gemini Interactions |
| Vertex AI | Service account or API key | |
| xAI | API key, or your own account | |
| Meta | API key, or your own account | |
| Kimi, Devin, Google Antigravity | Your own account | |
| AI Studio | Browser relay on `/v1/ws` | |
| A model on your own machine, served by llama.cpp, Ollama or vLLM | An `openai-compatibility` entry | [LOCAL-MODELS.md](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/LOCAL-MODELS.md) has the config for each server and the Codex CLI runs that were tested. |
Clients can send OpenAI (Chat Completions, Responses), Anthropic (Messages) or Gemini requests, and the proxy translates between the three formats. [PARITY.md](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/PARITY.md#what-works-today) lists the routes. Account sign-ins are for one person's own accounts; see [Accounts and provider terms](#accounts-and-provider-terms).
The automated tests use local mocks and fixtures recorded from CLIProxyAPI. The hosted-provider run shown [below](#api-keys-codex-cli-and-mixed-providers) is Codex CLI with DeepSeek V4.1 Flash on OpenCode Go, on 7 October 2026. LOCAL-MODELS.md records Codex CLI runs against llama.cpp, Ollama and vLLM on 14 and 16 November 2026.
## How it compares
### With CLIProxyAPI
cliproxy-rs is a rewrite of [CLIProxyAPI](https://github.com/router-for-me/CLIProxyAPI). Every row names a source.
| | cliproxy-rs | CLIProxyAPI | Source |
| --- | --- | --- | --- |
| Language | Rust | Go | Each repository |
| Feature coverage | Follows v8.0.35. In the audit of 20 October 2026, 1,053 of 1,951 contracts were covered, 872 partial and 26 missing | The reference. Its latest release on 18 November 2026 was v8.0.77 | [PARITY.md](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/PARITY.md#where-it-stands), [upstream changes since v8.0.35](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/PARITY.md#upstream-changes-since-v8035), [releases](https://github.com/router-for-me/CLIProxyAPI/releases) |
| Config and credential files | Reads CLIProxyAPI's `config.yaml` and credential files | Its own | [MIGRATING-FROM-GO.md](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/MIGRATING-FROM-GO.md) |
| Dashboard | Built into the binary | A separate project (Management Center) that the server downloads at start | [BENCHMARKS.md](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/BENCHMARKS.md#size-and-idle-memory-040-against-v8035) |
| Default routing | `soonest-reset`: the account whose limit resets soonest goes first | `round-robin` | [DIFFERENCES-FROM-GO.md](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/DIFFERENCES-FROM-GO.md#additions-in-cliproxy-rs) |
| Linux x86_64 release¹ | 19.0 MB download, 44.6 MB binary | 23.6 MB download, 71.1 MB binary | [BENCHMARKS.md](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/BENCHMARKS.md#size-and-idle-memory-040-against-v8035) |
| Memory, idle at start¹ | 25.8 MB | 49.7 MB | Same section |
| Memory, field-mix hour¹ | 161.5 MB peak, 97.8 MB after 5 minutes idle | 198.3 MB peak, 75.8 MB after 5 minutes idle | [BENCHMARKS.md](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/BENCHMARKS.md#against-go-v8035) |
| Non-streaming requests per second² | 1,168 | 1,568 | [BENCHMARKS.md](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/BENCHMARKS.md#what-the-numbers-say) |
| Third-party CLIProxyAPI apps | None tested with cliproxy-rs | Its README lists many | [CLIProxyAPI compatibility](#cliproxyapi-compatibility), [Who is with us?](https://github.com/router-for-me/CLIProxyAPI#who-is-with-us) |
| License | MIT | MIT | Each repository |
¹ cliproxy-rs 0.4.0 and CLIProxyAPI v8.0.35 release binaries. Idle at start is the RSS 15 seconds after launch with one API key and no traffic, measured on one Linux machine on 31 October 2026. The field-mix hour sent streamed Claude and Codex requests of about 1 MB for an hour, each server on its own GitHub-hosted runner at the same time, on 28 October 2026.
² The 0.1.0 launch build against CLIProxyAPI v8.0.10 with a fake upstream. Go also served more plain streams per second, and cliproxy-rs more translated streams; [BENCHMARKS.md](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/BENCHMARKS.md#what-the-numbers-say) has each result.
CLIProxyAPI is the complete implementation, and cliproxy-rs follows an older release of it. cliproxy-rs's translation and failover are ports of CLIProxyAPI's code.
### With other proxies
Unless otherwise noted, each cell is from the project's README (18 November 2026). "Not documented" means the README doesn't mention it. None of the other projects was run for this table.
| | cliproxy-rs | [CLIProxyAPI](https://github.com/router-for-me/CLIProxyAPI) | [claude-code-router](https://github.com/musistudio/claude-code-router) | [LiteLLM](https://github.com/BerriAI/litellm) | [opencodex](https://github.com/lidge-jun/opencodex) |
| --- | --- | --- | --- | --- | --- |
| Language and packaging | Rust, one binary | Go, one binary ([release assets](https://github.com/router-for-me/CLIProxyAPI/releases/tag/v8.0.35)) | Node.js 22+ (npm), desktop app, Docker | Python (uv), Docker | npm with Node 18+, which bundles the Bun runtime; desktop app; Docker |
| Client APIs | OpenAI Chat Completions and Responses, Anthropic Messages, Gemini | OpenAI including Responses, Gemini including Interactions, Claude | Routes for messages, chat completions, responses, interactions and `/v1beta/*`³ | Routes for chat completions, responses, messages and others³ | Responses, Chat Completions, Anthropic Messages |
| When a key or provider fails | A 429 cools the key, and the request moves to another key or provider with the same alias | Round-robin across accounts in the README; credential retry rounds and cooldowns in the [example config](https://github.com/router-for-me/CLIProxyAPI/blob/v8.0.35/config.example.yaml) at v8.0.35 | Retries, credential pools, key rotation, ordered fallback models | Retries, then fallback to another model group; failing deployments cool down ([reliability docs](https://docs.litellm.ai/docs/proxy/reliability)) | Combos: failover or weighted round-robin across providers |
| Built-in dashboard | Yes, in the binary | Separate project (Management Center) | Yes | Yes | Yes |
| Reads CLIProxyAPI's config and credential files | Yes, with [partial parity](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/PARITY.md) | It is the reference | Not documented | Not documented | Not documented |
³ claude-code-router's [Docker guide](https://github.com/musistudio/claude-code-router/blob/main/docker/README.md) lists routes including `/messages`, `/chat/completions`, `/responses`, `/interactions` and `/v1beta/*`. LiteLLM's README lists `/chat/completions`, `/responses`, `/messages` and others.
Where the others are stronger:
- LiteLLM covers 100+ providers and adds virtual keys, spend tracking, guardrails and a Python SDK.
- claude-code-router has routing conditions on headers and bodies, ordered fallback models, its own client keys with request and token limits, and a desktop app.
- opencodex supports 40+ providers out of the box, also serves Claude Desktop and Grok Build, and has a desktop app.
## Use it with your tools
The local OpenAI base URL is `http://127.0.0.1:8317/v1`. Claude Code and Gemini clients use `http://127.0.0.1:8317` without `/v1`. Use your installation's port and client key.
| Tool | Connects as | Settings |
| --- | --- | --- |
| Codex CLI | OpenAI Responses, base URL with `/v1` | [Codex CLI](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/CLIENTS.md#codex-cli) |
| Claude Code | Anthropic Messages, base URL without `/v1` | [Claude Code](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/CLIENTS.md#claude-code), [GPT in Claude Code](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/CLIENTS.md#gpt-in-claude-code) |
| Gemini CLI | Gemini, base URL without `/v1` | [Gemini CLI](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/CLIENTS.md#gemini-cli) |
| OpenCode, Factory Droid, Cline, Roo Code, Kilo Code, Zed, Continue, Aider | OpenAI-compatible provider, base URL with `/v1` | [OpenCode](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/CLIENTS.md#opencode), [Factory Droid](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/CLIENTS.md#factory-droid), [Cline, Roo Code and Kilo Code](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/CLIENTS.md#cline-roo-code-and-kilo-code), [Zed](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/CLIENTS.md#zed), [Continue](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/CLIENTS.md#continue), [Aider](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/CLIENTS.md#aider) |
| Cursor, Amp | Their servers send the requests, so the proxy needs a public HTTPS address | [Cursor](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/CLIENTS.md#cursor), [Amp](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/CLIENTS.md#amp) |
| OpenAI, Anthropic and Google Gen AI SDKs | Each SDK's own format | [SDKs](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/CLIENTS.md#sdks) |
Not every model and tool combination has been tested. Claude Code with thinking on needs the model's `is-compat` setting for DeepSeek and Kimi models. Without it, those providers refuse a tool-call turn that has no thinking text. The setting is on by default when the group's `base-url` is DeepSeek's or Kimi's official API. Through another host, such as OpenRouter, add `is-compat: true` beside `name` and `alias` in the model's entry, in the `models` list of that `api-keys.openai-compatibility` provider. It is not a setting for the Kimi account sign-in. [CONFIGURATION.md](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/CONFIGURATION.md#api-keys) lists the official hosts, and [DIFFERENCES-FROM-GO.md](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/DIFFERENCES-FROM-GO.md#additions-in-cliproxy-rs) has the details.
## API keys: Codex CLI and mixed providers
Codex CLI only speaks the Responses API now. A provider entry with `wire_api = "chat"` stops Codex with "`wire_api = "chat"` is no longer supported".
If you only use one provider and it serves the Responses API, Codex can talk to it directly. DeepSeek's API, Z.ai's GLM Coding Plan and Kimi Code do, and each publishes its own Codex setup: [DeepSeek](https://api-docs.deepseek.com/quick_start/agent_integrations/codex/), [GLM Coding Plan](https://docs.z.ai/devpack/tool/codex), [Kimi Code](https://www.kimi.com/code/docs/en/third-party-tools/codex.html).
The proxy is for the rest: an endpoint that only offers Chat Completions, such as OpenCode Go's models, or several providers and keys behind one endpoint, with failover when one returns 429. It accepts Responses requests from Codex and sends Chat Completions upstream, tool calls included.
You do not need a subscription login. Merge this provider block into `~/.cliproxy-rs/config.yaml`, or `%USERPROFILE%\.cliproxy-rs\config.yaml` on Windows. Keep `access.api-keys`, `management.secret-key` and the rest of your config. The proxy reloads the configuration on save. The upstream keys below are separate from your proxy's client key. Replace the key and upstream model placeholders with values from each provider.
```yaml
api-keys:
openai-compatibility:
- name: deepseek
base-url: "https://api.deepseek.com"
keys:
- api-key: "<deepseek-api-key>"
models:
- name: "<deepseek-model-id>"
alias: "deepseek"
- name: openrouter
base-url: "https://openrouter.ai/api/v1"
keys:
- api-key: "<openrouter-api-key>"
models:
- name: "<openrouter-model-id>"
alias: "router"
```
Use the same structure for any of these metered APIs. The base URL excludes `/chat/completions`; the proxy adds it.
| Provider | Base URL | Model IDs and API access |
| --- | --- | --- |
| DeepSeek | `https://api.deepseek.com` | [DeepSeek API docs](https://api-docs.deepseek.com/) |
| GLM (Z.ai) | `https://api.z.ai/api/paas/v4` | [Z.ai API docs](https://docs.z.ai/api-reference/introduction) |
| Kimi (Moonshot) | `https://api.moonshot.ai/v1` | [Moonshot API docs](https://platform.moonshot.ai/docs) |
| OpenRouter | `https://openrouter.ai/api/v1` | [OpenRouter API docs](https://openrouter.ai/docs/quickstart) |
| OpenCode Go | `https://opencode.ai/zen/go/v1` | [OpenCode Go docs](https://opencode.ai/docs/go/); use its Chat Completions models, and add `headers: {x-opencode-session: $CPA-SESSION-ID}` to the entry, which sends each conversation's session ID; OpenCode Go rejects requests without one |
For a model on your own machine served by llama.cpp, Ollama or vLLM, see [LOCAL-MODELS.md](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/LOCAL-MODELS.md).
Put this in `~/.codex/config.toml`:
```toml
model = "deepseek"
model_provider = "cliproxy"
[model_providers.cliproxy]
name = "cliproxy-rs"
base_url = "http://127.0.0.1:8317/v1"
env_key = "CLIPROXY_CLIENT_KEY"
wire_api = "responses"
```
```sh
export CLIPROXY_CLIENT_KEY=your-client-key
codex
```
Use the port and `CLIPROXY_CLIENT_KEY` from your installation's `keys.env`. Codex CLI sends Responses requests to the proxy; the proxy translates them to Chat Completions for these upstreams. Set `model = "router"` to use the second provider. Other clients can use either alias at the same endpoint, alongside any connected subscription accounts.
For failover, give two provider entries the same model alias, or add another key to a provider's `keys` list. By default, a 429 cools that credential for the failing model, and the proxy tries another eligible credential for the alias, within the configured attempt limits and error rules. [MULTI-ACCOUNT.md](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/MULTI-ACCOUNT.md#cooldowns-and-limits) explains retries when none are ready.
<p align="center"><img src="https://github.com/vayungodara/cliproxy-rs/raw/master/docs/img/codex-deepseek.gif" alt="Codex CLI fixing a bug and running a check with DeepSeek V4.1 Flash through cliproxy-rs" width="880"></p>
On 7 October 2026, Codex CLI 0.160 finished a task with a file edit and a shell command through cliproxy-rs 0.2.2, using DeepSeek V4.1 Flash on OpenCode Go's Chat Completions endpoint (above). The DeepSeek, GLM, Kimi and OpenRouter endpoints in the table haven't been run live.
## Accounts and provider terms
This project is for one person using their own accounts on their own machines. Keep the proxy and its keys private. It is not a shared subscription service.
Use the provider's sanctioned path where one exists:
- OpenAI offers [Sign in with ChatGPT](https://developers.openai.com/cookbook/articles/sign-in-with-chatgpt) so eligible users can use their plan in participating tools, including local personal projects. That permission depends on the integration and consent scopes. cliproxy-rs's Codex login follows CLIProxyAPI's existing login flow; it is not the new Sign in with ChatGPT integration. The Management API can bind Sign in with ChatGPT tokens to a Codex credential, and Codex requests use them when the credential's `use_siwc` is on.
- Claude Code supports [gateway configuration](https://code.claude.com/docs/en/llm-gateway-connect). You can route other models into Claude Code through the proxy using their API keys. Anthropic's [authentication rules](https://code.claude.com/docs/en/legal-and-compliance#authentication-and-credential-use) reserve Claude subscription OAuth for Claude Code and other native Anthropic applications. Use an API key or supported cloud provider for Claude in third-party tools.
Personal use is still subject to each provider's terms, and providers can restrict or suspend accounts that break them. Sharing an account, or using it to serve other people, is the clearest case.
### Several accounts
Each sign-in creates a file in `auth-dir`. Routing chooses among ready credentials with `soonest-reset` (the default: the account whose weekly limit resets soonest goes first), `round-robin`, `fill-first` or `weighted-round-robin`. The installer enables session affinity to keep a conversation on one account. When the setting is omitted, the server default is off. A 429 can move the request to another ready credential for that model. [MULTI-ACCOUNT.md](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/MULTI-ACCOUNT.md) covers routing and access from your other machines.
## CLIProxyAPI compatibility
The compatibility target is CLIProxyAPI v8.0.35. Parity is incomplete: the audit has 1,951 items, with 1,053 covered, 872 partial and 26 missing. [PARITY.md](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/PARITY.md) defines those counts. Upstream has released newer versions since; PARITY.md lists [the changes after v8.0.35](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/PARITY.md#upstream-changes-since-v8035) that cliproxy-rs does not have yet.
Config and protocol tests check compatibility with Go CLIProxyAPI at `6fecc6e`. The bundled dashboard has tests against both servers. No third-party CLIProxyAPI app has been tested with cliproxy-rs yet.
Before switching, read [MIGRATING-FROM-GO.md](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/MIGRATING-FROM-GO.md), especially the refresh-token warning. The default Docker image expects `/data/config.yaml` and runs as UID/GID 10001. Update mounts and permissions, or override `--config` and set an accessible `oauth.auth-dir` to keep existing paths.
## Terminal UI
`cliproxy -tui` manages a running server. It uses `-management-base-url`, then `management.base-url`, then `http://127.0.0.1:<port>`, and asks for the management key. `cliproxy -tui -standalone` starts the server in the same process and stops it when you quit. Standalone mode needs a loopback or wildcard `host` and no `server.tls`.
## Upcoming features
Not in cliproxy-rs yet:
- An AUR package.
- Three plugin pieces: model discovery for each credential, response hooks on a buffered Claude answer, and sending your GitHub token on plugin store requests.
- The remaining parity gaps and Go test cases, listed in [PARITY.md](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/PARITY.md).
## Performance
On 23 October 2026, 67 minutes after 0.3.0 started on the maintainer's server, it had answered all 592 requests since start with status 200. Its resident memory was 43.9 MB, and its peak since start 63.7 MB. This is a field observation of real traffic, so it can't be reproduced on demand; [BENCHMARKS.md](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/BENCHMARKS.md#field-memory) records how it was read.
<p align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/vayungodara/cliproxy-rs/raw/master/docs/img/perf-field-soak-dark.svg?sanitize=true">
<img src="https://github.com/vayungodara/cliproxy-rs/raw/master/docs/img/perf-field-soak-light.svg?sanitize=true" alt="Bar chart of the field-mix soak on 28 October 2026, 60 minutes on two runners at the same time. Requests of 200 KB to 2 MB, about 1 MB on average, peak RSS: Go 198.3 MB, cliproxy-rs 161.5 MB; RSS after 300 s idle: Go 75.8 MB, cliproxy-rs 97.8 MB." width="880">
</picture>
</p>
In the [field-mix soak](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/BENCHMARKS.md#against-go-v8035) of 28 October 2026, the CLIProxyAPI v8.0.35 and cliproxy-rs 0.4.0 release binaries each served an hour of streamed Claude and Codex requests of 200 KB to 2 MB, plus count_tokens, on a GitHub-hosted runner of their own at the same time. Neither failed a request. cliproxy-rs peaked at 161.5 MB and Go at 198.3 MB. Read 20 seconds after each batch, cliproxy-rs held 85.7 to 102.0 MB and Go 91.4 to 152.8 MB. After 5 minutes without traffic Go had given more back: it held 75.8 MB and cliproxy-rs 97.8 MB, which keeps the o200k_base tokenizer that count_tokens built (46.8 MB when [measured](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/BENCHMARKS.md#what-the-heap-held) on 6 October). On the same CPU model, cliproxy-rs used 49 ms of CPU per request and Go 146 ms.
Go was faster in the 0.1.0 launch build's synthetic runs. It served 1,568 non-streaming requests/s against 1,168, with 0.62 ms of CPU per request against 0.85 ms, and 916 plain streams/s against 833. With 256 slow streams, cliproxy-rs had the worse p99 latency: 1,414.5 ms against Go's 1,272.2 ms.
[BENCHMARKS.md](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/BENCHMARKS.md) has the methods, raw results and other measurements, including the [Claude soak](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/BENCHMARKS.md#claude-soak-large-prompts-and-memory) against CLIProxyAPI 6fecc6e and the [field mix](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/BENCHMARKS.md#field-mix-claude-codex-and-count_tokens) against earlier releases. [What the heap held](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/BENCHMARKS.md#what-the-heap-held) explains how its memory floor was found.
## Documentation
- [Getting started](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/GETTING-STARTED.md) and [installation](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/INSTALL.md).
- [Client settings](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/CLIENTS.md), [several accounts](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/MULTI-ACCOUNT.md) and [configuration](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/CONFIGURATION.md).
- [Moving from CLIProxyAPI](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/MIGRATING-FROM-GO.md) and [differences from Go](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/DIFFERENCES-FROM-GO.md).
- [Parity](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/PARITY.md) and [benchmarks](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/BENCHMARKS.md).
## Security
The dashboard is built into the binary. Model catalogs are downloaded at start and every three hours; `--local-model` turns that off.
Keep `access.api-keys` set and `server.host` on `127.0.0.1` unless your other machines need access. With no client keys, the proxy serves only this computer and refuses browser requests from websites; `access.allow-open-access: true` opens it to anyone, as CLIProxyAPI is. The Management API refuses browser requests from other websites, and only wrong keys count towards its 30-minute block. Behind a local tunnel or reverse proxy, set `server.trusted-proxies`; otherwise internet clients count as local. [Running it safely](https://github.com/vayungodara/cliproxy-rs/blob/master/docs/GETTING-STARTED.md#running-it-safely) explains this. [SECURITY.md](https://github.com/vayungodara/cliproxy-rs/blob/master/SECURITY.md) covers vulnerability reports.
## Development
The Rust workspace is under `crates/`; the dashboard is under `ui/`. Tests use local mock upstreams. CI runs fmt, clippy and the full suite, with Go and PostgreSQL comparison tests. The [differential harness](https://github.com/vayungodara/cliproxy-rs/blob/master/harness/README.md) compares 57 cases against CLIProxyAPI.
```sh
cargo fmt --all --check
cargo clippy --workspace --all-targets --locked -- -D warnings
cargo test --workspace --locked
```
[CONTRIBUTING.md](https://github.com/vayungodara/cliproxy-rs/blob/master/CONTRIBUTING.md) explains how to contribute.
## License and credits
MIT. See [LICENSE](https://github.com/vayungodara/cliproxy-rs/blob/master/LICENSE).
cliproxy-rs is a Rust rewrite of [CLIProxyAPI](https://github.com/router-for-me/CLIProxyAPI) by Luis Pater and Router-For.ME, which is also MIT licensed. [NOTICE](https://github.com/vayungodara/cliproxy-rs/blob/master/NOTICE) records the portions derived from it.