n2q’s Posts
Log in
EZPost LogoPowered by EZPost© 2026 n2q
opencodex: Use Claude, Gemini, and Grok Inside Codex CLI
n2q’s PostsAI Agents & Coding Tools
AI Agents & Coding Tools

opencodex: Use Claude, Gemini, and Grok Inside Codex CLI

Codex CLI was built to run OpenAI models. opencodex is a lightweight local proxy that lets you route it to Claude, Gemini, Grok, DeepSeek, Ollama, or any of 40-plus providers without waiting for upstream support.

N
Written byn2q
02 Aug 20260 min read8 views

Table of Contents

  • What it is
  • Why it matters
  • How it works
  • Caveats
  • Who it's for

#opencodex: Use Claude, Gemini, and Grok Inside Codex CLI

Codex CLI was built to run OpenAI models. opencodex is a lightweight local proxy that lets you route it to Claude, Gemini, Grok, DeepSeek, Ollama, or any of 40-plus providers without waiting for upstream support.

#What it is

opencodex is a local proxy that translates OpenAI Codex's Responses API into whatever protocol your chosen provider speaks. It sits between Codex (or Claude Code, or GitHub Copilot App) and the model you want to use, handling streaming, tool calls, reasoning tokens, and image inputs in both directions.

The proxy supports over 40 built-in providers with five protocol adapters, including Anthropic, Google, xAI, Kimi, Ollama, DeepSeek, GLM, and any OpenAI-compatible endpoint. Models are auto-discovered via the /v1/models endpoint, so once you add a provider, the available models populate automatically. It runs natively on macOS, Linux, and Windows.

Beyond routing, opencodex also manages a pool of ChatGPT accounts for Codex, handling quota tracking, cooldown, failover, and session affinity.

#Why it matters

  • Model freedom inside Codex. You can use Claude Opus, Gemini, Grok, GLM, DeepSeek, or local models via Ollama directly in Codex CLI without waiting for OpenAI to add support.
  • One proxy, multiple tools. opencodex serves Codex CLI, Codex App, Codex SDK, Claude Code, and GitHub Copilot App from the same layer.
  • Account pool management. If you use ChatGPT accounts with Codex, opencodex tracks quota across accounts, routes new sessions to the least-used healthy account, and fails over on rate-limit errors.
  • Dashboard-driven configuration. A web dashboard lets you add providers and view logs without editing config files.

#How it works

The proxy acts as a translator. Codex speaks the Responses API format. Your provider speaks its own protocol (Anthropic Messages, Google Gemini, OpenAI Chat, etc.). opencodex sits in the middle, translating bidirectionally.

Model selection uses a provider/model syntax. For example, codex -m "anthropic/claude-opus-5" routes to Claude through Anthropic. codex -m "google/gemini-3-pro" routes to Gemini through Google. codex -m "ollama/llama3" routes to a local model through Ollama. Each command lights up the corresponding provider in the dashboard as it runs.

The account pool feature tracks 5-hour, weekly, and 30-day quota bars per ChatGPT account. Existing sessions keep affinity to their original account. New sessions auto-route to the lowest-usage healthy account. When an account hits a 429 rate-limit error, it enters cooldown and traffic fails over to the next healthy option.

#Caveats

You still need credentials for each provider. opencodex does not provide free LLM access. You need an API key or OAuth login for Anthropic, Google, xAI, or whichever provider you choose.

Quality depends entirely on the model you select, not the proxy. If Claude Opus produces better reasoning than Gemini for your task, that is a model difference, not something opencodex changes.

Cursor native local execution is disabled by default because it bypasses Codex's sandbox. Only enable it in a trusted environment.

#Who it's for

opencodex is for developers who like Codex CLI or Claude Code as a harness but want the freedom to choose any LLM provider. If you are locked into one model because your tool only supports one provider, opencodex removes that constraint. If you already have a stable single-provider setup that works well, the value is lower.

The takeaway: opencodex turns Codex and Claude Code into a gateway to any LLM. It is a small tool that solves a specific bottleneck, and for developers who want provider flexibility inside their existing coding agent, it hits the right spot.

Source: https://github.com/lidge-jun/opencodex

Filed under
AI Agents & Coding Tools
Share this post
N
About the author
n2q
Sharing ideas and building in public.
View all posts
Loading comments...

Table of Contents

  • What it is
  • Why it matters
  • How it works
  • Caveats
  • Who it's for
Keep reading

More from n2q

See all
Agent Reach: Giving AI Agents Eyes to See the Entire InternetAI Agents & Coding Tools

Agent Reach: Giving AI Agents Eyes to See the Entire Internet

An AI agent can write code, manage projects, and summarize documents, but ask it to read a Twitter thread, search Reddit, or pull a YouTube transcript, and it usually hits a wall of API requirements, access blocks, and scattered configuration. Agent Reach wants to fix exactly th…

Nn2q0 min
AI Spec Driven: Make AI Write a Spec Before CodingAI Agents & Coding Tools

AI Spec Driven: Make AI Write a Spec Before Coding

You are coding with AI agents already, but are you still throwing vague prompts at them and hoping for the best? AI Spec Driven is a working framework that separates the thinking phase from the coding phase, and it can save you from a lot of rework.

Nn2q0 min
AIDLC: Turning Claude Code Into a Software PipelineAI Agents & Coding Tools

AIDLC: Turning Claude Code Into a Software Pipeline

A developer based in Hanoi has built AIDLC, an open-source project that transforms Claude Code from a chat box into a structured software development pipeline with agents, skills, checkpoints, and token monitoring.

Nn2q0 min