Claude Code model router
Agent CLI To API
Expose agent CLIs (Codex, Cursor Agent, Claude Code, Gemini) as an OpenAI-compatible /v1 API gateway.
Install
uvx --from git+https://github.com/leeguooooo/agent-cli-to-api agent-cli-to-api codexFound in the project README. Check it for setup steps after installing.
git clone https://github.com/leeguooooo/agent-cli-to-api.gitFrom the README
agent-cli-to-api Expose popular agent CLIs as a small OpenAI-compatible HTTP API (/v1/*). Works great as a local gateway (localhost) or behind a reverse proxy. Think of it as LiteLLM for agent CLIs: you point existing OpenAI SDKs/tools at base_url, and choose a backend by model. Supported backends: - OpenAI Codex - defaults to backend /responses for vision and image generation (DALL-E / gpt-image-class output); falls back to codex exec - Cursor Agent - via cursor-agent CLI - Claude Code - via CLI or direct API (auto-detects ~/.claude/settings.json config) - Gemini - via CLI or CloudCode direct (set GEMINI_USE_CLOUDCODE_API=1) Why this exists: - Many tools/SDKs only speak the OpenAI API (/v1/chat/completions) - this lets you plug agent CLIs into that ecosystem. - One gateway, multiple CLIs: pick a backend by model (with optional prefixes like cursor: / claude: / gemini:). - Expose your ChatGPT Plus / Pro subscription's image generation as an HTTP API. No OPENAI_API_KEY required — the gateway reuses the OAuth token from codex login, lets you call image_generation via plain chat completions, and returns the PNG inline (data URI). See Image generation (ChatGPT subscription). Table of Contents - Requirements - Install - Run (No .env Needed) - Core Configuration - API - Image generation (ChatGPT subscription) - OpenAI SDK examples - Security notes - Logging & Performance Diagnosis - Performance notes (important) - Advanced setup (optional) - Keywords (SEO) Requirements - Python 3.10+ (tested on 3.13) - Install and authenticate the CLI(s) you want to use (codex, cursor-agent, claude, gemini) Install Option A: one-line installer Install and start the macOS launchd service: Pin a token and install the launchd service: The installer defaults to ~/.agent-cli-to-api,…
Details
- Repository
- leeguooooo/agent-cli-to-api
- Language
- Python
- Last updated
- 7 October 2026
- Topics
- agentchat-completionsclaude-codeclicodexcursor-agentfastapigatewaygeminiopenai-apiopenai-compatibleproxy
FAQ
What is Agent CLI To API?
Expose agent CLIs (Codex, Cursor Agent, Claude Code, Gemini) as an OpenAI-compatible /v1 API gateway. It is a model router for Claude Code, from leeguooooo/agent-cli-to-api on GitHub.
How do I install Agent CLI To API?
Run uvx --from git+https://github.com/leeguooooo/agent-cli-to-api agent-cli-to-api codex, then follow the setup in the README.
Is Agent CLI To API popular?
leeguooooo/agent-cli-to-api has 84 GitHub stars and 23 forks. It was last updated on 7 October 2026.
More model routers & proxies
Llm Task Orchestrator
123naberbabammm34343/llm-task-orchestrator
Top AI Router 2026: Split Codex for Quick Code & Claude for Complex Refactoring
Tamp
95sliday/tamp
Token compression proxy for Claude Code. 50% fewer tokens, zero behavior change.
Castari Proxy
89castari/castari-proxy
Use Claude Agent SDK and Claude Code with other providers/models
Clauderipple
85PBJ-2/clauderipple
Use GPT, DeepSeek, GLM, Gemini, Kimi and 400+ models in Claude Desktop's own model picker and in Claude Code, while staying signed in to your Claude subscription (1P, no gateway mode). Auto reasoning effort per prompt, subagents routed by difficulty, cache and limit warnings. Claude inside Codex too.
CC Translate Proxy
101GGGODLIN/cc-translate-proxy
Type 中文, CC sees English. Sidecar i18n proxy for Claude Code.
Starbase
84bstaruk/starbase
⭐ A front-end starter kit and Claude Code boilerplate -- built on Vite 8, TypeScript 6, Tailwind 4, TanStack Router, and TanStack Query.
Browse the most popular Claude Code mods, all model routers & proxies, or the skills and MCP server directories.