中文 | Website | Documentation
Chat2API is a cross-platform desktop app and headless server that turns web-based AI provider accounts into one local, OpenAI-compatible gateway. Configure providers and accounts once, then connect the same endpoint to OpenAI SDKs, coding agents, desktop clients, or internal tools.
- OpenAI-compatible gateway: Chat Completions at
/v1/chat/completions, Responses at/v1/responses, legacy Completions at/v1/completions, model listing, streaming SSE, API-key authentication, and multimodal message handling. Gemini-compatible generation and file routes are also available under/v1beta. - Provider and account management: Add multiple accounts per provider, validate credentials, map client model names, pin a model to a provider or account, and choose round-robin, fill-first, or failover routing.
- Tool and reasoning compatibility: Function/custom tool calls, tool-result continuations, reasoning content, web search, deep research, and provider-specific thinking modes are normalized where the upstream service supports them.
- Long-running request controls: Context compaction, request and stream deadlines, queue admission, keep-alives, bounded retries, and Qwen session/response recovery.
- Desktop and server deployments: Use the Electron UI on macOS, Windows, or Linux, or run the Koa proxy and browser admin UI in Docker without Electron.
- Operations UI: Dashboard metrics, request logs, model synchronization, API keys, proxy settings, themes, system tray access, and English/Simplified Chinese localization.
- Client bridges: Codex CLI Responses compatibility and an optional Anthropic-compatible LiteLLM deployment.
The built-in catalogue currently includes:
| Provider | Authentication | Built-in models |
|---|---|---|
| DeepSeek | User token | deepseek-v4-flash, deepseek-v4-pro |
| GLM | Refresh token | GLM-5.1 |
| Kimi | JWT / web token | Kimi-K2.6, Kimi-K3 |
| MiniMax | JWT | MiniMax-M2.7 |
| Mimo | Browser cookies | MiMo-V2.5-Pro, MiMo-V2.5, MiMo-V2-Flash |
| Perplexity | Session cookie | Auto |
| Qwen (China) | SSO ticket | Qwen3.6, Qwen3.7-Max, Qwen3.5-Flash, Qwen3-Max, Qwen3-Max-Thinking-Preview, Qwen3-Coder |
| Qwen AI (International) | JWT, optional cookies and login credentials | Qwen3.8-Max, Qwen3.8-Max_Fast, Qwen3.8-Max_Auto, Qwen3.8-Max_Thinking, Qwen3.7-Plus, Qwen3.7-Max |
| Z.ai | JWT | GLM-5.1, GLM-5-Turbo, GLM-5V-Turbo, GLM-5, GLM-4.7 |
Provider availability and model names follow the upstream web applications and may change. See the provider notes for credential and model-mapping details.
Download a platform package from GitHub Releases when a release is available:
| Platform | Package |
|---|---|
| macOS Apple Silicon | Chat2API-<version>-mac-arm64.dmg |
| macOS Intel | Chat2API-<version>-mac-x64.dmg |
| Windows | Chat2API-<version>-x64-setup.exe or portable build |
| Linux | Chat2API-<version>-x64.AppImage, .deb, or .tar.gz |
Requirements: Node.js 18+, npm, and Git.
git clone https://github.com/pyf-feifei/Chat2API.git
cd Chat2API
npm install
npm run dev:win # Windows
npm run dev # macOS/LinuxProduction packages can be built with:
npm run build
npm run build:mac
npm run build:win
npm run build:linux
npm run build:allThe server image runs the Koa proxy and browser admin UI, stores state in /data, and listens on port 8080 by default:
docker build -t chat2api:server .
docker run -d --name chat2api \
-p 8080:8080 \
-v chat2api-data:/data \
-e CHAT2API_HOST=0.0.0.0 \
-e CHAT2API_PORT=8080 \
-e CHAT2API_ENABLE_MANAGEMENT_API=true \
-e CHAT2API_MANAGEMENT_SECRET=change-me \
chat2api:serverOpen http://localhost:8080/admin/ and use the management secret to sign in. The complete Docker guide covers Compose, browser-assisted account import, storage encryption, Qwen session repair, and deployment tuning.
- Launch Chat2API, or start the Docker server.
- Open Providers, add a built-in provider, and enter its web credential. Credentials are stored locally; never commit them to source control.
- Open Proxy Settings, choose a port and routing strategy, then start the proxy.
- Point an OpenAI-compatible client at
http://127.0.0.1:8080/v1.
Example with the OpenAI Python SDK:
from openai import OpenAI
client = OpenAI(
api_key="your-chat2api-key",
base_url="http://127.0.0.1:8080/v1",
)
response = client.chat.completions.create(
model="deepseek-v4-flash",
messages=[{"role": "user", "content": "Hello from Chat2API"}],
)
print(response.choices[0].message.content)For Codex CLI, use the Responses endpoint and the configuration in docs/codex.md. For Claude or other Anthropic clients, see the LiteLLM guide.
| Dashboard | Providers |
|---|---|
![]() |
![]() |
| Proxy settings | API keys |
|---|---|
![]() |
![]() |
| Models | Sessions |
|---|---|
![]() |
![]() |
Desktop data is stored in ~/.chat2api/; Docker data is stored in the mounted /data volume.
| Path | Contents |
|---|---|
config.json |
Proxy, UI, and application settings |
providers.json |
Provider definitions and model mappings |
accounts.json |
Account credentials and account state |
logs/ |
Request logs |
The server supports environment variables for host/port, management API, API keys, storage encryption, load balancing, request deadlines, and provider-specific controls. Start with the examples in docs/docker.md.
Issues, provider updates, tests, and documentation improvements are welcome. Please read the existing provider notes and open an issue before large adapter changes.
npm install
npm run build
npm run test:server-compatChat2API is released under the GNU General Public License v3.0.
Electron, React, TypeScript, Tailwind CSS, Zustand, and Koa.






