API Reference

One OpenAI-compatible endpoint for the whole above.dev model catalog. You name the model you want and get that model, with the full upstream cache discount passed through on every token class.

Base URLhttps://api.above.dev/v1

Overview

above.dev exposes inference endpoints under https://api.above.dev/v1. You choose the model with the standard model field in the request body, or with the x-model header. If you name no model, the request is served by a fixed default.

Two routing modes are available:

Some models are TEE-enabled. The model catalog shows which models support TEE.

Authentication

All requests require a Bearer token in the Authorization header. API keys are issued after purchase at above.dev/pricing and follow the format sk-gw-….

http
Authorization: Bearer sk-gw-<your-api-key>
Keep your key safe. API keys grant full access to your credit balance. Rotate from your dashboard if compromised.

Quick start

Send your first request in under a minute:

curl
curl -X POST https://api.above.dev/v1/messages \
  -H "Authorization: Bearer sk-gw-<your-key>" \
  -H "Content-Type: application/json" \
  -d '{
    "messages": [
      { "role": "user", "content": "Summarise the key steps of a RAG pipeline." }
    ],
    "max_tokens": 1024
  }'

POST /v1/messages

The primary inference endpoint. Accepts a messages payload and returns a completion.

POSThttps://api.above.dev/v1/messages

Serves the model you name in the request body or the x-model header, and a fixed default if you name none.

Request body

ParameterTypeDescription
messagesarrayRequiredArray of message objects with role and content fields.
max_tokensintegerOptionalMaximum tokens to generate. Defaults to 4096.
streambooleanOptionalSet to true to stream the response as SSE.
temperaturenumberOptionalSampling temperature. Passed through to the model.
top_pnumberOptionalNucleus sampling threshold.
toolsarrayOptionalTool definitions. Presence influences routing toward tool-capable models.
tool_choiceobjectOptionalTool choice control. Passed through to the model.
response_formatobjectOptionalStructured output format. Presence scores toward structured-output models.

POST /v1/chat/completions

An OpenAI-compatible alias that delegates to /v1/messages. Use this as a drop-in replacement if your SDK or framework targets the OpenAI API format.

POSThttps://api.above.dev/v1/chat/completions

Identical behaviour to /v1/messages. All routing headers apply.

Routing headers

These request headers control how above.dev routes your request. All are optional — omitting them serves the request with the default model. You can also select a model with the standard OpenAI model field in the request body, which most clients set for you.

HeaderValuesDescription
x-modeauto · directRouting mode. direct serves the model named in x-model. auto (default) serves the default model.
x-modelmodel slugTarget model slug, e.g. deepseek-v4-pro. Takes precedence over the model field in the request body.
x-session-idopaque stringGroups related requests into one session for your usage reporting. Also accepted as session_id in the body.

Auto mode

If you omit model (and the x-model header), the request runs in auto mode and is served by deepseek-v4.1-flash — the cheapest model in the catalog. The aliases smart-select, gateway-auto and auto resolve the same way, so clients that expect a routing model id keep working.

Auto mode is a sensible default, not a classifier: it does not inspect your prompt to pick a model. For anything where model choice matters, name the model explicitly with direct mode below — that is the recommended path for production traffic.

curl — auto mode
curl -X POST https://api.above.dev/v1/messages \
  -H "Authorization: Bearer sk-gw-<your-key>" \
  -H "Content-Type: application/json" \
  -d '{
    "messages": [{ "role": "user", "content": "Fix this bug: ..." }],
    "max_tokens": 2048
  }'

Direct mode

Use x-mode: direct with x-model to target a specific model, or just set the model field in the body, which most clients do for you. Either way your request goes to exactly the model you name. This is the recommended path for production traffic.

curl — direct mode
curl -X POST https://api.above.dev/v1/messages \
  -H "Authorization: Bearer sk-gw-<your-key>" \
  -H "Content-Type: application/json" \
  -H "x-mode: direct" \
  -H "x-model: deepseek-v4-pro" \
  -d '{
    "messages": [{ "role": "user", "content": "..." }],
    "max_tokens": 4096
  }'

Response headers

Every response includes metadata headers describing what happened:

HeaderDescription
x-model-usedSlug of the model that handled the request, e.g. deepseek-v4-pro.
x-tierTier of the selected model (1–4).
x-scoreInternal selection score for the model that served the request (0–100).
x-cost-microCost of this request in µ$ (micro-dollars). $1 = 1,000,000 µ$.
x-cost-usdCost in USD as a decimal string, e.g. 0.000312.
x-balance-remaining-microRemaining balance in µ$ after this request.
x-balance-remaining-usdRemaining balance in USD, e.g. 18.4231.
x-input-cache-hit-tokensInput tokens served from the provider's prompt cache and billed at the cheaper cache-hit rate.
x-input-cache-miss-tokensInput tokens billed at the full rate.
x-input-cache-hit-rateCache hits as a fraction of total input tokens, e.g. 0.9553. Only sent when the provider reports cache data.
x-request-idUUID for this request — include in support queries.

Streaming

Set "stream": true in your request body to receive a Server-Sent Events stream. Each event follows the standard SSE format with a data: prefix. The stream terminates with data: [DONE].

Note: Cost and token counts are not included in response headers for streaming requests — they are logged server-side and visible in your dashboard.
python — streaming
import requests, json

resp = requests.post(
    "https://api.above.dev/v1/messages",
    headers={
        "Authorization": "Bearer sk-gw-<your-key>",
        "Content-Type": "application/json",
    },
    json={
        "messages": [{"role": "user", "content": "Write a sorting algorithm."}],
        "max_tokens": 2048,
        "stream": True,
    },
    stream=True,
)

for line in resp.iter_lines():
    if line and line.startswith(b"data: "):
        data = line[6:]
        if data == b"[DONE]":
            break
        chunk = json.loads(data)
        print(chunk, flush=True)

Limits

Limits apply per account, across all of your API keys.

LimitValueOn exceeding
Request rate300 requests / minute429 rate_limit_exceeded with Retry-After
Request body8 MB413 request_too_large
Input tokensUp to the model's context window (1,000,000 for the current catalog)413 input_too_large
Large-context requestsOne 500k+ token request per 2 minutes429 large_context_rate_limit_exceeded
Output tokens131,072Silently clamped to the cap

A model's own context window is the ceiling; exceeding it returns 413 input_too_large_for_model, naming that model's ceiling.

Every model in the catalog accepts up to 131,072 output tokens. The two free-tier routes, glm-5.3-flash-modal and deepseek-v4.1-flash-modal, are capped at 16,384 instead, because they share a fixed concurrency pool. A max_tokens above the cap is reduced to it rather than rejected, and each model reports its own figure as max_completion_tokens in GET /v1/models.

Need higher limits? Email support@realtimecomms.co.uk.

Errors

All errors return JSON with an error field describing the issue.

StatusMeaning
400Bad request — invalid JSON body or missing messages array.
401Unauthorised — missing, malformed, or inactive API key.
402Payment required — insufficient balance. Top up at above.dev/pricing.
403model_not_allowed_for_key — the key is restricted to a subset of models, or the model is in private beta and needs to be enabled for your key.
413Too large — the body exceeds 8 MB, or the estimated input exceeds the model's context window. The response names the limit it hit.
429rate_limit_exceeded — more than 300 requests per minute. A Retry-After header tells you when to retry. Note that provider_error with status 429 is different: that is the upstream provider rate-limiting, not us.
500Internal server error — routing failure.
503service_unavailable — a dependency (balance or model-access lookup) is temporarily unreachable. Retry after a short delay.
504provider_timeout — the upstream model did not respond in time.
variesprovider_error — the upstream provider returned an error, and its status is passed through with a request_id you can quote to support.

Model catalog

The active model catalog is exposed through GET /v1/models. Provider names are shown as above.dev in customer-facing surfaces.

ModelSlugTierContextInput /1MCache hit /1MOutput /1M
DeepSeek V4.1 Flashdeepseek-v4.1-flash
also deepseek-v4-flash
T11 million$0.165–$0.33$0.0033–$0.0066$0.66–$1.32
DeepSeek V4 Prodeepseek-v4-proT21 million$0.726–$1.452$0.0242–$0.0484$2.178–$4.356
GLM 5.2glm-5.2T21 million$1.54$0.154$4.84
GLM 5.3 Flashglm-5.3-flashT11 million$0.165$0.0319$0.55
GLM 5.2 Fastglm-5.2-fastT31 million$2.31$0.231$7.26
Qwen 3.8 Maxqwen3.8-maxT31 million$2.20$0.275$6.60
MiMo V2.6 Promimo-v2.6-pro
also mimo-v2.5-pro
T21 million$0.5077$0.0042$1.0154
MiMo V2.6 Flashmimo-v2.6-flashT11 million$0.1692$0.0034$0.3385
MiMo V2.6 Pro UltraSpeedmimo-v2.6-pro-ultraspeedT31 million$5.0769$0.0423$10.1538

Where two prices are shown, the model uses time-of-day pricing: peak hours are 01:00 to 04:00 and 06:00 to 10:00 UTC on weekdays, and all other hours bill at the lower off-peak rate. Weekends are entirely off-peak: the provider defines its weekend in Beijing time, so that runs from 16:00 UTC Friday to 16:00 UTC Sunday. Cache-hit input is billed separately and more cheaply wherever the upstream provider reports it. Every response carries its exact cost in the x-cost-usd header, so billing is verifiable per request.

Why cache pricing dominates agent costs

An agent session re-sends the growing conversation on every tool call. After 50 calls the original prompt has been billed roughly 50 times, and on typical coding-agent traffic 80 to 95% of all input tokens are served from the provider's prompt cache. That makes the cache-hit rate, not the headline input price, the number that decides what a session costs. We pass the full upstream cache discount through: DeepSeek's 97% discount (cache hits from $0.0077/M off-peak on V4 Flash) and Fireworks' 10x discount on GLM 5.2 ($0.154/M, where the official API's own rate is $0.26/M). You can verify your cache performance on every response via the x-input-cache-hit-rate header.

Tier system

Models are grouped into four capability tiers. Tiers are descriptive, to help you pick a model: nothing routes on them automatically.

TierCharacteristicsBest for
T1Balanced — fast, cost-efficientSummarisation, classification, high-throughput pipelines
T2Agentic — multi-step, tool-capableAgentic workflows, tool use, reasoning chains
T3Highest capability in the catalogComplex coding, deep reasoning, long-context tasks
T4Enterprise — restricted premium modelsEnterprise accounts only
Questions? Email support@above.dev or check your dashboard at above.dev/dashboard.