Grok2API
Multi-account API gateway that exposes Grok Build, Grok Web, and Grok Console through OpenAI- and Anthropic-compatible APIs.
At a Glance
Self-hosted Grok2API gateway released under the MIT License. Upstream Grok account/subscription costs are external.
Engagement
Available On
Listed Dec 2026
About Grok2API
Grok2API is an open-source Go gateway with a built-in React admin console, published by chenyme under the MIT license. It manages separate account pools for Grok Build, Grok Web, and Grok Console and exposes them through unified OpenAI- and Anthropic-compatible endpoints. The latest release listed is v3.1.8.
What It Is
Grok2API is a self-hosted API gateway and account manager. Administrators connect Grok accounts, let the gateway sync quota and model capabilities, create client keys, and then call /v1/* endpoints such as Responses, Chat Completions, Anthropic Messages, Images, Videos, TTS, and STT. Supported clients include Codex, Claude Code, and OpenAI- or Anthropic-compatible SDKs. The README states the project is for technical research and learning, and asks users to comply with Grok's terms of use and local laws.
Providers and Routing
Each provider keeps its own credentials, quota, health, cooldown, concurrency, and model capabilities. Grok Build uses OAuth or Device OAuth with models discovered per account. Grok Web and Grok Console use SSO with built-in catalogs, and Web models are filtered by account tier. The Model Routes page lists provider-qualified routes. Routing features include provider pinning, sticky sessions, quota and concurrency guards, and bounded failover.
Egress and Network Handling
The egress layer supports HTTP, SOCKS, Resin, and Trojan/VLESS/Shadowsocks/VMess tunnels, with subscriptions, probes, proxy pools, and per-scope fallback. An optional Egress Quality Guard sidecar probes nodes and can quarantine them. FlareSolverr integration can refresh Cloudflare clearance for Web and Console.
Deployment and Operations
Official Docker images support linux/amd64 and linux/arm64. A single instance uses SQLite with in-memory runtime state. Multiple instances use PostgreSQL, Redis, and shared media storage. The admin console provides a dashboard, client keys with model allowlists and RPM, concurrency, spend, and expiry limits, audits, runtime settings, and media libraries.
Community Discussions
Be the first to start a conversation about Grok2API
Share your experience with Grok2API, ask questions, or help others learn from your insights.
Pricing
Open Source (Self-hosted)
Self-hosted Grok2API gateway released under the MIT License. Upstream Grok account/subscription costs are external.
- MIT License
- Multi-account API gateway for Grok Build, Grok Web, and Grok Console
- OpenAI- and Anthropic-compatible APIs
- Built-in React admin console
- Docker images (amd64, arm64)
Capabilities
Key Features
- Multi-account pools for Grok Build, Web, and Console
- OpenAI-compatible Responses and Chat Completions
- Anthropic Messages API
- Image generation and editing
- Asynchronous video jobs
- TTS, STT, and Realtime proxy
- Bulk account import/export and quota sync
- Provider pinning, sticky sessions, and failover
- Client keys with RPM, concurrency, spend, and expiry limits
- Egress proxy pools with HTTP/SOCKS and tunnel protocols
- FlareSolverr Cloudflare clearance
- React admin console with audits
- SQLite or PostgreSQL with Memory or Redis storage
