GitHub - router-for-me/CLIProxyAPI: Wrap Gemini CLI, Antigravity, ChatGPT Codex, Claude Code, Qwen Code, iFlow as an OpenAI/Gemini/Claude/Codex compatible API service, allowing you to enjoy the free Gemini 2.5 Pro, GPT 5, Claude, Qwen model through API
Key Points
- 1CLIProxyAPI is a proxy server that provides OpenAI/Gemini/Claude/Codex compatible API interfaces for CLI models, allowing local or multi-account access to various AI services.
- 2It features multi-account load balancing, streaming responses, function calling, multimodal input, and model mapping, supporting authentication primarily via OAuth for popular AI models.
- 3The project integrates with tools like Amp CLI and has spawned an ecosystem of dependent applications, enabling users to leverage AI coding tools without needing direct API keys for OAuth providers.
CLIProxyAPI is an open-source proxy server designed to provide a unified, compatible API interface for various large language models (LLMs) and generative AI services, including OpenAI (Codex/GPT models), Google Gemini, Claude Code, Qwen Code, and iFlow. Its core function is to abstract the complexities of direct CLI access, OAuth authentication, and multi-account management, presenting a consistent API endpoint that is compatible with existing OpenAI, Gemini, and Claude client SDKs and tools.
The methodology of CLIProxyAPI is centered on acting as an intelligent API gateway. It supports OAuth-based authentication flows for services like Gemini, OpenAI, Claude, Qwen, and iFlow, allowing users to leverage their existing subscriptions without directly handling API keys in many client applications. This is complemented by support for Generative Language API Keys where applicable.
A key technical feature is its robust multi-account management system, which implements round-robin load balancing across multiple configured accounts for each supported provider. This allows for distribution of API requests and potentially circumvention of rate limits or service disruptions by seamlessly switching between accounts.
The proxy also incorporates sophisticated model routing and fallback mechanisms. It features provider route aliases (e.g., /api/provider/{provider}/v1...) to direct requests to the appropriate backend service. Furthermore, it includes "smart model fallback" and configurable model mappings, enabling automatic routing of requests for unavailable or specific models to alternative, compatible models (e.g., remapping claude-opus-4.5 to claude-sonnet-4). This enhances reliability and user experience by providing resilience against model deprecation or temporary unavailability.
CLIProxyAPI processes both streaming and non-streaming responses, supports advanced LLM capabilities such as function calling/tools, and handles multimodal inputs (text and images). Its architecture emphasizes security, with management endpoints typically restricted to localhost. The project provides a reusable Go SDK, allowing developers to embed its proxy functionality within other applications.
The project is highly extensible, supporting custom OpenAI-compatible upstream providers via configuration (e.g., OpenRouter). It integrates directly with tools like Amp CLI and Amp IDE extensions, streamlining the use of OAuth-authenticated LLM services within coding environments. A significant ecosystem of projects has been built upon CLIProxyAPI, ranging from native macOS applications for unified AI coding experiences to VSCode extensions and web admin panels, demonstrating its utility as a foundational component for managing and accessing diverse LLM services.
The project is licensed under the MIT License.