API reference

API reference · Keys

Set a key's policy

PATCH/api/keys/{id}/policySigned in session

Daily and monthly budgets in micro USD, a requests per day ceiling, a model allowlist and blocklist, a per request cost ceiling, an output token ceiling, the wires the key may use, and the comparable fallback. Send only the fields to change; null clears one. A key that hits a limit answers 429 or 403 with the policy_exceeded type and starts working again when the window rolls over. Every guardrail is enforced on every wire the key can use, batch lines included; x402 requests carry no key and no policy.

Parameters

Path and query parameters
FieldTypeWhat it is
id (path)requiredintegerThe key id.

Request body

application/json, required

Request body fields
FieldTypeWhat it is
dailyBudgetMicrosinteger or nullMicro USD. Null means unlimited.
monthlyBudgetMicrosinteger or nullMicro USD. Null means unlimited.
requestsPerDayinteger or nullNull means unlimited.
modelAllowlistarray of string or null
maxCostPerRequestMicrosinteger or nullMicro USD. A request whose worst case (prompt estimate plus max_tokens at the catalog's prices, across its whole fallback chain) is over this is refused before dispatch with 403 request_cost_exceeded, and so is one naming a model with no published price. On the image and audio doors the worst case is the hold that request would place. Null means unlimited.
maxOutputTokensinteger or nullmax_tokens is lowered to this, below the deployment ceiling, and x-antimatter-route-warning says so. Null means the deployment ceiling.
modelBlocklistarray of string or nullIds this key never reaches: named, they are refused (or dropped from the models chain, with a warning); routed, autopilot never picks them.
allowedWiresarray of string or nullThe wires this key may use. A batch line is held to batch, whatever its url; images is /v1/images/generations and audio is both /v1/audio/speech and /v1/audio/transcriptions. Null means every wire; a refusal is 403 policy_violation.
comparableFallbackbooleanFall back to the nearest comparable, no dearer world on a retriable failure, as x-antimatter-fallback: comparable does per request. x-antimatter-fallback: off turns it off for one request.
strictJsonbooleanCheck every JSON answer (a response_format of json_object or json_schema) before it is handed over and repair it once, as x-antimatter-json: strict does per request; such a request may not stream. x-antimatter-json: off turns it off for one request.
compressstring or nullCompress every request the key sends, as x-antimatter-compress does per request. Null is off; x-antimatter-compress: off turns it off for one request. One of "safe", "aggressive".
marketplaceOffbooleanKeep every request this key sends on the house route: no inference marketplace provider is ever a candidate for it, whatever its price.
piiRedactstring or nullReplace emails, phone numbers, Luhn checked card numbers, IBANs and US and UK government ids in every message with typed placeholders before the request leaves. restore also puts the values back into the answer. Null is off. The answer says how many in x-antimatter-pii-redacted. One of "redact", "restore".
autoCacheboolean or nullAutomatic prompt caching. True places cache markers on a prompt's repeated start (the system prompt and tools, or the conversation so far) for worlds that take them; false never does; absent or null follows the deployment. x-antimatter-auto-cache: on or off decides for one request.
hedgeMsinteger or nullHedged requests: when the first source has sent no byte in this many milliseconds, a second source of the same world at the same card is asked and the first answer wins. Needs hedgeMaxMicros. x-antimatter-hedge decides per request.
hedgeMaxMicrosinteger or nullThe most a hedge's cancelled loser may add to a request's charge (its prompt bound at the card), in micro dollars. A hedge that could cost more is never sent.
coalescebooleanIdentical requests from this key's account in flight at once share one upstream call. Each is billed as if it were alone, unless the deployment states a shared discount; the answer says x-antimatter-coalesced.

Example

{}

Answer 200

The stored policy.

Fields of the 200 answer
FieldTypeWhat it is
policyKeyPolicy
policy.dailyBudgetMicrosinteger or nullMicro USD. Null means unlimited.
policy.monthlyBudgetMicrosinteger or nullMicro USD. Null means unlimited.
policy.requestsPerDayinteger or nullNull means unlimited.
policy.modelAllowlistarray of string or null
policy.maxCostPerRequestMicrosinteger or nullMicro USD. A request whose worst case (prompt estimate plus max_tokens at the catalog's prices, across its whole fallback chain) is over this is refused before dispatch with 403 request_cost_exceeded, and so is one naming a model with no published price. On the image and audio doors the worst case is the hold that request would place. Null means unlimited.
policy.maxOutputTokensinteger or nullmax_tokens is lowered to this, below the deployment ceiling, and x-antimatter-route-warning says so. Null means the deployment ceiling.
policy.modelBlocklistarray of string or nullIds this key never reaches: named, they are refused (or dropped from the models chain, with a warning); routed, autopilot never picks them.
policy.allowedWiresarray of string or nullThe wires this key may use. A batch line is held to batch, whatever its url; images is /v1/images/generations and audio is both /v1/audio/speech and /v1/audio/transcriptions. Null means every wire; a refusal is 403 policy_violation.
policy.comparableFallbackbooleanFall back to the nearest comparable, no dearer world on a retriable failure, as x-antimatter-fallback: comparable does per request. x-antimatter-fallback: off turns it off for one request.
policy.strictJsonbooleanCheck every JSON answer (a response_format of json_object or json_schema) before it is handed over and repair it once, as x-antimatter-json: strict does per request; such a request may not stream. x-antimatter-json: off turns it off for one request.
policy.compressstring or nullCompress every request the key sends, as x-antimatter-compress does per request. Null is off; x-antimatter-compress: off turns it off for one request. One of "safe", "aggressive".
policy.marketplaceOffbooleanKeep every request this key sends on the house route: no inference marketplace provider is ever a candidate for it, whatever its price.
policy.piiRedactstring or nullReplace emails, phone numbers, Luhn checked card numbers, IBANs and US and UK government ids in every message with typed placeholders before the request leaves. restore also puts the values back into the answer. Null is off. The answer says how many in x-antimatter-pii-redacted. One of "redact", "restore".
policy.autoCacheboolean or nullAutomatic prompt caching. True places cache markers on a prompt's repeated start (the system prompt and tools, or the conversation so far) for worlds that take them; false never does; absent or null follows the deployment. x-antimatter-auto-cache: on or off decides for one request.
policy.hedgeMsinteger or nullHedged requests: when the first source has sent no byte in this many milliseconds, a second source of the same world at the same card is asked and the first answer wins. Needs hedgeMaxMicros. x-antimatter-hedge decides per request.
policy.hedgeMaxMicrosinteger or nullThe most a hedge's cancelled loser may add to a request's charge (its prompt bound at the card), in micro dollars. A hedge that could cost more is never sent.
policy.coalescebooleanIdentical requests from this key's account in flight at once share one upstream call. Each is billed as if it were alone, unless the deployment states a shared discount; the answer says x-antimatter-coalesced.

Errors

  • 400OpenAI shaped error.
  • 404OpenAI shaped error.

Every error answers in one shape, with its type, code and the field it names. The whole list is in the docs' Errors section.

Antimatter