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 (8)
Model
Mode
Pool Floor
Description
grok-4.20-fast
fast
basic
Fast, Basic pool
grok-4.20
auto
super
Default (auto)
grok-4.20-think
expert
super
Think (reasoning)
grok-4.20-fast-super
fast
super
Fast, Super pool
grok-4.20-fast-heavy
fast
heavy
Fast, Heavy pool
grok-4.20-heavy
auto
heavy
Default (auto), Heavy pool
grok-4.20-think-heavy
expert
heavy
Think, Heavy pool
grok-4.20-multi-agent
heavy
heavy
Multi-Agent
Special Chat (1)
Model
Mode
Pool Floor
Description
grok-4.3-beta
grok43
super
Grok 4.3 beta
Media Models (5)
Model
Type
Pool Floor
Description
grok-imagine-image-lite
image_lite (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
grok-imagine-image
image_ws (WebSocket)
super
Full image generation (no quota sync)
grok-imagine-image-pro
image_ws + enable_pro
super
Pro image generation (no quota sync)
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.
Quick Start
30-Second Setup
# 1. Download & start
./grokforge -config config.toml
# If app_key is not set, a temporary admin password is printed in the startup log.
# 2. Open admin panel and add your Grok Token
# http://localhost:8080
# 3. Test
curl http://localhost:8080/v1/chat/completions \
-H "Authorization: Bearer your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-4.20",
"messages": [{"role": "user", "content": "Hello!"}],
"stream": true
}'
Build from Source
Prerequisites: Go 1.25+, Node.js 18+
git clone https://github.com/crmmc/grokforge.git
cd grokforge
# Copy config template
cp config.defaults.toml config.toml
# One-command build (frontend + backend)
make build
# Run
./bin/grokforge
The build output is a single binary with the frontend embedded via go:embed.
Configuration
GrokForge uses TOML configuration. See config.defaults.toml for the full template.
Minimal Config
[app]
app_key = "your-admin-password" # Admin password (omit to auto-generate a temporary one on startup)
port = 8080 # Server port
[proxy]
base_proxy_url = "" # Optional: proxy URL
After startup, add Grok Tokens in the admin panel. All other settings can be modified online.
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?
Quota-tracked models (chat, image_lite, image_edit, video) recover per mode window.
The scheduler starts a token+mode window from the first successful upstream response after refresh.
When that window expires, GrokForge refreshes the mode from /rest/rate-limits and learns both remaining quota and total quota from upstream.
image_ws is not quota-tracked; it only uses transient token+model cooldown in memory.
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.