Contents

opencodex: Run Codex and Claude Code on Any LLM

opencodex is a local proxy that translates Codex’s Responses API into whatever protocol your LLM provider speaks. You can use Claude, Gemini, DeepSeek, Grok, GLM, Qwen, or even a local Ollama model inside Codex CLI, Codex App, and SDK — and in Claude Code too — without waiting for anyone to add official support.

Streaming, tool calls, reasoning tokens, image generation — everything works, in both directions.

npm install -g @bitkyc08/opencodex
ocx init
ocx start

Three commands, and Codex is rerouted. It forwards your ChatGPT login by default; you can add more models anytime.

Codex CLI / App / SDK ──/v1/responses──▶ opencodex ──▶ Any provider
     Anthropic · xAI · Kimi · Google · DeepSeek · Groq · OpenRouter
     Ollama Cloud · Azure · GLM · Mistral · Qwen · GitHub Copilot · Local Ollama

opencodex runs an HTTP service on localhost:10100. Codex requests hit this proxy first, which translates them into the target provider’s protocol. To Codex, it’s just an OpenAI-compatible endpoint; to downstream providers, the request format matches their native API.

Five adapters cover all major protocols:

AdapterCovers
openai-responsesOpenAI Responses API passthrough
openai-chatOpenAI Chat Completions (and all compatible endpoints)
anthropicAnthropic Messages API
googleGoogle Gemini (AI Studio / Vertex / Antigravity)
azure-openaiAzure OpenAI

One protocol layer handles 50+ providers.

This is opencodex’s core value: plugging any model into Codex.

These 7 providers support OAuth login — no API key needed. Just log in with your existing account, and tokens auto-refresh:

ocx login xai                 # xAI Grok
ocx login anthropic           # Anthropic Claude
ocx login kimi                # Moonshot Kimi
ocx login kiro                # Kiro
ocx login google-antigravity  # Google Cloud Code Assist
ocx login cursor              # Cursor (experimental)
ocx login github-copilot      # GitHub Copilot (device-flow OAuth)

After logging in, use them directly in Codex:

codex -m "anthropic/claude-opus-4-8" "Explain this stack trace"
codex -m "xai/grok-4.5" "Write a Rust HTTP server"
codex -m "cursor/gpt-5.6-sol" "Refactor this module"

For 40+ providers that use API keys. The easiest way is through the web dashboard:

ocx gui   # Opens http://localhost:10100
  1. Click “Add Provider”
  2. Pick one from the built-in provider list
  3. Paste your API key
  4. Models are auto-discovered from the provider’s /v1/models endpoint — ready immediately

Full API-key provider list:

CategoryProviders
OpenAIopenai-apikey
Anthropicanthropic-apikey
Googlegoogle (Gemini), google-vertex (Vertex AI)
Azureazure-openai
OpenRouteropenrouter, orcarouter
Chinese LLMsdeepseek, zai (GLM), qwen-cloud, qianfan (Baidu), moonshot (Kimi API), kimi-code, minimax, minimax-cn, alibaba, alibaba-token-plan, alibaba-token-plan-intl
Internationalmistral, cerebras, together, fireworks, firepass, nvidia (NIM), groq
Gateways / Aggregatorsopenrouter, zenmux, litellm, vercel-ai-gateway, cloudflare-ai-gateway, cloudflare-workers-ai
Coding Assistantsgithub-copilot (OAuth also available), gitlab-duo, umans, opencode-go, neuralwatt
Othersollama-cloud, huggingface, venice, nanogpt, synthetic, parallel, opencode-zen, opencode-free, xiaomi (MiMo), kilo, mimo-free

You can also edit ~/.opencodex/config.json directly:

{
  "port": 10100,
  "defaultProvider": "deepseek",
  "providers": {
    "deepseek": {
      "adapter": "openai-chat",
      "baseUrl": "https://api.deepseek.com",
      "apiKey": "${DEEPSEEK_API_KEY}",
      "defaultModel": "deepseek-chat"
    },
    "openrouter": {
      "adapter": "openai-chat",
      "baseUrl": "https://openrouter.ai/api/v1",
      "apiKey": "${OPENROUTER_API_KEY}"
    }
  }
}

The ${ENV_VAR} syntax resolves at request time from environment variables — keys never land in the config file.

Ollama, vLLM, LM Studio — anything that exposes an OpenAI-compatible endpoint works:

{
  "providers": {
    "ollama": {
      "adapter": "openai-chat",
      "baseUrl": "http://localhost:11434/v1",
      "apiKey": "",
      "defaultModel": "qwen3:32b"
    },
    "vllm": {
      "adapter": "openai-chat",
      "baseUrl": "http://localhost:8000/v1",
      "apiKey": "",
      "defaultModel": "Qwen/Qwen3-32B"
    }
  }
}

Any OpenAI Chat Completions-compatible endpoint works — just fill in baseUrl + apiKey. Choose Custom in the dashboard, or pick custom in ocx init and enter the base URL.


Once added, models appear in the Codex App model picker with per-model reasoning effort controls (low / medium / high / xhigh / max / ultra), right alongside native models.

Target any provider and model using provider/model syntax:

# Claude Opus via Anthropic
codex -m "anthropic/claude-opus-4-8" "Explain this stack trace"

# Gemini via Google
codex -m "google/gemini-3-pro" "Write unit tests for auth.ts"

# DeepSeek
codex -m "deepseek/deepseek-chat" "Write a SQL migration"

# Local Ollama model
codex -m "ollama/llama3" "Refactor this function"

Omitting the provider/ prefix routes to the default provider, or auto-matches by model name pattern (claude-* → Anthropic, gpt-* → OpenAI).

opencodex lets you pin up to 5 models in Codex’s subagent picker — route complex tasks to a reasoning model and quick tasks to a cheap one:

{
  "subagentModels": [
    "anthropic/claude-opus-4-8",
    "deepseek/deepseek-chat",
    "google/gemini-3-pro"
  ]
}

On the v2 multi-agent surface, the proxy auto-injects delegation guidance (preferred sub-agent model + effort level + model roster).

opencodex gives non-OpenAI models real web search and image understanding via a gpt-5.4-mini sidecar running on your ChatGPT login.

  • Web Search Sidecar: When a routed model triggers a search, the request is forwarded to the sidecar for real web search, and results are fed back to the routed model
  • Vision Sidecar: When a text-only model encounters an image, the sidecar describes it using gpt-5.4-mini before passing it to the routed model

Both sidecars support configurable on/off, backend (openai / anthropic), model, and per-turn call limits.

The same proxy serves Claude Code too:

ocx claude [args...]

This launches a fully wired Claude Code instance. Routed models appear in the native /model picker via claude-ocx-<provider>--<model> aliases. Your Claude Code OAuth login stays untouched.

If you have multiple ChatGPT / Codex accounts, opencodex manages them as a pool:

  • Existing threads keep affinity: Thread IDs bind to an account and persist across turns — long sessions won’t break
  • New sessions auto-route: Compares 5-hour / weekly / 30-day quotas, picks the lowest-usage healthy account
  • One-click quota refresh: From the Codex Auth page in the dashboard
  • 429 auto cooldown + failover: Quota exhaustion doesn’t hard-fail
ocx service install     # Install as system service, auto-starts at login (launchd / systemd / Task Scheduler)
ocx codex-shim install  # On-demand: auto-starts proxy whenever codex runs
ocx stop                # Stop proxy, restore native Codex config
ocx uninstall           # Full uninstall

After ocx stop, plain codex works exactly as it did before — zero residue.

Binds to 127.0.0.1 by default. To expose on LAN, set a token:

export OPENCODEX_API_AUTH_TOKEN="your-secret-token"
ocx start

Clients must include x-opencodex-api-key: your-secret-token in every request. Token comparison uses constant time to prevent timing attacks.

opencodex breaks the “Codex only runs OpenAI” lock-in. The onboarding cost is near zero — OAuth login with one command, API key paste-and-go, local models with just a baseUrl. For engineers already using Codex CLI or Claude Code daily, installing it means you can pick the best model for each task instead of being tied to a single provider.

MIT licensed, independent community project, not affiliated with OpenAI or Anthropic.