Skip to main content

Errors

Most API failures return an error object:
Not every authentication failure includes type and code. Always branch on the HTTP status first, then use error.code when present.

Stable policy codes

  • trial_model_denied
  • trial_scope_denied
  • scope_denied
  • model_not_in_key_scope
  • model_disabled_for_org
  • insufficient_credits
  • reservation_failed
  • budget_cap_exceeded

Runtime codes

  • context_length_exceeded (400): the prompt is estimated at more than the model’s input window (details.estimated_input, details.input_limit, both in tokens). Shorten the prompt or pick a larger model. Only raised on deployments that enable the pre-check (CONTEXT_LIMIT_REJECT=1 with credit reservation on), for models whose window Prism knows, and only when even a conservative count is more than 5% over; otherwise the provider’s own error is passed through.
  • model_not_found (404): the model id is not in the catalog visible to your key. Not retryable.
  • runtime_target_unavailable (503): the model is configured for the media runtime, which this endpoint does not reach. Not retryable; an operator setting.
  • model_runtime_unconfigured (503): the media line is not configured on this deployment. Not retryable.
  • provider_not_configured (503): the provider behind the model has no credentials on this deployment. Not retryable.

Retry guidance

Retry only idempotent reads and requests that your application can safely deduplicate. Use exponential backoff with jitter for 429 and transient 5xx responses. Do not automatically retry 401, 402, or 403. Log the request ID and error code, but never log the API key, request authorization header, or signed media URLs. อ่านภาษาไทย