ConfigsJul 24, 2026·3 min read

OpenCodex — Universal LLM Proxy for AI Coding Agents

Universal provider proxy that lets you use any LLM (Claude, Gemini, Grok, DeepSeek, Ollama) with OpenAI Codex CLI, Claude Code, and other AI coding agents through a single gateway.

Agent ready

Ready-to-run agent install

This asset can be installed after the agent chooses its runtime, checks the plan, and runs the matching command.

Native · 98/100Policy: allow
Agent surface
Any MCP/CLI agent
Kind
Skill
Install
Single
Trust
Trust: Established
Entrypoint
OpenCodex
Direct install command
npx -y tokrepo@latest install 700c44f6-875c-11f1-9bc6-00163e2b0d79 --target codex

Run after dry-run confirms the install plan.

Introduction

OpenCodex is an open-source proxy server that bridges any LLM provider to AI coding agents like OpenAI Codex CLI and Claude Code. Instead of being locked into a single model vendor, OpenCodex translates API calls on the fly so you can use Claude, Gemini, Grok, DeepSeek, or locally hosted models through Ollama with any coding agent that speaks the OpenAI-compatible API format.

What OpenCodex Does

  • Proxies OpenAI-compatible API requests to 10+ LLM providers transparently
  • Enables using Claude, Gemini, DeepSeek, or Ollama models with Codex CLI
  • Translates tool-use and function-calling formats between provider APIs
  • Supports streaming responses for real-time coding agent feedback
  • Runs as a local proxy server with zero cloud dependency

Architecture Overview

OpenCodex runs a lightweight TypeScript-based HTTP proxy that intercepts OpenAI-formatted API requests and translates them to the target provider's native format. It handles authentication, request transformation, streaming response adaptation, and error normalization. The proxy supports hot-swapping between providers without restarting the coding agent, and includes a caching layer to reduce redundant API calls during iterative coding sessions.

Self-Hosting & Configuration

  • Install globally via npm or run with npx for quick sessions
  • Configure provider credentials via environment variables or config file
  • Start the proxy and point your coding agent's API base URL to localhost
  • Set up model aliases to map generic names to provider-specific identifiers
  • Enable request logging for debugging and cost tracking

Key Features

  • Supports Claude, Gemini, Grok, DeepSeek, Ollama, and OpenRouter providers
  • Tool-use format translation between OpenAI, Anthropic, and Google schemas
  • Request caching reduces token costs during iterative agent workflows
  • Provider failover automatically switches to backup providers on errors
  • Model aliasing lets agents reference models by simple names

Comparison with Similar Tools

  • LiteLLM — broader scope API gateway; OpenCodex is optimized for coding agents
  • OpenRouter — SaaS routing service; OpenCodex runs entirely locally
  • Portkey AI Gateway — enterprise-focused; OpenCodex is lightweight and self-hosted
  • Bifrost CLI — wraps Claude Code specifically; OpenCodex supports multiple agents
  • Ollama — local model runner; OpenCodex proxies to Ollama and many other providers

FAQ

Q: Does it work with Claude Code out of the box? A: Yes, set the API base URL environment variable to point at the proxy and Claude Code will use your chosen provider.

Q: Can I use local models through Ollama? A: Yes, configure Ollama as the provider and OpenCodex will proxy requests to your local Ollama instance.

Q: Does it support streaming? A: Yes, server-sent events are translated between provider formats for real-time output.

Q: Is there any performance overhead? A: Minimal. The proxy adds single-digit milliseconds of latency for request translation.

Sources

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets