Universal provider proxy for OpenAI Codex & Claude Code — use any LLM (Claude, Gemini, Grok, DeepSeek, Ollama…) with Codex CLI, App, SDK, and Claude Code
Universal provider proxy for OpenAI Codex & Claude Code — use any LLM (Claude, Gemini, Grok, DeepSeek, Ollama…) with Codex CLI, App, SDK, and Claude Code
Universal provider proxy for OpenAI Codex, Claude Code, Claude Desktop & Grok Build
Two commands, and every one of them runs any LLM you point it at.
npm install -g @bitkyc08/opencodex
ocx startClaude Code, running any modelThe picker is stock Claude Code. The brain behind it isn't. |
|
Codex, running any modelPick a provider and go — same workflow, different brain. |
|
Claude Desktop, running any modelOpus answers, then hands the task to a GPT-5.6 Sol subagent. |
|
Grok Build, running any modelSol drives the session and calls a Kimi K3 subagent. |
English · Français · 한국어 · 简体中文 · 繁體中文 · Русский · 日本語 · Türkçe · Full documentation →
opencodex is a lightweight local proxy that translates Codex's Responses API into whatever your provider speaks — streaming, tool calls, reasoning tokens, images, in both directions. Use Claude, Gemini, Grok, GLM, DeepSeek, Kimi, Qwen, Ollama, or any other LLM with Codex, Claude Code, Claude Desktop, and Grok Build. It can also manage a ChatGPT account pool for Codex auth: add accounts, refresh their quotas in the dashboard, and let new sessions auto-route to the lowest-usage healthy account while existing threads stay pinned to the account that started them.
npm install -g @bitkyc08/opencodex # Node 18+; the Bun runtime is bundled automatically
ocx start # proxy + dashboard on localhost:10100Use ocx service to run it in the background.
Open http://localhost:10100 and configure everything in the web dashboard — add providers
(40+ built-ins, or any OpenAI-compatible endpoint), pick models, manage accounts. ocx gui
re-opens the dashboard at any time.
It can also manage a ChatGPT account pool for Codex auth. Add multiple ChatGPT / Codex accounts,
refresh their 5h / weekly / 30d quota in the dashboard. Under quota routing, new sessions can use
the lowest-usage healthy account; round-robin and fill-first use their own policies. Existing Codex
threads normally retain affinity to the account that started them, so long SSH, tmux, or
mobile-connected sessions do not jump accounts mid-conversation — but quota re-evaluation, failover,
account exclusion, affinity expiry, or 401/403 and 429 recovery can rebind them. Give the accounts a
selection order when one of them — usually your Codex Desktop login — should only be reached for
once the others are drained.
Sponsors keep opencodex maintained across every upstream protocol change. Interested? See SPONSORS.md.
Thanks to OrcaRouter for sponsoring this project! OrcaRouter is one OpenAI-compatible AI gateway for production AI: adaptive routing that grades every prompt and sends it to the model that clears your bar, automatic failover, routing rules as code, zero-markup provider pricing with prompt caching, and guardrails, an agent firewall, and request logs on every call across 200+ models. Pick OrcaRouter in the Add provider picker or run ocx provider add orcarouter; orcarouter/auto is the adaptive router. |
|
Thanks to PackyCode for sponsoring this project! PackyCode is a stable, high-performance API relay provider, offering relay services for Claude Code, Codex, Gemini, and more. With automatic failover, smart routing, and unlimited concurrency, it turns AI into a real productivity tool. Register via this link and get started! Pick PackyCode in the Add provider picker or run ocx provider add packycode.PackyCode 是一家稳定、高效的 API 中转服务商,提供 Claude Code、Codex、Gemini 等多种中转服务。具备自动故障转移、智能路由和无限并发等多种功能,让 AI 编程成为真正的生产力工具。点此链接注册,立即开始使用! |
The repository ships a digest-pinned, non-root Compose build. With Git and Bun installed on the host, generate the canonical compatibility manifest before every image build, then initialize the data-plane token once through stdin and start the hub:
git clone https://github.com/lidge-jun/opencodex.git
cd opencodex
bun scripts/generate-compatibility-version.ts
docker compose build
openssl rand -hex 32 | docker compose run --rm -T hub bun run docker/bootstrap-token.ts
docker compose up -d
curl --fail --silent http://127.0.0.1:10100/healthz
curl --fail --silent http://127.0.0.1:10100/readyzThe default host binding is 127.0.0.1:10100. Remote exposure requires explicit
OPENCODEX_BIND_ADDRESS=<LAN-or-Tailscale-IP> docker compose up -d; 0.0.0.0 opts into
all host interfaces. Restrict access with a firewall and an authenticated TLS/tailnet frontend.
The generated JSON stays untracked; it is copied into the image without including .git.
Regenerate it after source changes, and do not change the source between generation and build.
The build rejects stale manifests, missing or mismatched files, extra source files, and symlinks.
It checks every recorded SHA-256 against the build context and copied runtime files, including
package.json, bun.lock, and the specifically included scripts/model-metadata.source.json.
The token and mutable state stay in the ocx-state named volume; no credential is placed in the
image, Compose file, environment, or shell arguments. See the
Remote Hub deployment guide for provider
setup, authenticated acceptance checks, remote management, and rollback.
macOS / Linux:
curl -fsSL https://bun.sh/install | bash
git clone https://github.com/lidge-jun/opencodex.git
cd opencodex && ~/.bun/bin/bun install
~/.bun/bin/bun run src/cli/index.ts startWindows (PowerShell):
irm bun.sh/install.ps1 | iex
git clone https://github.com/lidge-jun/opencodex.git
cd opencodex; bun install
bun run src/cli/index.ts startSource install runs the latest dev branch. Memory ownership
patches, runtime GC improvements, and unreleased fixes are available here before
they reach the npm package.
npm install -g @bitkyc08/opencodex
ocx start # or `ocx service`
ocx init # interactive setup: writes ~/.opencodex/config.json and wires Codexocx init never starts the proxy; start it first (or after — either order works, but headless
commands like ocx provider add and ocx combo set talk to the live proxy and exit nonzero
when it is unreachable). ocx status / ocx doctor / ocx health report the running state.
Agents installing or running opencodex: read
AGENTS_INSTALL.md. An interactiveocx startmay ask once whether to star this repository — that is the user's decision, never an agent's. The CLI suppresses the prompt for agent-driven runs and the API refuses them with403 agent_consent_required.
| OS | Status | Service manager |
|---|---|---|
| macOS (arm64 / x64) | Fully supported | launchd |
| Linux (x64 / arm64) | Fully supported | systemd (user unit) |
| Windows (x64) | Fully supported | Task Scheduler (hidden) / opt-in native service (--native, WinSW) |
Requires Node 18+. The Bun runtime is bundled on npm install — no separate
Bun install needed, no WSL needed on Windows. If npm blocked the bundled runtime's install scripts,
see the installation docs.
Use any LLM with Codex, Claude Code, Claude Desktop, and Grok Build — 40+ providers out of the box, each keeping its own native UI.
Pool ChatGPT accounts — thread affinity, quota-aware auto-switching, cooldown and fail-closed auth handling.
Provider-policy note: Account pooling is for routing and operational resilience only; it does not guarantee protection from provider rate limits, enforcement, suspension, or other account actions. OpenCodex does not endorse using additional accounts to circumvent provider limits or sharing account credentials between people. You are responsible for complying with each provider's current terms. See the Codex Auth account-pool guidance and OpenAI's current Terms of Use.
Combos — one virtual model id with failover or weighted round-robin across providers. See the combo guide.
Sub-agents on any model — feature routed models in Codex's sub-agent picker, with v1/v2 surface control and fallback chains. See the sub-agent guide.
Log in once, skip the API key — OAuth for xAI, Anthropic, and Kimi; or forward
codex login, paste a key, or use ${ENV_VAR} references.
Web search & vision sidecars — non-OpenAI models get real web search and image understanding through a sidecar over your ChatGPT login.
See what's happening — the dashboard shows providers, OAuth status, model selection, and a live request log with cache token counts.
Clean exit, zero residue — ocx stop restores Codex to its original configuration.
Bounded memory ownership — every long-lived cache, ring buffer, and protocol-translation
store has a finite cap, byte budget, or active reconciliation. No unbounded Map or Set
survives a config reload.
OpenCodex tracks 36 categories of process-retained state. Each has a documented bound:
[Bug]: no SSE fallback after an established Codex WebSocket dies mid-turn (prelude-timeout half resolved)
[Bug] Claude Code accounts native Anthropic models (Sonnet, Opus) at 200k through `ocx claude`, despite the registry declaring 1M (`ANTHROPIC_MODEL_CONTEXT_WINDOWS`)
[Feature]: requestPacing option to cap concurrent in-flight requests at provider and model level
Cursor integration: surface the Private Inference local-mode installer when only regular Cursor is installed
Add configurable low-quota threshold actions (pause / desktop alert)
[Feature]: Dynamic Model Selection and Smart Routing via TypeSafe Jev
New model metadata gaps: grok-4.7 falls back to 128K and unconstrained effort in 2.61.0
[Feature]: Model-aware account routing for the Anthropic OAuth account pool
mimo tool type 'web_search' is not supported by this gateway phase.
Aside emergency compaction exhausts tiny GLM summary budget through nested combos