Quickstart
Issue an API key and make your first billed completion in five minutes.
1. Create an API key
Sign in to the dashboard, open API keys, and issue a new key. Pick the scopes you need — for this quickstart: gateway:write, predictions:read, and billing:read.
The full key (sub41_live_…) is shown once at creation. Store it in a secret manager; the dashboard only keeps a hashed copy. For the examples below, export it as an environment variable:
export ALMANAC_API_KEY="sub41_live_…"2. See what models are available
The provider catalog is public — no auth needed:
curl https://api.almnc.ai/v1/gateway/providers{
"providers": [
{ "id": "openrouter", "models": ["anthropic/claude-3.5-sonnet"], "allowsAnyModel": true },
{ "id": "anthropic", "models": ["claude-sonnet-4-5"], "allowsAnyModel": false }
]
}3. Run a completion
This is the only call in this quickstart that spends credits — top up in the dashboard first if your balance is empty.
curl -X POST https://api.almnc.ai/v1/gateway/completions \
-H "Authorization: Bearer $ALMANAC_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"provider": "openrouter",
"model": "anthropic/claude-3.5-sonnet",
"messages": [
{ "role": "user", "content": "In one sentence: what moves BTC this quarter?" }
],
"maxTokens": 200
}'The response is a flat envelope (not OpenAI-shaped — see the gateway guide):
{
"provider": "openrouter",
"model": "anthropic/claude-3.5-sonnet",
"output": "…the completion text…",
"usage": { "promptTokens": 21, "completionTokens": 42, "totalTokens": 63 },
"costMicro": "12500",
"providerCostMicro": "10000",
"markupBps": 2500,
"balanceAfterMicro": "987500"
}The X-Sub41-Credits-Remaining response header carries your post-debit balance.
4. Check your balance
curl https://api.almnc.ai/v1/credits/balance \
-H "Authorization: Bearer $ALMANAC_API_KEY"{ "balanceMicro": "987500", "lastUsageAt": "2026-08-04T10:12:03.000Z" }Next steps
- Authentication — scopes and rate limits in depth.
- Credits & billing — how the markup model works.
- Predictions & events — the forecasting read API.