API documentation
WorldAPI is OpenAI-compatible: use any OpenAI SDK with a different base URL and your WorldAPI key.
https://worldapi.cc/v1Quickstart
Create an API key in the dashboard, export it as WORLDAPI_KEY, then send a chat completion. Create a key
curl https://worldapi.cc/v1/chat/completions \
-H "Authorization: Bearer $WORLDAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-3.8-flash",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Write a haiku about the sea."}
],
"stream": true
}'from openai import OpenAI
client = OpenAI(
base_url="https://worldapi.cc/v1",
api_key="wapi-sk-...",
)
resp = client.chat.completions.create(
model="claude-sonnet-5",
messages=[{"role": "user", "content": "Summarize this in one line: ..."}],
)
print(resp.choices[0].message.content)
print(resp.usage) # prompt_tokens, completion_tokens, total_tokensimport OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://worldapi.cc/v1",
apiKey: process.env.WORLDAPI_KEY,
});
const stream = await client.chat.completions.create({
model: "gemini-3.5-flash-lite",
messages: [{ role: "user", content: "Hello!" }],
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
}Authentication
Send your key as a Bearer token in the Authorization header (x-api-key is also accepted). Keys start with wapi-sk- and are shown only once at creation; revoke and recreate them from the dashboard.
Authorization: Bearer wapi-sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Models
Use the public id from the rate card as the model parameter. GET /v1/models returns the same list with prices. See the full rate card
GET https://worldapi.cc/v1/models
gemini-3.1-progemini-3.8-flashgemini-3.5-flashgemini-3.5-flash-litegemini-3.1-flash-litellama-4-maverickqwen3-235bglm-4.7kimi-k2-thinkingclaude-opus-5claude-sonnet-5claude-opus-4.8claude-sonnet-4.6claude-haiku-4.5gemma-4-26bgpt-oss-120bgpt-oss-20bglm-5kimi-k2.5nova-premiernova-pronova-2-litenova-liteBilling & usage
Accounts are prepaid. Each request is priced per token and deducted from your balance; a request that starts with zero balance is refused with 402.
Each model has its own discounted price next to the vendor's official price; see the rate card.
Responses carry the standard OpenAI usage object (streaming: in the final chunk). Per-request cost is shown in the dashboard.
"usage": {
"prompt_tokens": 120,
"completion_tokens": 48,
"total_tokens": 168
}Errors
Errors use the OpenAI envelope: { error: { message, type, code } }. Failed requests are not charged.
| HTTP | code | Meaning |
|---|---|---|
| 401 | invalid_api_key | Missing, malformed or revoked API key. |
| 402 | insufficient_balance | Balance is zero. Buy a usage pack in the dashboard. |
| 404 | model_not_found | Unknown model id. |
| 429 | rate_limit_error | The upstream provider rate-limited the request. Retry with backoff. |
| 502 / 504 | upstream_error | The upstream provider failed or timed out. Not charged; retry. |
{
"error": {
"message": "Your WorldAPI balance is exhausted. Buy a usage pack at https://worldapi.cc/dashboard/billing.",
"type": "insufficient_quota",
"code": "insufficient_balance"
}
}Limits
- Request bodies up to 6 MB; streaming responses up to 5 minutes.
- Up to 20 active API keys per account.
- Per-account rate limits follow the cloud quotas we hold; contact support for reserved throughput.