API Reference
The SUPREME API is OpenAI-compatible — drop it into any existing OpenAI client by overriding the base URL. Powered by Gemini and DeepSeek under one billing surface.
Base URL & Authentication
All requests go to the /api/v1 base path and authenticate with a bearer token:
Base URL: https://your-domain.com/api/v1
Auth: Authorization: Bearer sk-supreme-...Create keys in the Overview tab. Each key carries scopes (chat, models), a tier, and optional spend caps. Keys are shown once — store them securely.
Quickstart
Send your first request in seconds. Pick your language:
curl https://your-domain.com/api/v1/chat/completions \
-H "Authorization: Bearer $SUPREME_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-2.5-flash",
"messages": [{"role": "user", "content": "Namaste! Ek chhoto kavita lekha."}]
}'Chat Completions
POST /api/v1/chat/completions — create a model response. Request fields:
| Field | Type | Notes |
|---|---|---|
| model | string | A model id from /api/v1/models. |
| messages | array | Roles: system, user, assistant. |
| stream | boolean | SSE token stream when true. |
| max_tokens | number | Max output tokens. |
| temperature | number | 0–2 sampling temperature. |
Set "stream": true for incremental Server-Sent Events:
curl https://your-domain.com/api/v1/chat/completions \
-H "Authorization: Bearer $SUPREME_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-2.5-pro",
"stream": true,
"messages": [{"role": "user", "content": "Stream a haiku about the Himalayas."}]
}'
# → Server-Sent Events: data: {"choices":[{"delta":{"content":"..."}}]} ... data: [DONE]Models
GET /api/v1/models lists the models currently served; GET /api/v1/models/{id} retrieves one. The list reflects live provider availability. Currently served:
| Model | Owner | Context | Min tier |
|---|---|---|---|
| Loading from /api/v1/models… | |||
Connector tools (MCP)
Keys carrying the mcp scope can list and call every connector you've attached — your own MCP connections plus any workspace-enabled connectors — through the same gateway your in-app agents use. Grant this scope when creating a key in the Overview tab ("Connector access").
GET /api/v1/tools — list every tool available to the key's owner, in the OpenAI function-tool shape:
curl https://your-domain.com/api/v1/tools \
-H "Authorization: Bearer $SUPREME_API_KEY"
# → { "object": "list", "data": [ { "type": "function", "server_id": "...", "function": { "name": "...", "description": "...", "parameters": {...} } } ] }POST /api/v1/tools/call — invoke one tool by server + name:
curl https://your-domain.com/api/v1/tools/call \
-H "Authorization: Bearer $SUPREME_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"server_id": "gmail",
"tool_name": "send_email",
"arguments": { "to": "a@b.com", "subject": "Hi", "body": "..." }
}'Each call costs a flat 2 credits, billed against the key the same way chat completions are.
Rate limits & spend
Limits scale with your key's tier. Responses include X-RateLimit-* headers; a 429 carries Retry-After.
| Tier | Requests / min | Tokens / min |
|---|---|---|
| free | 20 | 20K |
| starter | 60 | 60K |
| pro | 120 | 200K |
| max | 300 | 400K |
| enterprise | 1,000 | 2M |
Spend caps: set an optional monthly or lifetime credit cap per key. When reached, requests return 429 insufficient_quota until you raise the cap.
Auto-tier graduation: keys ratchet up automatically as cumulative spend crosses thresholds — and never downgrade:
Errors
Errors follow the OpenAI shape: { "error": { "message", "type", "code" } }.
| Status | Type | When |
|---|---|---|
| 401 | invalid_api_key | Missing/invalid/revoked key. |
| 403 | insufficient_scope | Key lacks the 'chat' scope. |
| 404 | model_not_found | Unknown or unavailable model id. |
| 429 | rate_limit_exceeded | RPM or TPM exceeded — see Retry-After. |
| 429 | insufficient_quota | Per-key spend cap reached (billing_hard_limit_reached). |