gitwtfhub

wtf is grokcli-2api?

hm2899/grokcli-2api — explained in plain English

Analysis updated 2026-05-18

463GoAudience · developerComplexity · 4/5Setup · hard

TL;DR

A Go proxy that turns a Grok login session into an OpenAI and Anthropic compatible API, with multi-account pooling and a web admin panel.

Mindmap

mindmap
  root((repo))
    What it does
      Grok login to API
      OpenAI compatible
      Anthropic compatible
    Tech stack
      Go
      Docker
      PostgreSQL
      Redis
    Use cases
      Proxy for coding agents
      Multi account rotation
      Usage dashboards
    Audience
      Self hosters
      Developers

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Run a self-hosted proxy that lets OpenAI or Anthropic-style tools talk to Grok instead.

REASON 2

Pool multiple Grok accounts and automatically rotate between them as quota runs out.

REASON 3

Give Claude Code or similar coding agents access to Grok through a familiar API shape.

REASON 4

Track usage, response speed, and account health from a web admin panel.

What's in the stack?

GoDockerPostgreSQLRedis

How it stacks up

hm2899/grokcli-2apimitchellh/panicwrapnetflix/go-expect
Stars463453473
LanguageGoGoGo
Last pushed2024-04-052024-06-15
MaintenanceDormantDormant
Setup difficultyhardeasymoderate
Complexity4/52/53/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · hard Time to first run · 1h+

Needs Docker Compose with Postgres and Redis running together, plus a Grok account login.

Wtf does this do

grokcli-2api is a Go program that takes the login session from Grok, the AI chatbot service, and turns it into an API that behaves like the OpenAI API and the Anthropic API. That means tools built to talk to OpenAI or Anthropic, like Claude Code or other coding agents, can talk to Grok instead without changing how they call the API. It ships as a Docker container and comes with a web admin panel for managing everything. The system is built to run on its own, without needing a local Grok command line tool or a browser to log in. It stores its data using PostgreSQL for permanent records and Redis for fast, short lived state, and it can run several worker processes at once. It supports pooling many Grok accounts together and rotating between them using strategies like round robin, least used, or random, and it immediately cools down and removes any account that runs out of quota. It also tries to keep the same conversation sticking to the same account so that prompt caching stays effective, and that stickiness time can be changed while the program is running. The project includes its own registration flow for creating new Grok accounts through email services and automated verification, and it can optionally push newly registered accounts on to other similar proxy tools. It exposes OpenAI style endpoints such as chat completions and responses, and Anthropic style endpoints such as messages, including support for tools and token counting. The admin panel lets an operator manage accounts, API keys, registration, health checks, renewals, task logs, and usage statistics, including how long it takes before the first reply token appears. To get started, a user clones the repository, copies the example environment file, sets an admin password, and runs docker compose. Only the main application port is exposed to the host machine, while the database and cache stay reachable only inside the Docker network. A prebuilt image is also available from GitHub's container registry, though the image name must be typed in all lowercase letters even if the account name uses capital letters. The full README is longer than what was shown.

Yoink these prompts

Prompt 1
Deploy grokcli-2api with Docker Compose and point Claude Code at it as an OpenAI-compatible endpoint.
Prompt 2
Set up multi-account rotation with round robin and cool down accounts automatically when they run out of quota.
Prompt 3
Explain how to pull the prebuilt grokcli-2api image from GitHub's container registry using the correct lowercase name.
Prompt 4
Configure the admin panel password and expose only the app port from docker-compose.yml.

Frequently asked questions

wtf is grokcli-2api?

A Go proxy that turns a Grok login session into an OpenAI and Anthropic compatible API, with multi-account pooling and a web admin panel.

What language is grokcli-2api written in?

Mainly Go. The stack also includes Go, Docker, PostgreSQL.

How hard is grokcli-2api to set up?

Setup difficulty is rated hard, with roughly 1h+ to a first successful run.

Who is grokcli-2api for?

Mainly developer.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.