openapi.json. Each page has a playground that sends real requests with your key.
Base URL
/v1. Request and response bodies are JSON, except the server-sent events of GET /v1/runs/{run_id}/stream.
Authentication
Send a bearer credential on every/v1 request:
- The scheme name
Beareris case-insensitive. There is no other auth header and no cookie auth. - A key acts in its organization with exactly the scopes it was created with. Each endpoint page names the scope it needs, for example
runs_writeto create a run. See Scopes. - A key’s secret is returned once, when you create or rotate the key. Keys do not expire; revoke or rotate them. See API key security.
Your first request
Create a decision run. Keep your key inOPENTYPE_API_KEY.
200 once the run has settled, with the answers in decision.answers. Neon 1.1 serves decision runs; a verdict run currently answers 503 no_route_available. The walkthrough is in the quickstart, and the answer shapes are in Decision runs.
Headers
string
required
Bearer <credential>, on every /v1 request.string
application/json on every request with a body. Without it, POST /v1/runs answers 400 invalid_body and the other routes answer a plain-text 415.string
Required on
POST /v1/runs, and read nowhere else. 1 to 255 bytes of visible ASCII text, unique per logical request.string
Optional. Your own id for the request, 1 to 128 characters from
A-Z a-z 0-9 . _ -. It is echoed back; otherwise the server assigns one.Idempotency on runs
POST /v1/runs refuses a request without an Idempotency-Key. The key makes a retry safe: the server remembers which run each key created, per organization, and never expires a key.
The body counts as the same when the prompt, the kind and the contract match: the
state or messages, the questions and instructions (or the schema), draws and think_tokens. max_output_tokens, deadline_ms and capability_hint are not part of the comparison.
See Idempotency for key design and retry loops.
Errors
Every JSON error uses one envelope:
Some rejections come from the HTTP layer before the API sees the request, and have a plain-text body instead of JSON: a malformed JSON body (
400), a missing Content-Type (415), an unknown or mistyped field (422), or an oversized body (413) on the keys, usage and billing routes; an unknown path (404); a wrong method (405). When the body is not JSON, act on the HTTP status. x-request-id is still set.
How to react, by status:
Every code has its own page under Problems. The full table is in Errors, and retry patterns are in Error handling.
Request ids
Every response carries anx-request-id header, including errors and rejections. Send your own id to correlate the API’s response with your logs; a value that does not match ^[A-Za-z0-9._-]{1,128}$ is replaced with req_ followed by 32 hex characters. Log the id with every failure and quote it when you report a problem. See Request ids.
Money and tokens
Every amount is an integer in micro-USD:1,000,000 is one US dollar, and 10,000 is one cent.
balance_micros and billing transaction amounts are signed; every other amount is zero or positive. Neon 1.1 costs $0.042 per million tokens for input and for output, and each part is rounded up to a whole micro-USD separately. A run holds its whole spend ceiling, at most 20,000 micro-USD, against your credit and quota until it settles. See Models and pricing.
Identifiers and timestamps
Runs responses omit an optional field that has no value. Keys, usage and billing responses send it as
null.
Pagination
OnlyGET /v1/runs pages, by offset:
limit and offset it applied. A page shorter than limit is the last one. Any other query parameter, or a value that is not a whole number, is 400 invalid_body. List rows carry no answer, usage or cost: retrieve a run for those.
The other lists do not page. GET /v1/keys returns every key, GET /v1/billing the last 50 transactions, and GET /v1/usage/ledger up to limit entries (default 50, at most 200) inside a time window. See Pagination.
Limits
There is no request-rate limit. See Limits for the rest.
Endpoint groups
Runs
Create a run, list runs, retrieve one, or read it as server-sent events. Scopes
runs_write and runs_read.Model Router
Classify a task and select a model, list task types, list the catalog. Scopes
runs_write and runs_read.API keys
Create, list, retrieve, rotate and revoke keys. Scopes
keys_write and keys_read.Usage and quota
Rollups, the daily series, the per-attempt ledger, one run’s usage, and quota. Scope
usage_read.Billing
Balance and transactions, checkout, the billing portal and auto-recharge. Scopes
billing_read and billing_write.Health
Public liveness and readiness checks. No credential.
Errors
Every error code, its status, and what to do about it.
OpenAPI document and generated types
Downloadopenapi.json to generate a typed client:
Related
- Quickstart - make your first run in a few minutes.
- Authentication - how keys and session tokens are verified, and what each failure means.
- Idempotency - design keys and retry loops that never double-charge.
- Errors - every code the API returns, with the fix for each.
- API conventions - the formats and rules shared by every endpoint, in more depth.