consolex2api
将 console.x.ai 封装为 OpenAI 兼容接口的轻量网关,支持多账号 SSO 池、管理后台、SQLite 和 Docker 部署。
A Python gateway that wraps xAI's console.x.ai so any tool built for the OpenAI API can talk to Grok models instead, with a multi-account pool and a browser-based admin dashboard to manage accounts.
ConsoleX2API is a Python gateway that wraps xAI's console.x.ai platform so it behaves like an OpenAI-compatible API. Many AI tools, scripts, and applications are built to talk to OpenAI's API format. This project lets those same tools connect to Grok models through the console.x.ai backend without changing the tool itself.
The gateway accepts standard API requests in the OpenAI format for chat completions, responses, and real-time voice, then translates and forwards them to console.x.ai upstream. It preserves parameters like tool use and reasoning effort that the upstream supports. Image inputs in the OpenAI format are automatically converted to the format the upstream expects. Real-time voice is supported through a WebSocket connection that passes audio data in both directions.
A key feature is the multi-account pool. console.x.ai uses SSO login sessions, and each account belongs to a team. This gateway stores multiple accounts in a local SQLite database, each with its own team ID, so traffic can be spread across them. You import accounts through a browser-based admin dashboard or a text file, one account per line with its SSO token and team ID. The dashboard also lets you enable or disable individual accounts, filter by account status, and configure settings like proxy address, model list, and default generation parameters.
Deployment options include running it directly with Python or using Docker Compose, which handles the SQLite database as a persistent volume. Configuration is done through an environment file where you set your gateway API key, admin key, and upstream proxy if needed.
The project is written in Chinese and the README is in Chinese, though an English README is also linked from the project. It does not support image or video generation endpoints, only the chat and voice interfaces.
Where it fits
- Point an existing OpenAI API script or tool at Grok models without modifying any code.
- Distribute traffic across multiple xAI accounts to stay within per-account rate limits.
- Use real-time voice with Grok models through a WebSocket connection that passes audio in both directions.
- Self-host an OpenAI-compatible API endpoint backed by Grok with a browser dashboard for account management.