[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-76248":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":16,"stars7d":16,"stars30d":17,"stars90d":15,"forks30d":15,"starsTrendScore":14,"compositeScore":18,"rankGlobal":9,"rankLanguage":9,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":20,"hasPages":20,"topics":22,"createdAt":9,"pushedAt":9,"updatedAt":23,"readmeContent":24,"aiSummary":25,"trendingCount":15,"starSnapshotCount":15,"syncStatus":26,"lastSyncTime":27,"discoverSource":28},76248,"codex-bridge","wujfeng712-ui\u002Fcodex-bridge","wujfeng712-ui","Zero-dependency local proxy bridging Codex CLI to DeepSeek, Xiaomi MiMo, and OpenAI",null,"JavaScript",226,34,1,9,0,3,149,62.13,"MIT License",false,"main",[],"2026-06-12 04:01:21","\u003Ch1 align=\"center\">codex-bridge\u003C\u002Fh1>\n\n\u003Cp align=\"center\">\n  A zero-dependency local proxy that lets \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fopenai\u002Fcodex\">Codex CLI\u003C\u002Fa> talk to\n  \u003Cstrong>DeepSeek\u003C\u002Fstrong>, \u003Cstrong>Xiaomi MiMo\u003C\u002Fstrong>, and \u003Cstrong>OpenAI\u003C\u002Fstrong> through a single\n  \u003Ccode>base_url\u003C\u002Fcode>.\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Ca href=\"https:\u002F\u002Fnodejs.org\u002F\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fnode-18%2B-339933?logo=node.js&logoColor=white\" alt=\"Node.js 18+\">\u003C\u002Fa>\n  \u003Ca href=\".\u002FLICENSE\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-MIT-blue.svg\" alt=\"MIT License\">\u003C\u002Fa>\n  \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fdependencies-0-brightgreen\" alt=\"Zero Dependencies\">\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Cstrong>English\u003C\u002Fstrong> ·\n  \u003Ca href=\".\u002FREADME.zh-CN.md\">简体中文\u003C\u002Fa> ·\n  \u003Ca href=\".\u002FREADME.ja.md\">日本語\u003C\u002Fa> ·\n  \u003Ca href=\".\u002FREADME.ko.md\">한국어\u003C\u002Fa> ·\n  \u003Ca href=\".\u002FREADME.es.md\">Español\u003C\u002Fa>\n\u003C\u002Fp>\n\n---\n\nCodex CLI speaks the **OpenAI Responses API**. DeepSeek and MiMo speak **Chat Completions**.\ncodex-bridge translates between them in both directions — streaming SSE, tool calls, and thinking-mode round-trips — so you can use any supported model inside Codex without patching the client.\n\n## Features\n\n- **Multi-provider routing** — DeepSeek \u002F MiMo \u002F OpenAI, auto-selected by model name\n- **Bi-directional protocol translation** — Responses API ↔ Chat Completions with streaming SSE bridge\n- **Per-provider reasoning effort translation** — Codex's `none | minimal | low | medium | high | xhigh` mapped to each upstream's native format\n- **Thinking-mode tool-call round-trip** — caches `reasoning_content` and replays it so DeepSeek's thinking mode survives multi-turn tool calls\n- **Inbound auth gate** — `PROXY_AUTH_KEY` \u002F `PROXY_KEYS` with optional per-key provider locking\n- **Session continuity** — `previous_response_id` works across providers (LRU-bounded store)\n- **Built-in `web_fetch` tool** — bypasses sandbox restrictions for URL-heavy conversations\n- **Tool-call circuit breaker** — soft warning + hard tool stripping on runaway tool loops\n- **Single-file, zero dependencies** — one `proxy.mjs` (~2000 lines), no `npm install`\n\n## Quick Start\n\n### 1. Configure\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fwujfeng712-ui\u002Fcodex-bridge.git\ncd codex-bridge\ncp env.example .env\n```\n\nEdit `.env` — at minimum:\n\n```bash\nPROXY_AUTH_KEY=sk-proxy-local-$(openssl rand -hex 24)   # generate one\nDEEPSEEK_API_KEY=sk-...                                  # from platform.deepseek.com\n```\n\n### 2. Start the proxy\n\n```bash\nnode --env-file=.env proxy.mjs\n```\n\n> Need Node 18–19 or background mode? See [Advanced Usage](#advanced-usage).\n\n### 3. Point Codex CLI at the proxy\n\nEdit `~\u002F.codex\u002Fconfig.toml`:\n\n```toml\nmodel = \"deepseek-v4-flash\"\nmodel_provider = \"local_proxy\"\n\n[model_providers.local_proxy]\nname = \"local_proxy\"\nbase_url = \"http:\u002F\u002F127.0.0.1:4000\u002Fv1\"\nwire_api = \"responses\"\nrequires_openai_auth = true\n```\n\nSet the auth key for Codex:\n\n```bash\n# ~\u002F.codex\u002Fauth.json\n{ \"OPENAI_API_KEY\": \"\u003Csame PROXY_AUTH_KEY from .env>\" }\n```\n\n> **Using [CC Switch](https:\u002F\u002Fgithub.com\u002Ffarion1231\u002Fcc-switch)?** Skip the manual edit — add a provider in the GUI instead. See [Using with CC Switch](#using-with-cc-switch).\n\nRun `codex` — done.\n\n## Architecture\n\n```\n┌─────────────┐    Responses API    ┌──────────────┐\n│  Codex CLI  │────────────────────▶│ codex-bridge │\n│             │  Authorization:     │    :4000     │\n└─────────────┘  Bearer \u003Ckey>       └──────┬───────┘\n                                           │  model-based routing\n                   ┌───────────────────────┼────────────────────────┐\n                   │                       │                        │\n                   ▼                       ▼                        ▼\n          ┌────────────────┐      ┌────────────────┐       ┌──────────────┐\n          │   DeepSeek V4  │      │  Xiaomi MiMo   │       │    OpenAI    │\n          │ Chat Complet.  │      │ Chat Complet.  │       │  Responses   │\n          └────────────────┘      └────────────────┘       └──────────────┘\n```\n\n## Configuration\n\nAll settings via environment variables (see `env.example` for full documentation):\n\n### Auth\n\n| Variable | Default | Description |\n|---|---|---|\n| `PROXY_AUTH_KEY` | — | Single inbound key (no provider lock) |\n| `PROXY_KEYS` | — | Multi-key table: `\u003Ckey>:\u003Cprovider>,...` where provider ∈ `deepseek`\u002F`mimo`\u002F`openai`\u002F`*` |\n\nBoth empty = auth disabled (not recommended).\n\n### Upstream Providers\n\n| Variable | Default | Description |\n|---|---|---|\n| `DEEPSEEK_API_KEY` | — | DeepSeek upstream key |\n| `DEEPSEEK_BASE_URL` | `https:\u002F\u002Fapi.deepseek.com\u002Fv1` | DeepSeek base URL |\n| `DEEPSEEK_MODELS` | `deepseek-v4-pro,deepseek-v4-flash` | Models to advertise |\n| `MIMO_API_KEY` | — | Xiaomi MiMo upstream key |\n| `MIMO_BASE_URL` | `https:\u002F\u002Ftoken-plan-cn.xiaomimimo.com\u002Fv1` | MiMo base URL |\n| `MIMO_MODELS` | `mimo-v2.5-pro` | Models to advertise (**must be lowercase**) |\n| `OPENAI_API_KEY` | — | OpenAI upstream key (opt-in) |\n| `OPENAI_BASE_URL` | `https:\u002F\u002Fapi.openai.com\u002Fv1` | OpenAI base URL |\n| `OPENAI_MODELS` | — | Explicit OpenAI model list |\n| `OPENAI_MODEL_PREFIXES` | `gpt-,o1,o3,o4,codex-,chatgpt-` | Heuristic routing prefixes |\n\n### Model Catalog\n\n| Variable | Default | Description |\n|---|---|---|\n| `MODEL_CATALOG_PATH` | — | Path to a `proxy-models.json` file. Overrides `*_MODELS` vars. Same file Codex reads via `model_catalog_json` |\n\n### Tuning\n\n| Variable | Default | Description |\n|---|---|---|\n| `PROXY_PORT` | `4000` | Listen port |\n| `DEFAULT_PROVIDER` | auto | Fallback when model is unknown |\n| `LOG_LEVEL` | `info` | `silent` \u002F `error` \u002F `warn` \u002F `info` \u002F `debug` |\n| `ACCESS_LOG` | on | Set `0` to suppress per-request access logs |\n| `UPSTREAM_TIMEOUT_MS` | `120000` | Upstream request timeout |\n| `STORE_TTL_MS` | `3600000` | Response store entry TTL |\n| `STORE_MAX` | `500` | Response store LRU capacity |\n| `GITHUB_TOKEN` | — | Optional; falls back to `gh auth token` lazily |\n\n## Routing Rules\n\nEach request is routed by model name, in priority order:\n\n1. **Exact match** — model appears in `DEEPSEEK_MODELS`, `MIMO_MODELS`, or `OPENAI_MODELS`\n2. **Prefix heuristic** — model starts with an `OPENAI_MODEL_PREFIXES` entry → OpenAI\n3. **Name hint** — model contains `deepseek` or `mimo` → corresponding provider\n4. **Fallback** — `DEFAULT_PROVIDER`, then first provider with a configured key\n\n## Reasoning Effort Translation\n\nCodex sends `none | minimal | low | medium | high | xhigh`. Each upstream accepts a different subset:\n\n| Codex effort | DeepSeek | MiMo | OpenAI |\n|---|---|---|---|\n| `none` | `thinking: {type: \"disabled\"}` | `thinking: {type: \"disabled\"}` | field removed |\n| `minimal` | `reasoning_effort: \"low\"` | `reasoning_effort: \"low\"` | passthrough |\n| `low` \u002F `medium` \u002F `high` | passthrough | passthrough | passthrough |\n| `xhigh` | `reasoning_effort: \"xhigh\"` | clamped to `high` | clamped to `high` |\n\n> **Note:** DeepSeek silently ignores `enable_thinking: false`. The proxy uses `thinking: {type: \"disabled\"}` instead.\n\n## Endpoints\n\n| Method | Path | Auth | Description |\n|---|---|---|---|\n| `GET` | `\u002Fhealth` | No | Health check |\n| `GET` | `\u002Fv1\u002Fmodels` | Yes | Merged model list |\n| `POST` | `\u002Fv1\u002Fresponses` | Yes | Codex CLI main endpoint (Responses API) |\n| `POST` | `\u002Fv1\u002Fchat\u002Fcompletions` | Yes | Direct Chat Completions passthrough |\n| `GET` | `\u002Fcop?url=...` | Yes | URL fetch (Jina Reader \u002F native HTTP) |\n| `POST` | `\u002Fcop` | Yes | URL fetch with custom method\u002Fheaders\u002Fbody |\n\n## Smoke Test\n\n```bash\n.\u002Fscripts\u002Fsmoke.sh                    # uses localhost:4000 by default\n.\u002Fscripts\u002Fsmoke.sh http:\u002F\u002Fhost:4000   # custom target\nMODEL=mimo-v2.5-pro .\u002Fscripts\u002Fsmoke.sh  # test a different model\n```\n\nRuns 30 checks covering endpoints, input shapes, auth gate, streaming completion, effort translation, tool-call round-trips, and provider locking.\n\n## Using with CC Switch\n\n[CC Switch](https:\u002F\u002Fgithub.com\u002Ffarion1231\u002Fcc-switch) is a popular desktop app for managing provider profiles across AI CLI tools (Claude Code, Codex, Gemini CLI, etc.). You can use it to switch between codex-bridge and other providers with one click.\n\n### Setup\n\n1. Open CC Switch → **Codex** tab → **Add Provider**\n2. Fill in the provider fields:\n\n   | Field | Value |\n   |---|---|\n   | Name | `codex-bridge` (or any label you prefer) |\n   | API Key | Your `PROXY_AUTH_KEY` from `.env` |\n   | Base URL | `http:\u002F\u002F127.0.0.1:4000\u002Fv1` |\n\n3. Click **Enable** to activate — CC Switch writes the key to `~\u002F.codex\u002Fauth.json` and updates `config.toml` automatically.\n\n### Multi-provider switching\n\nIf you have multiple upstream keys (e.g., one for DeepSeek, one for MiMo), use `PROXY_KEYS` in `.env` to create per-provider inbound keys:\n\n```bash\nPROXY_KEYS=sk-deepseek-aaa:deepseek,sk-mimo-bbb:mimo,sk-all-ccc:*\n```\n\nThen create a separate CC Switch profile for each key — switching profiles swaps which upstream provider codex-bridge routes to.\n\n### CLI alternative\n\nIf you prefer the terminal, [cc-switch-cli](https:\u002F\u002Fgithub.com\u002FSaladDay\u002Fcc-switch-cli) provides the same profile switching without a GUI:\n\n```bash\n# List profiles\ncc-switch list\n\n# Switch to the codex-bridge profile\ncc-switch use codex-bridge\n```\n\n> **Tip:** After switching profiles, restart your terminal (or run `codex` in a new shell) for the new auth to take effect.\n\n## Advanced Usage\n\n- **Node 18–19 startup** — `--env-file` was added in Node 20. On older versions:\n  ```bash\n  set -a && source .env && set +a && node proxy.mjs\n  ```\n- **Background mode**:\n  ```bash\n  nohup node --env-file=.env proxy.mjs > \u002Ftmp\u002Fcodex-bridge.log 2>&1 &\n  ```\n- **Multi-key provider locking** — assign each inbound key to a specific provider for multi-profile setups. See `env.example` for the `PROXY_KEYS` format.\n- **Model catalog single source of truth** — point `MODEL_CATALOG_PATH` at the same JSON file Codex uses (`model_catalog_json` in `config.toml`) to keep model lists in sync automatically.\n\n## Troubleshooting\n\n| Symptom | Cause | Fix |\n|---|---|---|\n| `EADDRINUSE :4000` | Port already in use | `lsof -ti:4000 \\| xargs kill` or change `PROXY_PORT` in `.env` |\n| `401 Unauthorized` | Auth key mismatch | Ensure `OPENAI_API_KEY` in `~\u002F.codex\u002Fauth.json` matches `PROXY_AUTH_KEY` in `.env` |\n| `--env-file: not recognized` | Node.js \u003C 20 | Use `set -a && source .env && set +a && node proxy.mjs` |\n| Upstream timeout | Slow provider response | Increase `UPSTREAM_TIMEOUT_MS` in `.env` (default 120 000 ms) |\n| Model not found | Model not in any `*_MODELS` list | Add it to `DEEPSEEK_MODELS` \u002F `MIMO_MODELS` \u002F `OPENAI_MODELS`, or use `MODEL_CATALOG_PATH` |\n\n## Requirements\n\n- Node.js 18+\n- macOS \u002F Linux \u002F Windows\n- At least one upstream API key (DeepSeek, MiMo, or OpenAI)\n\n## License\n\nMIT — see [LICENSE](.\u002FLICENSE).\n","codex-bridge 是一个零依赖的本地代理，用于将 Codex CLI 与 DeepSeek、Xiaomi MiMo 和 OpenAI 通过单一的 base_url 进行桥接。该项目使用 JavaScript 编写，具备多提供商路由、双向协议翻译以及针对不同提供商的推理努力级别转换等功能。它还支持思考模式下的工具调用回环、内置 web_fetch 工具和工具调用断路器等特性，确保了跨平台会话的连续性和安全性。适用于需要在不同 AI 模型间无缝切换的应用场景，如开发、测试或集成多种 AI 服务的环境。",2,"2026-06-11 03:54:48","CREATED_QUERY"]