Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
O

opencodex

> AI 编程
Open source

Universal provider proxy for OpenAI Codex & Claude Code — use any LLM (Claude, Gemini, Grok, DeepSeek, Ollama…) with Codex CLI, App, SDK, and Claude Code

6.4K stars0 likes3 views
WebsiteGitHub

About

Universal provider proxy for OpenAI Codex & Claude Code — use any LLM (Claude, Gemini, Grok, DeepSeek, Ollama…) with Codex CLI, App, SDK, and Claude Code

make codex open!

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.

bash
npm install -g @bitkyc08/opencodex
ocx start

Claude Code, running any model

The picker is stock Claude Code. The brain behind it isn't.

Codex, running any model

Pick a provider and go — same workflow, different brain.

Claude Desktop, running any model

Opus answers, then hands the task to a GPT-5.6 Sol subagent.

Grok Build, running any model

Sol 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.

Quick start

Personal install

bash
npm install -g @bitkyc08/opencodex   # Node 18+; the Bun runtime is bundled automatically
ocx start                         # proxy + dashboard on localhost:10100

Use 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

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 编程成为真正的生产力工具。点此链接注册,立即开始使用!

Docker Compose

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:

bash
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/readyz

The 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.

Install from source (latest dev)

macOS / Linux:

bash
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 start

Windows (PowerShell):

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 start

Source install runs the latest dev branch. Memory ownership patches, runtime GC improvements, and unreleased fixes are available here before they reach the npm package.

For agents
bash
npm install -g @bitkyc08/opencodex
ocx start     # or `ocx service`
ocx init      # interactive setup: writes ~/.opencodex/config.json and wires Codex

ocx 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 interactive ocx start may 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 with 403 agent_consent_required.

Supported platforms

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.

Highlights

  • 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.

Memory ownership details

OpenCodex tracks 36 categories of process-retained state. Each has a documented bound:

  • 12 retained stores (request log, debug rings, image cache, model cache, vision descriptions, cursor blobs, responses continuation, etc.) are byte-accounted and evicted by the app-owned memory budget (default 256 MiB).
  • 4 observed buffers (translator accumulators, image/OAuth/Grok tails) are monitored for in-flight byte pressure without eviction.
  • 24 state-store registrations handle expiry sweeps (60 s interval) and config-generation reconciliation so stale provider/account keys are removed.
  • Path and fingerprint memos (workspace metadata, hardened identities, installation salts, mode-hint capabilities) use insertion-order LRU caps (8–128 entries).
  • Model-cache generation tombstones are deleted after reconciliation; a global generation increment prevents stale in-flight discoveries from repopulating removed providers.
  • Lab event-id deduplication runs u

Issues· 118 open

View all issuesOpen on GitHub
  • #4191

    [Bug]: no SSE fallback after an established Codex WebSocket dies mid-turn (prelude-timeout half resolved)

    bugstreamingpriority: P1Updated Sep 24, 2026
  • #5755

    [Bug] Claude Code accounts native Anthropic models (Sonnet, Opus) at 200k through `ocx claude`, despite the registry declaring 1M (`ANTHROPIC_MODEL_CONTEXT_WINDOWS`)

    bugcatalogclitoolsinstallUpdated Sep 24, 2026
  • #5702

    [Feature]: requestPacing option to cap concurrent in-flight requests at provider and model level

    enhancementproxystreamingpriority: P2Updated Sep 24, 2026
  • #5679

    Cursor integration: surface the Private Inference local-mode installer when only regular Cursor is installed

    enhancementpriority: P3Updated Sep 24, 2026
  • #5649

    Add configurable low-quota threshold actions (pause / desktop alert)

    enhancementaccount-poolpriority: P3Updated Sep 24, 2026
  • #5626

    [Feature]: Dynamic Model Selection and Smart Routing via TypeSafe Jev

    enhancementcatalogproxypriority: P3Updated Sep 24, 2026
  • #5576

    New model metadata gaps: grok-4.7 falls back to 128K and unconstrained effort in 2.61.0

    bugaccount-poolcatalogpriority: P2Updated Sep 24, 2026
  • #5561

    [Feature]: Model-aware account routing for the Anthropic OAuth account pool

    enhancementaccount-poolproxypriority: P2Updated Sep 24, 2026
  • #5501

    mimo tool type 'web_search' is not supported by this gateway phase.

    provider-compatibilityproviderpriority: P2Updated Sep 24, 2026
  • #5465

    Aside emergency compaction exhausts tiny GLM summary budget through nested combos

    provider-compatibilityproviderpriority: P2Updated Sep 24, 2026

> Tags

TypeScriptai-gatewayai-toolsanthropicchatgpt

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 24, 2026
CategoryAI 编程
PricingOpen source

> Related tools

G
GitHub Copilot
GitHub 官方 AI 编程助手,覆盖补全、Chat 与 Agent 模式。
C
Cursor
AI 原生代码编辑器,对话改代码、多文件 Agent 与规则体系是其核心。
S
skills
Skills for Real Engineers. Straight from my .agents directory.