1. Create an API key
Keys live in the console, under API Keys. The plaintext key is shown once, at creation — we store only a hash, so there is no screen anywhere that can show it to you again. Lose it and you revoke it and make another.Create a key
Opens the console in a new tab.
2. Put it in your environment
Every snippet on this site reads the key from the environment. None of them contain one.3. Make the call
- cURL
- Python
- TypeScript
Already using an OpenAI SDK?
base_url and api_key are the only two lines that change.
Already using an Anthropic SDK? Point it at https://compute.prentis.ai and call
/v1/messages instead — your x-api-key header works as-is.Read the response
Three things in every answer are worth knowing about:x-request-id
A header on every response, successes and errors alike. It is the handle that
reaches the whole path your request took. Quote it when you ask us anything about a
call.
usage
The token counts you were billed for — not an estimate of them. When streaming, it
arrives on the last data event.
x-provider-class
primary or fallback: whether your call was served by the first choice or a standby.
It never names who served it.Stream it
Setstream: true and the same call answers text/event-stream, one chunk per event,
ending with data: [DONE]. The last data event carries usage whether or not you asked
for it, so streaming never costs you the billing numbers.
What a failed call costs
Nearly always: nothing. Of the 28 errors this API can return, only two still produce a usage record, and both are cases where the model had already generated output when the call came apart. The full table is on Errors.Next
Authentication
Bearer keys, the
x-api-key alias, and what happens when a key is revoked.Models and resource names
When to write
deepseek-v4.1-flash and when to write accounts/acme/models/….API reference
Every endpoint, parameter and status code.
Rate limits and quotas
What throttles you, and which of the three 429s you are looking at.