Quickstart
Ternpost exposes an OpenAI-compatible API. If your code already uses an OpenAI SDK, change the base URL and the API key.
- Create an organisation.
- Top up your balance under Billing with mobile money or card.
- Create a key under API keys and store it as TERNPOST_API_KEY.
- Send your first request:
curl https://api.ternpost.dev/v1/chat/completions -H "Authorization: Bearer $TERNPOST_API_KEY" -H "Content-Type: application/json" -d '{
"model": "openai/gpt-5-mini",
"messages": [{"role": "user", "content": "Summarise this invoice in Luganda."}]
}'Authentication
Send your key in the Authorization: Bearer header. Keys belong to an organisation, can carry a monthly spending limit and can be revoked at any time from the console. A key is shown only once when it is created; store it in a secret manager, never in client-side code.
Balance & billing
Every request is priced from the tokens it uses at the model's published rate and deducted from your prepaid balance, which is held in US dollars and can be viewed in UGX. Before a request is served, Ternpost checks that your organisation balance and the key's monthly limit can cover it.
- Balance is added only when a payment is confirmed by the operator or card processor.
- Each response includes token counts in the usage field.
- Set a low-balance alert in the console to be notified before requests stop.
API endpoints
| Method | Path | Purpose |
|---|---|---|
| POST | /v1/chat/completions | Chat and tool calling, streaming supported |
| POST | /v1/responses | Responses API format |
| POST | /v1/embeddings | Vector embeddings for search and RAG |
| GET | /v1/models | Models available to your organisation |
| GET | /v1/balance | Current balance and month-to-date spend |
Model IDs
Use the provider-prefixed ID in the model field. See prices on the models page.
openai/gpt-5 openai/gpt-5-mini anthropic/claude-sonnet-4.5 anthropic/claude-haiku-4.5 google/gemini-2.5-pro google/gemini-2.5-flash xai/grok-4 deepseek/deepseek-v3.2 meta/llama-4-maverick mistral/mistral-large openai/text-embedding-3-small google/gemini-embedding-001
Errors & limits
| Status | Code | Meaning |
|---|---|---|
| 401 | invalid_api_key | Key missing, wrong or revoked |
| 402 | insufficient_balance | Top up to continue; no request was charged |
| 403 | key_limit_reached | The key's monthly limit is used up |
| 404 | model_not_found | Unknown model or not enabled for your organisation |
| 429 | rate_limited | Too many requests; retry with backoff |
| 502 | upstream_error | The model provider failed; you are not charged |