GrokForge wraps all Grok web capabilities (chat, reasoning, image generation/editing, video generation) into a standard OpenAI API format (a.k.a. 2api gateway). You can seamlessly connect any OpenAI-compatible client (ChatGPT Next Web, LobeChat, Open WebUI, Cursor, bots, etc.) to Grok models.
Go rewrite + Next.js admin panel, compiled into a single binary, SQLite out of the box, zero external dependencies.
Highlights
Single binary deployment — Frontend embedded via go:embed, just copy and run
Playground — Chat / Image / Video generation online, multi-turn conversation with Markdown rendering
Supported Models
Chat Models
Model
Mode
Pool Floor
Description
grok-4.20
default
basic
Default Grok 4.20 mode
grok-4.20-fast
fast
basic
Faster Grok 4.20 variant
grok-4.20-think
think (force_thinking)
basic
Deep reasoning mode
grok-4.20-expert
expert
basic
Expert mode
grok-4.20-heavy
heavy
heavy
Heavy pool only
Media Models
Model
Type
Pool Floor
Description
grok-imagine-image
image_ws (WebSocket)
super
Full image generation
grok-imagine-image-pro
image_ws + enable_pro
super
Pro image generation
grok-imagine-image-lite
image (HTTP)
basic
Lightweight image generation, Basic pool
grok-imagine-image-edit
image_edit
super
Image editing (supports reference images)
grok-imagine-video
video
super
Video generation
All models are defined in internal/modelconfig/models.toml (embedded in the binary). To customize, set models_file in config.toml to point to your own TOML catalog file — it replaces the default entirely.
Unidirectional dependencies, no circular references.
Request Flow
sequenceDiagram
participant C as Client
participant H as httpapi
participant F as flow
participant T as token
participant X as xai
participant G as grok.com
C->>H: POST /v1/chat/completions
H->>H: Auth check + param parsing
H->>F: Route to chat/image/video flow
F->>T: Request available Token (`pool_floor` + algorithm selection)
T-->>F: Return Token
F->>X: Build upstream request
X->>G: SSE / WebSocket request
G-->>X: Streaming response
X-->>F: Parse + transform
F-->>H: OpenAI format output
H-->>C: SSE stream / JSON response
Note over F,T: Auto retry on failure<br/>Switch Token + Session reset
Admin Panel
Admin panel URL: http://your-host:8080
The admin panel includes:
Dashboard — System status at a glance: Token count, API Key count, call volume, quota progress, trend charts
Find the sso or sso-rw cookie value in Application → Cookies
Import it in the admin panel
What's the difference between Basic, Super, and Heavy pools?
Basic pool (ssoBasic): Lowest capability floor. Can serve models/modes whose pool_floor is basic.
Super pool (ssoSuper): Higher capability floor. Can serve super and basic models/modes.
Heavy pool (ssoHeavy): Highest capability floor. Reserved for heavy models/modes and can also serve lower-floor requests.
Model routing is defined in the static model catalog (internal/modelconfig/models.toml), not by editing per-pool model lists.
pool_floor is a hard requirement. If no eligible token exists in pools with level >= the model's floor, the request fails with no silent downgrade.
What to do about 403 errors?
Usually triggered by Cloudflare protection. Solutions:
Configure proxy: Set base_proxy_url with a clean IP
FlareSolverr: Configure flaresolverr_url, GrokForge auto-refreshes CF cookies
Manual update: Update cf_clearance cookie in the admin panel
How long until token quotas recover?
Depends on the recovery mode:
auto mode (default): Restore configured default quotas after the pool's cooling window expires
upstream mode: Sync real quotas from Grok's rate-limits API when the cooling window expires
Tokens enter cooling status when quotas are exhausted and automatically switch back to active after recovery.
How to share with multiple users?
Create API Keys in the admin panel, assign one per user
Set Model Whitelist to restrict available models
Set Daily Limit to control daily usage per user
Set Rate Limit to prevent burst requests
Which databases are supported?
SQLite (default): Zero config, data stored in data/grokforge.db
PostgreSQL: Recommended for production, set db_driver = "postgres" and db_dsn
Both databases have identical functionality with current-schema initialization on startup.
If the schema changes in local development, delete data/grokforge.db and rebuild instead of expecting in-place migration.
Disclaimer: This project is for educational and research purposes only. Users must comply with the terms of service of relevant platforms. Any consequences arising from the use of this project are the sole responsibility of the user.