A reverse-engineered Grok gateway that speaks OpenAI
Turns Grok's web interface into a standard API so your existing tools just work.

What it does
Grok2API is a FastAPI-based gateway that reverse-engineers Grok’s web capabilities and exposes them through OpenAI-compatible endpoints — chat completions, image generation, video creation, and even Anthropic-style messages. It also bundles a web admin panel, chat interface, and image gallery so you aren’t stuck in curl land.
The interesting bit
The project treats Grok’s web tier as an opaque backend and builds a full translation layer on top: account pooling with tier-aware routing, local media caching, token usage estimation, and configurable proxy chains for egress and Cloudflare clearance. That’s a lot of operational sophistication for what is essentially a protocol adapter.
Key highlights
- OpenAI and Anthropic API compatibility, including streaming, reasoning output, and function tool passthrough
- Multi-account pool with automatic failover, tier selection (
basic/super/heavy), and usage synchronization - Supports text-to-image, image editing, text-to-video, and image-to-video through unified or dedicated endpoints
- Local media caching with configurable URL proxying to avoid 403s on Grok-hosted assets
- Built-in WebUI with admin controls, chat, masonry image grid, and voice chat via ChatKit
- Deployable via Docker Compose, Vercel, or Render
Caveats
- Explicitly labeled “for learning and research exchange only”; using it violates Grok’s terms of service
- Requires ongoing reverse-engineering maintenance as Grok’s web interface changes
app.app_urlmust be configured or media links break with 403 errors
Verdict
Worth a look if you need Grok’s capabilities in a pipeline that expects standard LLM APIs and you’re comfortable with the maintenance burden and legal gray area. Skip it if you want a supported, stable provider contract — this is a cat-and-mouse game by design.
Frequently asked
- What is chenyme/grok2api?
- Turns Grok's web interface into a standard API so your existing tools just work.
- Is grok2api open source?
- Yes — chenyme/grok2api is open source, released under the MIT license.
- What language is grok2api written in?
- chenyme/grok2api is primarily written in Go.
- How popular is grok2api?
- chenyme/grok2api has 6.6k stars on GitHub and is currently cooling off.
- Where can I find grok2api?
- chenyme/grok2api is on GitHub at https://github.com/chenyme/grok2api.