Enhanced fork with Warp protocol support, Ollama protocol converter, model prefix system, and parallel fetching. A powerful proxy that unifies various AI model APIs (Gemini CLI, Qwen CLI, Kiro Claude, Warp) into OpenAI-compatible interfaces. Includes Ollama protocol converter to access cloud AI models via Ollama clients.
AnyAI-2-Open-API is an enhanced fork of AIClient2API. This fork adds Warp protocol integration, Ollama protocol converter (OpenAI โ Ollama translation), model prefix routing system, and parallel model fetching. Built on Node.js, it supports intelligent conversion between multiple protocols (OpenAI, Claude, Gemini, Warp, Ollama). The project adopts a modular architecture based on strategy and adapter patterns.
- ๐ฅ Warp Protocol Support: Full Warp API integration with Protocol Buffers support (11 proto definitions)
- Complete Warp module ecosystem (10 specialized handlers: auth, config, core, models, packet-builder, protobuf-utils, reorder, response, strategy, utils)
- WarpApiService adapter with full streaming support
- Protobuf-based packet building for Warp communication
- ๐ฆ Ollama Protocol Converter: Bidirectional translation (OpenAI โ Ollama)
- Native Ollama protocol converter with complete API support
- Ollama-specific endpoints: /api/tags, /api/show, /api/chat, /api/generate, /api/version
โ ๏ธ Important: To use Ollama endpoints, either run this server on Ollama's default port (11434) or manually configure the Ollama port in your clientโ ๏ธ Note: Close the official Ollama client before using this proxy, otherwise requests will be intercepted by the official client and models won't be visible
- ๐ท๏ธ Model Prefix System: Intelligent model-based provider routing (auto-detects Warp models like 'gpt-5')
- Model-to-provider mapper for automatic routing
- โก Parallel Model Fetching: Concurrent model information retrieval for improved performance
- ๐ฏ Enhanced Converter Architecture:
- Extended GeminiConverter with tool call support
- Enhanced OpenAIConverter with function call handling
- OllamaConverter strategy for protocol translation
Note
๐ Fork Enhancements
This is an enhanced fork of the original AIClient-2-API project with additional enterprise features.
๐ Fork Update Log
- 2025.11.14 - Added model prefix system and parallel model fetching
- 2025.11.14 - Added enterprise-grade Warp and Ollama protocol support with advanced routing
- Multi-Model Unified Interface: Through standard OpenAI-compatible protocol, configure once to access mainstream large models including Gemini, Claude, GPT, Qwen Code, Warp, Kimi K2, GLM-4.6
- Flexible Switching Mechanism: Support dynamic model switching via startup parameters, Path routing, model prefixes, or environment variables to meet different scenario requirements
- Zero-Cost Migration: Fully compatible with OpenAI API specifications
- Multi-Protocol Intelligent Conversion: Support intelligent conversion between OpenAI, Claude, Gemini, Warp, and Ollama protocols for cross-protocol model invocation
- Call Claude models using OpenAI protocol: Use
claude-customorclaude-kiro-oauthproviders - Call Gemini models using OpenAI protocol: Use
gemini-cli-oauthprovider - Call Gemini models using Claude protocol: Use
gemini-cli-oauthprovider - Call OpenAI models using Claude protocol: Use
openai-customoropenai-qwen-oauthproviders - Call Warp models using OpenAI protocol: Use
warpprovider with model prefix routing - Access cloud AI models via Ollama protocol: Ollama protocol converter translates Ollama API requests to OpenAI format, then routes to configured cloud providers (Gemini, Claude, GPT, etc.)
- Call Claude models using OpenAI protocol: Use
- Bypass Official Restrictions: Utilize OAuth authorization mechanism to effectively break through rate and quota limits of free APIs like Gemini
- Free Advanced Models: Use Claude Sonnet 4.5 for free via Kiro API mode, use Qwen3 Coder Plus via Qwen OAuth mode, reducing usage costs
- Intelligent Account Pool Scheduling: Support multi-account polling, automatic failover, and configuration degradation, ensuring 99.9% service availability
- Full-Chain Log Recording: Capture all request and response data, supporting auditing and debugging
- Private Dataset Construction: Quickly build proprietary training datasets based on log data
- System Prompt Management: Support override and append modes, achieving perfect combination of unified base instructions and personalized extensions
- Modular Architecture: Based on strategy and adapter patterns, adding new model providers requires only 3 steps
- Enhanced Converter System: Refactored protocol converters with improved maintainability and extensibility
- Model Prefix Routing: Intelligent model selection based on prefix patterns for flexible deployment
- Parallel Processing: Concurrent model fetching and request handling for optimal performance
- Complete Test Coverage: Integration and unit test coverage 90%+, ensuring code quality
- Containerized Deployment: Provides Docker support, one-click deployment, cross-platform operation
- MCP Protocol Support: Perfectly compatible with Model Context Protocol, easily extend functionality
- Warp & Ollama Integration: Enterprise-grade protocol support for advanced AI workflows
- ๐ณ Docker Deployment
- ๐จ Model Protocol and Provider Relationship Diagram
- ๐ง Usage Instructions
- ๐ Project Startup Parameters
- ๐ Open Source License
- ๐ Acknowledgements
โ ๏ธ Disclaimer
This project supports multiple model providers through different protocols. The following is an overview of their relationships:
- OpenAI Protocol (P_OPENAI): Implemented by
openai-custom,gemini-cli-oauth,claude-custom,claude-kiro-oauth,openai-qwen-oauth,openaiResponses-custom, andwarpmodel providers. - Claude Protocol (P_CLAUDE): Implemented by
claude-custom,claude-kiro-oauth,gemini-cli-oauth,openai-custom,openai-qwen-oauth, andopenaiResponses-custommodel providers. - Gemini Protocol (P_GEMINI): Implemented by
gemini-cli-oauthmodel provider. - Warp Protocol (P_WARP): Implemented by
warpmodel provider with enterprise-grade features. - Ollama Protocol (P_OLLAMA): Protocol converter that translates Ollama API requests to OpenAI format, enabling Ollama clients to access cloud AI models through this proxy.
Detailed relationship diagram:
graph TD
subgraph Core_Protocols["Core Protocols"]
P_OPENAI[OpenAI Protocol]
P_GEMINI[Gemini Protocol]
P_CLAUDE[Claude Protocol]
end
subgraph Supported_Model_Providers["Supported Model Providers"]
MP_OPENAI[openai-custom]
MP_GEMINI[gemini-cli-oauth]
MP_CLAUDE_C[claude-custom]
MP_CLAUDE_K[claude-kiro-oauth]
MP_QWEN[openai-qwen-oauth]
MP_OPENAI_RESP[openaiResponses-custom]
end
P_OPENAI ---|Support| MP_OPENAI
P_OPENAI ---|Support| MP_QWEN
P_OPENAI ---|Support| MP_GEMINI
P_OPENAI ---|Support| MP_CLAUDE_C
P_OPENAI ---|Support| MP_CLAUDE_K
P_OPENAI ---|Support| MP_OPENAI_RESP
P_GEMINI ---|Support| MP_GEMINI
P_CLAUDE ---|Support| MP_CLAUDE_C
P_CLAUDE ---|Support| MP_CLAUDE_K
P_CLAUDE ---|Support| MP_GEMINI
P_CLAUDE ---|Support| MP_OPENAI
P_CLAUDE ---|Support| MP_QWEN
P_CLAUDE ---|Support| MP_OPENAI_RESP
style P_OPENAI fill:#f9f,stroke:#333,stroke-width:2px
style P_GEMINI fill:#ccf,stroke:#333,stroke-width:2px
style P_CLAUDE fill:#cfc,stroke:#333,stroke-width:2px
The easiest way to get started with AIClient-2-API is to use our automated installation and startup scripts. We provide both Linux/macOS and Windows versions:
# Make the script executable and run it
chmod +x install-and-run.sh
./install-and-run.sh# Run the batch file
install-and-run.batThe install-and-run script automatically:
- Checks Node.js Installation: Verifies Node.js is installed and provides download link if missing
- Dependency Management: Automatically installs npm dependencies if
node_modulesdoesn't exist - File Validation: Ensures all required project files are present
- Server Startup: Launches the API server on
http://localhost:3000 - Web UI Access: Provides direct access to the management console
========================================
AI Client 2 API Quick Install Script
========================================
[Check] Checking if Node.js is installed...
โ
Node.js is installed, version: v20.10.0
โ
Found package.json file
โ
node_modules directory already exists
โ
Project file check completed
========================================
Starting AI Client 2 API Server...
========================================
๐ Server will start on http://localhost:3000
๐ Visit http://localhost:3000 to view management interface
โน๏ธ Press Ctrl+C to stop server
๐ก Tip: The script will automatically install dependencies and start the server. If you encounter any issues, the script provides clear error messages and suggested solutions.
A comprehensive web-based management interface offering:
๐ Dashboard: System overview, interactive routing examples, and client configuration guides
โ๏ธ Configuration: Real-time parameter modification for all providers (Gemini, OpenAI, Claude, Kiro, Qwen) with advanced settings and file upload support
๐ Provider Pools: Monitor active connections, provider health statistics, and enable/disable providers
๐ Config Files: Centralized OAuth credential management with search, filtering, and file operations
๐ Logs: Real-time system and request logs with management controls
๐ Login: Authentication required (default: admin123, modify via pwd file)
Access: http://localhost:3000 โ Login โ Sidebar navigation โ Immediate effect changes
This project is fully compatible with Model Context Protocol (MCP), enabling seamless integration with MCP-supporting clients for powerful functional extensions.
Supports various input types including images and documents, providing richer interactive experiences and more powerful application scenarios.
Seamlessly supports the following latest large models, simply configure the corresponding OpenAI or Claude compatible interface in config.json:
- Kimi K2 - Moonshot AI's latest flagship model
- GLM-4.5 - Zhipu AI's latest version
- Qwen Code - Alibaba Tongyi Qianwen code-specific model
- Gemini 3 - Google's latest preview model
- Claude Sonnet 4.5 - Anthropic's latest flagship model
- Obtain OAuth Credentials: Visit Google Cloud Console to create a project and enable Gemini API
- First Authorization: After using Gemini service, the command line will print Google authorization page, copy the page to browser for authorization, then return to command line
- Credential Storage: After successful authorization,
oauth_creds.jsonfile will be automatically generated and saved to~/.geminidirectory - Project Configuration: Need to provide a valid Google Cloud project ID, can be specified via startup parameter
--project-id
- First Authorization: After starting the service, the system will automatically open the authorization page in the browser
- Credential Storage: After successful authorization,
oauth_creds.jsonfile will be automatically generated and saved to~/.qwendirectory - Recommended Parameters: Use official default parameters for best results
{ "temperature": 0, "top_p": 1 }
- Environment Preparation: Download and install Kiro client
- Complete Authorization: Log in to your account in the client to generate
kiro-auth-token.jsoncredential file - Best Practice: Recommended to use with Claude Code for optimal experience
- Important Notice: Kiro service usage policy has been updated, please visit the official website for the latest usage restrictions and terms
- Access Warp Website: Visit Warp AI website and sign in to your account
- Open Browser Console: After successful login, press
F12orCtrl+Shift+I(Windows/Linux) /Cmd+Option+I(Mac) to open Developer Tools - Extract Refresh Token: In the Console tab, paste and execute the following code:
(async () => { const request = indexedDB.open("firebaseLocalStorageDb"); request.onsuccess = function (event) { const db = event.target.result; const tx = db.transaction("firebaseLocalStorage", "readonly"); const store = tx.objectStore("firebaseLocalStorage"); const getAllReq = store.getAll(); getAllReq.onsuccess = function () { const results = getAllReq.result; const firstValue = results[0]?.value; console.log("Your account data:"); console.log(JSON.stringify(firstValue, null, 2)); const valueString = JSON.stringify(firstValue, null, 2); navigator.clipboard.writeText(valueString).then(() => { alert("Account data copied to clipboard!"); }); }; }; })();
- Extract Refresh Token: From the copied JSON data, find the
stsTokenManager.refreshTokenfield - Configure in config.json:
- Set
MODEL_PROVIDERtowarp - Copy the refresh token value to
WARP_REFRESH_TOKENfield inconfig.json - Example:
{ "MODEL_PROVIDER": "warp", "WARP_REFRESH_TOKEN": "AMf-vBxSRmdhveGGBYM69p05kDhIn1i7wscALEmC9fYdRpHzjER9dL7kk...", "WARP_REFRESH_URL": "https://app.warp.dev/proxy/token?key=AIzaSyBdy3O3S9hrdayLJxJ7mriBR4qgUaUygAs" }
- Set
- Important Notes:
- The system automatically refreshes JWT tokens using the refresh token
- Keep your refresh token secure and never share it publicly
- If refresh token expires, repeat steps 1-5 to get a new one
- Application Scenario: Suitable for scenarios requiring structured dialogue using OpenAI Responses API, such as Codex
- Configuration Method:
- Method 1: Set
MODEL_PROVIDERtoopenaiResponses-custominconfig.json - Method 2: Use startup parameter
--model-provider openaiResponses-custom - Method 3: Use path routing
/openaiResponses-custom
- Method 1: Set
- Required Parameters: Provide valid API key and base URL
This project provides two flexible model switching methods to meet different usage scenario requirements.
Achieve instant switching by specifying provider identifier in API request path:
| Route Path | Description | Use Case |
|---|---|---|
/claude-custom |
Use Claude API from config file | Official Claude API calls |
/claude-kiro-oauth |
Access Claude via Kiro OAuth | Free use of Claude Sonnet 4.5 |
/openai-custom |
Use OpenAI provider to handle requests | Standard OpenAI API calls |
/gemini-cli-oauth |
Access via Gemini CLI OAuth | Break through Gemini free limits |
/openai-qwen-oauth |
Access via Qwen OAuth | Use Qwen Code Plus |
/openaiResponses-custom |
OpenAI Responses API | Structured dialogue scenarios |
Usage Examples:
# Configure in programming agents like Cline, Kilo
API_ENDPOINT=http://localhost:3000/claude-kiro-oauth
# Direct API call
curl http://localhost:3000/gemini-cli-oauth/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model":"gemini-2.0-flash-exp","messages":[...]}'Default storage locations for authorization credential files of each service:
| Service | Default Path | Description |
|---|---|---|
| Gemini | ~/.gemini/oauth_creds.json |
OAuth authentication credentials |
| Kiro | ~/.aws/sso/cache/kiro-auth-token.json |
Kiro authentication token |
| Qwen | ~/.qwen/oauth_creds.json |
Qwen OAuth credentials |
Note:
~represents the user home directory (Windows:C:\Users\username, Linux/macOS:/home/usernameor/Users/username)Custom Path: Can specify custom storage location via relevant parameters in configuration file or environment variables
This project supports rich command-line parameter configuration, allowing flexible adjustment of service behavior as needed. The following is a detailed explanation of all startup parameters, displayed in functional groups:
| Parameter | Type | Default Value | Description |
|---|---|---|---|
--host |
string | localhost | Server listening address |
--port |
number | 3000 | Server listening port |
--api-key |
string | 123456 | API key for authentication |
| Parameter | Type | Default Value | Description |
|---|---|---|---|
--model-provider |
string | gemini-cli-oauth | AI model provider, optional values: openai-custom, claude-custom, gemini-cli-oauth, claude-kiro-oauth, openai-qwen-oauth, openaiResponses-custom |
| Parameter | Type | Default Value | Description |
|---|---|---|---|
--openai-api-key |
string | null | OpenAI API key (required when model-provider is openai-custom) |
--openai-base-url |
string | null | OpenAI API base URL (required when model-provider is openai-custom) |
| Parameter | Type | Default Value | Description |
|---|---|---|---|
--claude-api-key |
string | null | Claude API key (required when model-provider is claude-custom) |
--claude-base-url |
string | null | Claude API base URL (required when model-provider is claude-custom) |
| Parameter | Type | Default Value | Description |
|---|---|---|---|
--gemini-oauth-creds-base64 |
string | null | Base64 string of Gemini OAuth credentials (optional when model-provider is gemini-cli-oauth, choose one with --gemini-oauth-creds-file) |
--gemini-oauth-creds-file |
string | null | Gemini OAuth credentials JSON file path (optional when model-provider is gemini-cli-oauth, choose one with --gemini-oauth-creds-base64) |
--project-id |
string | null | Google Cloud project ID (required when model-provider is gemini-cli-oauth) |
| Parameter | Type | Default Value | Description |
|---|---|---|---|
--kiro-oauth-creds-base64 |
string | null | Base64 string of Kiro OAuth credentials (optional when model-provider is claude-kiro-oauth, choose one with --kiro-oauth-creds-file) |
--kiro-oauth-creds-file |
string | null | Kiro OAuth credentials JSON file path (optional when model-provider is claude-kiro-oauth, choose one with --kiro-oauth-creds-base64) |
| Parameter | Type | Default Value | Description |
|---|---|---|---|
--qwen-oauth-creds-file |
string | null | Qwen OAuth credentials JSON file path (required when model-provider is openai-qwen-oauth) |
| Parameter | Type | Default Value | Description |
|---|---|---|---|
--model-provider |
string | openaiResponses-custom | Model provider, set to openaiResponses-custom when using OpenAI Responses API |
--openai-api-key |
string | null | OpenAI API key (required when model-provider is openaiResponses-custom) |
--openai-base-url |
string | null | OpenAI API base URL (required when model-provider is openaiResponses-custom) |
| Parameter | Type | Default Value | Description |
|---|---|---|---|
--system-prompt-file |
string | input_system_prompt.txt | System prompt file path |
--system-prompt-mode |
string | overwrite | System prompt mode, optional values: overwrite (override), append (append) |
| Parameter | Type | Default Value | Description |
|---|---|---|---|
--log-prompts |
string | none | Prompt log mode, optional values: console (console), file (file), none (none) |
--prompt-log-base-name |
string | prompt_log | Prompt log file base name |
| Parameter | Type | Default Value | Description |
|---|---|---|---|
--request-max-retries |
number | 3 | Maximum number of automatic retries when API requests fail |
--request-base-delay |
number | 1000 | Base delay time (milliseconds) between automatic retries, delay increases after each retry |
| Parameter | Type | Default Value | Description |
|---|---|---|---|
--cron-near-minutes |
number | 15 | Interval time (minutes) for OAuth token refresh task schedule |
--cron-refresh-token |
boolean | true | Whether to enable automatic OAuth token refresh task |
| Parameter | Type | Default Value | Description |
|---|---|---|---|
--provider-pools-file |
string | null | Provider account pool configuration file path |
# Basic usage
node src/api-server.js
# Specify port and API key
node src/api-server.js --port 8080 --api-key my-secret-key
# Use OpenAI provider
node src/api-server.js --model-provider openai-custom --openai-api-key sk-xxx --openai-base-url https://api.openai.com/v1
# Use Claude provider
node src/api-server.js --model-provider claude-custom --claude-api-key sk-ant-xxx --claude-base-url https://api.anthropic.com
# Use OpenAI Responses API provider
node src/api-server.js --model-provider openaiResponses-custom --openai-api-key sk-xxx --openai-base-url https://api.openai.com/v1
# Use Gemini provider (Base64 credentials)
node src/api-server.js --model-provider gemini-cli-oauth --gemini-oauth-creds-base64 eyJ0eXBlIjoi... --project-id your-project-id
# Use Gemini provider (credentials file)
node src/api-server.js --model-provider gemini-cli-oauth --gemini-oauth-creds-file /path/to/credentials.json --project-id your-project-id
# Configure system prompt
node src/api-server.js --system-prompt-file custom-prompt.txt --system-prompt-mode append
# Configure logging
node src/api-server.js --log-prompts console
node src/api-server.js --log-prompts file --prompt-log-base-name my-logs
# Complete example
node src/api-server.js \
--host 0.0.0.0 \
--port 3000 \
--api-key my-secret-key \
--model-provider gemini-cli-oauth \
--project-id my-gcp-project \
--gemini-oauth-creds-file ./credentials.json \
--system-prompt-file ./custom-system-prompt.txt \
--system-prompt-mode overwrite \
--log-prompts file \
--prompt-log-base-name api-logsThis project operates under the GNU General Public License v3 (GPLv3). For complete details, please refer to the LICENSE file located in the root directory.
The development of this project was significantly inspired by the official Google Gemini CLI and incorporated some code implementations from Cline 3.18.0's gemini-cli.ts. We extend our sincere gratitude to the official Google team and the Cline development team for their exceptional work!
This project (AIClient-2-API) is for learning and research purposes only. Users assume all risks when using this project. The author is not responsible for any direct, indirect, or consequential losses resulting from the use of this project.
This project is an API proxy tool and does not provide any AI model services. All AI model services are provided by their respective third-party providers (such as Google, OpenAI, Anthropic, etc.). Users should comply with the terms of service and policies of each third-party service when accessing them through this project. The author is not responsible for the availability, quality, security, or legality of third-party services.
This project runs locally and does not collect or upload any user data. However, users should protect their API keys and other sensitive information when using this project. It is recommended that users regularly check and update their API keys and avoid using this project in insecure network environments.
Users should comply with the laws and regulations of their country/region when using this project. It is strictly prohibited to use this project for any illegal purposes. Any consequences resulting from users' violation of laws and regulations shall be borne by the users themselves.

