Getting started
Happy GOD LLm is an AI model gateway platform. Sign in with GitHub to get $149.00 free credit on your trial account, generate API keys, and start calling our public API right away.
Our API is compatible with both OpenAI and Anthropic client libraries — so you can drop it into whichever SDK you already have without rewriting your code.
Base URL: http://localhost:8000 (or your production host)
You can check your current base URL and endpoint URLs at GET /api/gateway/config.
Authentication
All API requests require an API key. Create one on your dashboard after signing in — it takes a few seconds.
Send the key via the Authorization header (Bearer token) or the x-api-key header. Either works, but we recommend the Authorization header since it's what most SDKs expect.
# Option 2: x-api-key header x-api-key: sk-your-project-randomkey
API keys are stored as SHA-256 hashes. The raw key is shown once at creation — grab it and store it somewhere safe. You won't see it again.
Heads upIf you lose a key, revoke it from the dashboard and generate a new one. There's no way to recover the raw value.
Models & pricing
We currently offer nine model aliases across OpenAI, Claude, and GLM (Zhipu) providers. Pick the one that matches your needs — cost, speed, or quality.
| Alias | Provider | Input $/1M | Output $/1M | Context |
|---|---|---|---|---|
gpt-6.1-terra |
OpenAI | $0.20 | $0.60 | 1.05M |
gpt-6.1-sol |
OpenAI | $0.30 | $1.10 | 1.05M |
gpt-6-astra |
OpenAI | $1.10 | $5.10 | 1.05M |
gpt-6-luna |
OpenAI | $0.11 | $0.15 | 1.05M |
claude-opus-5.5 |
Claude | $0.50 | $2.10 | 1M |
claude-sonnet-5.5 |
Claude | $0.30 | $1.10 | 1M |
claude-haiku-4.5 |
Claude | $0.20 | $0.60 | 200K |
glm-5.3-prime |
GLM (Zhipu) | $0.38 | $0.98 | 1M |
glm-5.3-flashx |
GLM (Zhipu) | $0.14 | $0.23 | 1M |
Prices are per 1 million tokens. Costs are deducted from your balance in real time — you can watch it go down as you experiment.
Pro tipList available models programmatically with GET /v1/models. Handy for checking what's live before spinning up a batch job.
OpenAI-compatible API
POST /v1/chat/completions — works with the OpenAI SDK and any client that speaks the OpenAI shape. If you've used the OpenAI API before, this will feel familiar.
Request body:
"model": "opus",
"messages": [
{"role": "user", "content": "Hello!"}
],
"max_tokens": 128,
"temperature": 0.7,
"stream": false
}
Response shape (OpenAI-compatible):
"id": "chatcmpl-123456",
"object": "chat.completion",
"created": 1700000000,
"model": "gpt-6.1-terra",
"choices": [{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! How can I help you?"
},
"finish_reason": "stop"
}],
"usage": {
"prompt_tokens": 8,
"completion_tokens": 12,
"total_tokens": 20
}
}
Anthropic-compatible API
POST /v1/messages — works with the Anthropic SDK. Same idea: if your code already sends messages to Anthropic, swap the base URL and you're good.
Request body:
"model": "sonnet",
"messages": [
{"role": "user", "content": "Hello!"}
],
"max_tokens": 128,
"system": "You are a helpful assistant."
}
Response shape (Anthropic-compatible):
"type": "message",
"id": "msg_123456",
"model": "claude-sonnet-5.5",
"stop_reason": "stop",
"role": "assistant",
"content": [{
"type": "text",
"text": "Hello! How can I help you?"
}],
"usage": {
"input_tokens": 8,
"output_tokens": 12
}
}
Streaming (SSE)
Both endpoints support Server-Sent Events streaming. Just set "stream": true in the request body and you'll get a live stream of tokens as the model generates them — great for chat interfaces and anything where you want to show progress instead of making the user wait.
OpenAI streaming example:
-H "Authorization: Bearer sk-your-key" \
-H "Content-Type: application/json" \
-d '{"model":"opus","messages":[{"role":"user","content":"Write a poem."}],"max_tokens":64,"stream":true}'
Anthropic streaming example:
-H "Authorization: Bearer sk-your-key" \
-H "Content-Type: application/json" \
-d '{"model":"sonnet","messages":[{"role":"user","content":"Hello!"}],"stream":true}'
text/event-stream content. Each chunk is a JSON SSE frame. The stream ends with data: [DONE] — watch for that to know when to close the connection.
API code generator
Not sure how to wire up your first API call? The API code generator gives you a ready-to-run snippet in curl, Python, or JavaScript — pick a model, choose OpenAI or Anthropic, and copy the result straight into your project.
The generator calls GET /api/generate-code behind the scenes. Try it directly if you want to build the snippets into your own tooling:
You'll get back a JSON payload with the model name, base URL, and the full snippet ready to paste — no API key needed to generate the example.
Error codes
Here's what the API might throw at you. Most of these are standard HTTP — nothing surprising, but good to know before you wire up error handling.
| Status | Meaning |
|---|---|
400 |
Bad request — invalid body, missing fields, schema error |
401 |
Invalid or revoked API key, or missing key |
402 |
Insufficient balance — top up or create a new account |
404 |
Unknown model alias |
422 |
Schema validation error |
429 |
Rate limit exceeded |
502 |
Upstream provider error (or temporarily unavailable) |
503 |
Model routing temporarily unavailable |
503 is usually a temporary issue on the server side, not something you did wrong. If you hit it consistently, contact support.
API keys
Create multiple keys with descriptive names — production, ci-cd, local-dev, whatever makes sense for your setup. Each key gets a human-readable prefix like sk-prod-a1b2c3- so you can tell them apart at a glance.
- Create keys from the dashboard at /account, or via
POST /api/keys?name=.... - The raw key is returned once — copy it and store it immediately. There's no "show me the key again" button.
- Revoke keys any time from the dashboard. Revoked keys stop working the instant you hit revoke — no grace period.
- Keys are stored as SHA-256 hashes. We never see the raw value after creation, and we can't recover it for you.
Rate limits
Login attempts are rate-limited per IP address, and API endpoints are rate-limited per key (by prefix). The defaults are generous enough for most development work:
- Login: 20 attempts per minute per IP
- API: 100 requests per minute per key prefix
You can adjust these with the RATE_LIMIT_LOGIN and RATE_LIMIT_API environment variables if you need tighter or looser limits. Exceeding the limit returns 429 — handle it with a retry-after backoff and you'll be fine.
Billing & quota
Your account starts with $149.00 free credit (14,900 cents). Every API call deducts the estimated cost based on actual token counts and the model's price table. Costs are deducted in real time, so you can watch your balance tick down as you experiment.
Cost is calculated as:
output_cost = (output_tokens × output_price_per_million) ÷ 1,000,000
total = input_cost + output_cost
When your balance hits zero, subsequent requests return 402 Payment Required. An admin can grant additional credit from the admin panel if you need more time to test.
Your trial account expires 30 days after creation (configurable via TRIAL_DAYS). After expiry, access to protected pages is blocked and you'll see the expired trial page.