Skip to main content
When something goes wrong, Piramyd always returns a consistent JSON error shape regardless of which endpoint you called, which model you targeted, or whether the fault originated in Piramyd itself or an upstream provider. Familiarise yourself with these shapes and status codes once, and your error-handling code will work uniformly across the entire API.

Error Response Shape (non-streaming)

Every non-streaming error is a JSON object with a single top-level error key. The four fields below are always present.

Streaming Error Shape

Errors that occur mid-stream — after the HTTP connection has already opened and SSE chunks have started flowing — arrive as a data event rather than an HTTP error status. Parse every data: line for an error key and surface it to your users immediately.
Streaming errors include a request_id field that non-streaming errors do not. Always log this value — it is the fastest way to get support on a specific failed request.

HTTP Status Code Reference

402 and 403 do not indicate that you have exhausted a free-tier USD budget — there is no free forever tier. A 402 means your account has a billing issue; a 403 means your subscription plan does not include access to the requested model or feature. Resolve both at dash.piramyd.cloud.

Common Error Codes

rate_limit_exceeded — 429

Your API key has exceeded its requests-per-minute (RPM) allowance. Tokens are unlimited on paid plans; RPM is the only throughput constraint. Retry with exponential backoff and always honour the Retry-After header included in the response.

context_length_exceeded

The conversation history is too long for the model’s context window. If you include a thread_id (or conversation_id) in your request, the API automatically retries once after compacting older messages into a structured summary — no action required on your side. Without a thread_id, you must shorten your message history yourself before retrying.

image_input_not_supported — 400

You sent an image in the request but the selected model does not support vision input. Check the model’s supports_vision field from GET /v1/models and select a vision-capable model before retrying.

context_too_large — 413

Applies to System One (/v1/systemone) only. Your request exceeded the 64 k-token limit (state + all questions). There is no automatic compaction for System One — shrink your state field and retry.

model_not_found — 404

The model ID you provided does not exist or is not visible on your current tier. Always discover model IDs dynamically via GET /v1/models rather than hardcoding them.

not_implemented — 501

Returned by the /v1/moderations endpoint, which is present for SDK compatibility but not yet active. Do not rely on it for safety filtering.

finish_reason Values

The finish_reason field on a completion choice tells you why the model stopped generating.