mrkeyoor.com_
Mon 21 Sept 22:43 UTC
Self-Hostedevaluationupdated 27 Aug 2026

grok2api review

Grok2API is a self-hosted gateway that turns Grok Build, Grok Web, and Grok Console accounts into OpenAI-compatible and Anthropic-compatible endpoints. It pools accounts, routes requests, tracks quotas and billing, and gives operators a React admin console instead of making each client handle Grok credentials directly.

+28stars / 7d
Verdict

Our Grok2API run built in 99 seconds, but 8 of 121 tests failed after an 894-second test run, so the current commit needs investigation before it carries shared production traffic. It is a serious option for an experienced self-hoster who specifically needs Grok account pooling across Codex, Claude Code, media, and ordinary API clients. Use an official xAI API or a provider-neutral gateway if terms compliance, credential custody, or upstream compatibility work makes this design uncomfortable.

We ran it

Lab card: what happened when we ran grok2apiScreenshot of grok2api (github.com/chenyme/grok2api)
Install✓ · 41s237 packages
Build✓ · 99s
Tests✗ · 894s113 passed · 8 failed of 121 (go test)
Repo611 files~189,514 lines of source · 9 MB · 3 CI workflows

Answers from our run

Does grok2api build from source?

Dependencies installed in 41 seconds (237 packages), and the build succeeded in 99 seconds. We cloned commit 6463c6a into a clean Debian container with 3 CPUs and no project-specific setup.

Do grok2api's tests pass?

Not all of them: 113 of 121 passed and 8 failed when we ran the project's own test command (go test). Some failures need services or credentials a bare container does not have.

Who should not use grok2api?

Anyone unwilling to accept account-policy risk: the README labels the project for technical research and tells users to comply with Grok's terms and local law.

What are the alternatives to grok2api?

LiteLLM, One API, Portkey AI Gateway. Our Grok2API run built in 99 seconds, but 8 of 121 tests failed after an 894-second test run, so the current commit needs investigation before it carries shared production traffic.

Setup3/5Build passed, but setup holds account and encryption secrets
Docs5/5Deployment, routing, egress, billing, and proxy trust are specific
Community4/57,540 stars and five current issues and pull requests
Maturity3/5Active releases, but 8 of 121 sandbox tests failed

Who it’s for

Self-hosters who need one controlled endpoint for several Grok accounts and client applications.
Codex or Claude Code operators who need compatible Responses, Chat Completions, or Messages APIs.
Teams prepared to manage account credentials, quotas, proxies, audits, and client billing.
Operators who want SQLite for one instance or PostgreSQL and Redis for a shared deployment.

Who it’s NOT for

Anyone unwilling to accept account-policy risk: the README labels the project for technical research and tells users to comply with Grok's terms and local law.
Teams that need official xAI support or a stable provider contract: routes depend on account capabilities and upstream behavior, and release v3.1.5 contains several compatibility fixes.
Operators who cannot protect long-lived SSO, OAuth, and encryption material: the gateway stores provider credentials, and the README warns never to rotate the encryption key after storage.
Buyers expecting every request to count against a hard spend ceiling: the README says concurrent speech-to-text requests can briefly exceed a billing-limited client's cap, while some media and custom routes are unpriced.
People wanting a small proxy with little upkeep: multi-instance use calls for PostgreSQL, Redis, shared media storage, trusted-proxy configuration, and account-specific egress management.

Setup reality

Our sandbox install succeeded in 41 seconds and pulled 237 Go packages. The build succeeded in 99 seconds. Tests ended with exit code 1 after 894 seconds: 113 passed and 8 failed out of 121, while the log tail showed many HTTP transport packages passing before the final FAIL.

A working gateway needs generated JWT and credential-encryption secrets, an administrator password, and at least one Grok Build OAuth or Grok Web or Console SSO account. Clients then need a gateway credential. PostgreSQL, Redis, proxy services, and FlareSolverr are optional until the deployment or egress design requires them.

The documented quick start uses Docker Compose on amd64 or arm64, while our measured source project lives under backend/. One instance can use SQLite and memory; multiple instances need PostgreSQL, Redis, and shared storage. The encryption key cannot be changed after credentials are stored, and old Python databases are not compatible with this Go version.

It turns three Grok account types into one gateway

Grok2API sits between applications and Grok Build, Grok Web, or Grok Console. It exposes OpenAI-compatible Responses and Chat Completions plus Anthropic-compatible Messages, then selects an account that can serve the requested model. The built-in admin console manages accounts, public model routes, client credentials, quotas, audits, and media. This is useful when Codex, Claude Code, scripts, and user-facing apps would otherwise each carry separate provider logic.

The repository is much larger than a thin protocol adapter. Our commit 6463c6a checkout contained 611 files and about 189,514 lines of source, with the measured Go project under backend/. Routing accounts for quota, concurrency, cooldowns, sticky sessions, and bounded failover. Image, video, speech, stored responses, and prompt-cache behavior add more provider-specific state. That breadth explains both the appeal and the maintenance burden.

Provider boundaries reduce accidental account mixing

Build uses OAuth and discovers models per account. Web and Console use SSO credentials with built-in catalogs. Each provider retains separate health, quota, cooldown, concurrency, and capabilities. The README says retries remain inside one route unless a public model name deliberately combines several routes. That separation is a sensible defense against treating unlike browser and API products as interchangeable.

The gateway still depends on contracts outside its control. Release v3.1.5, published August 25, 2026, includes fixes for empty streams, required response fields, video input, cooldown behavior, quota reconciliation, and provider prefixes. One open report on v3.1.5 describes Web image requests returning upstream_unavailable even though the account appeared usable. Another report discusses Console model-quality filtering. Neither report proves a general defect, but both show the sort of upstream drift an operator inherits.

What happened when we ran it

Our sandbox installed 237 Go packages in 41 seconds. The build completed in 99 seconds. Those two stages worked in a fresh unprivileged Debian container with 3 CPUs, 8 GB of RAM, no secrets, and the golang:1.24-bookworm image. The 9 MB checkout did not need live Grok credentials to reach the build stage.

Tests ran for 894 seconds and exited with code 1. Go reported 113 packages passing and 8 failing out of 121. The supplied log tail shows successful results for admin authentication, audits, client credentials, dashboard, egress, inference, media, middleware, models, settings, and system transport packages, followed only by the overall FAIL. That tail does not identify the eight failing packages or their causes, so we cannot assign the failure to missing services, network access, or code.

Secret custody is the hardest setup requirement

The Compose path starts at port 8000 after copying config.example.yaml and generating a JWT secret plus a credential-encryption key. You then set a bootstrap administrator password, sign in, connect a Build, Web, or Console account, wait for sync, inspect routes, and create a client credential. The README tells operators to change the administrator password and remove the bootstrap account from configuration after first sign-in.

Credential handling deserves more attention than the short quick start suggests. Build refresh tokens can rotate, and sharing one credential between this gateway and another active client can leave one side holding an obsolete token. The encryption key must not change after provider credentials have been stored. Backups need the configuration, database, and media together. A lost key or partial restore can make the stored account pool useless even if the application container starts.

One instance is simpler than a shared deployment

A single instance can use SQLite, process memory, and local media. The documented multi-instance design requires PostgreSQL, Redis, and a shared read-write directory. Reverse proxies need an explicit trusted proxy address or isolated CIDR so audit records contain the real client address without accepting spoofed forwarding headers. The application rejects unrestricted trusted ranges such as 0.0.0.0/0, which is a welcome guard.

Egress adds another operating layer. Grok2API can manage HTTP and SOCKS proxies, several tunnel formats, proxy pools, subscriptions, health probes, and optional FlareSolverr clearance. Hysteria and TUIC are unsupported, and FlareSolverr accepts only HTTP or SOCKS proxy URLs. A deployment using account-specific exits must therefore monitor account health, tunnel health, clearance state, and the upstream service, not just the gateway process.

Billing controls have documented blind spots

Client credentials can restrict models and set request-rate, concurrency, spend, and expiry limits. Audits retain usage for billing reconciliation. The README also states where accounting is incomplete: speech-to-text duration is known only after completion, so concurrent requests may briefly pass a spending cap. Realtime requests, video edits or extensions, and custom routes without recognized official prices are recorded as unpriced and do not consume that limit.

That caveat matters if the gateway is used as a reseller boundary or a hard internal budget control. Audit records can explain activity, but a limit that excludes callable routes is not a universal cost ceiling. The safer use is controlled access among known users, with external provider quotas and alerts behind it. The README's research-only notice and terms warning should also be reviewed before any commercial use.

The active release pace comes with compatibility work

GitHub showed 7,540 stars, 5 combined issues and pull requests, and a last push on August 25, 2026. The latest release landed the same day. Those dates indicate active maintenance, while the small combined queue does not tell us how many defects exist. Recent release notes are dominated by fixes at provider boundaries, which is expected for a gateway translating changing upstream behavior.

Grok2API earns a trial when Grok-specific pooling is the requirement and the operator understands what is being stored. The 8 failed test packages stop us from recommending commit 6463c6a for immediate production use. Reproduce those failures, use disposable accounts first, verify every billed route, and keep the encryption material with the database backup. If those tasks sound excessive, an official API connection is the cleaner choice.

Alternatives

ProjectWhat it isPick it when
LiteLLM gh↗A multi-provider model gateway with OpenAI-compatible routing, budgets, and observability.pick this instead when broad provider coverage matters more than Grok account pooling and Grok-specific media routes.
One APIA self-hosted API management layer for routing requests across several model providers.pick this instead when you want a general model-provider panel rather than Grok Build, Web, and Console handling.
Portkey AI GatewayAn open model gateway focused on routing, fallbacks, guardrails, and provider integrations.pick this instead when requests use official provider APIs and gateway policy matters more than browser-account compatibility.

What people are saying

  1. [github-trending] chenyme/grok2api

Sources

  1. Grok2API README
  2. Grok2API repository facts
  3. Grok2API v3.1.5 release
  4. Web image upstream unavailable report
  5. Console quality guard report

More self-hosted reviews

BackPack · PanWatch · wiki · dashy · animeko · server · the whole board →