Grok2API is a FastAPI-based gateway that converts Grok Web capabilities into OpenAI-compatible API endpoints. The project enables developers to access Grok's chat, image generation, image editing, and video generation features through standardized API interfaces that follow OpenAI conventions, alongside partial Anthropic Messages API compatibility.
The repository implements comprehensive API endpoints covering chat completions, model listing, image generation and editing, video creation and retrieval, and response handling. It supports both streaming and non-streaming responses, explicit thinking output, function tool structures, and unified token and usage statistics. The system includes local caching for images and videos with proxy link returns, multi-account pooling with hierarchical account selection, failure feedback mechanisms, quota synchronization, and automatic account maintenance.
The project provides multiple user interfaces accessible through different paths. An Admin backend at /admin/login handles account management, configuration management, and cache management. A WebUI chat interface at /webui/chat offers conversational capabilities, while /webui/masonry provides image generation functionality and /webui/chatkit offers voice-enabled chat. Authentication rules vary by scope, with /v1/* endpoints requiring an API key when configured, /admin/* endpoints using an app key defaulting to "grok2api", and /webui/* endpoints optionally requiring a webui key.
Configuration operates across three layers: environment variables applied at startup, runtime configuration in config.toml that takes effect immediately upon saving, and default templates used during initialization. The system supports extensive environment variable configuration including timezone, logging levels, account synchronization intervals, server host and port settings, data directory paths, and multiple account storage backends including local SQLite, Redis, MySQL, and PostgreSQL with configurable connection pooling.
The supported model catalog includes multiple Grok chat variants spanning different tiers and modes, from basic fast models to super and heavy tier reasoning models. Image generation models range from lite to pro versions, with dedicated image editing capabilities. Video generation uses the grok-imagine-video model. All models are retrievable through the GET /v1/models endpoint.
According to GitGenius activity tracking, the repository has processed 389 issues and pull requests with a median response latency of zero hours and mean latency of 23.9 hours. The most active labels are question with 148 items, bug with 133 items, and enhancement with 78 items. Primary contributor chenyme generated 774 tracked events, with leadscloud and dq52099 contributing 15 and 14 events respectively. The repository shares overlapping contributors with github/gh-aw, solo-io/gloo, and longhorn/longhorn.
The project has entered maintenance mode with an official discontinuation notice. The README explicitly states that due to limited personal capacity and official risk control concerns, Grok2API has ceased active development. While the x-statsig-id can still be obtained through alternative methods, the repository code is archived for learning and research purposes only, with no further feature development, bug fixes, or technical support planned. The maintainer recommends their new project DEEIX-Chat as an alternative, described as a lightweight enterprise-grade AI platform with unified model routing, conversation, file handling, tools, billing, identity, and operations capabilities.