chenyme/grok2api

Multi-account API gateway for Grok Build, Grok Web, and Grok Console

What it solves

Grok2API acts as a unified gateway that allows users to manage multiple Grok accounts (Build, Web, and Console) and expose them through standard, OpenAI- and Anthropic-compatible APIs. It solves the problem of fragmented access by providing a centralized interface to route requests, manage account quotas, and handle credentials across different Grok service tiers.

How it works

The project runs as a Go-based backend service with a React-based admin console. It functions by maintaining a "Provider Registry" that tracks the health, state, and capabilities of connected Grok accounts. When a client sends a request, the gateway routes it to an appropriate, authenticated account, handles retries, and manages egress through configurable proxy settings. It synchronizes account metadata—such as remaining quota and available models—to ensure requests are routed efficiently.

Who it’s for

This tool is designed for developers and power users who need to integrate Grok’s various AI capabilities into their own applications, automated workflows, or existing AI development tools (like Claude Code or Codex) that expect standard API formats.

Highlights

  • Unified API: Exposes OpenAI- and Anthropic-compatible endpoints for chat, image generation, and video tasks.
  • Multi-Account Management: Supports bulk importing/exporting of accounts and manages independent state for Grok Build, Web, and Console.
  • Advanced Routing: Features model discovery, sticky sessions, and quota-aware load balancing across multiple accounts.
  • Infrastructure Ready: Includes built-in support for proxy pools (HTTP/SOCKS/Shadowsocks) and comprehensive audit logging for usage and billing.

Related

  • Project
  • Project
  • Project
  • Project