Venice errors & retries
Every Venice endpoint returns one of four error shapes. Knowing which shape you got tells you how to react.
Error body shapes
1. StandardError — simple message
The default shape for 4xx/5xx. Emitted when there's nothing structured to surface.
{ "error": "Unauthorized" }
2. DetailedError — Zod validation failure
Used for some 400 responses on malformed request bodies. When present, details is a Zod format() tree (_errors recursively keyed by field) alongside a flat issues array. Many 400s are plain StandardError without details — always handle both.
{
"error": "Invalid request",
"details": {
"_errors": [],
"messages": { "_errors": ["Field is required"] }
},
"issues": [
{ "code": "invalid_type", "path": ["messages"], "message": "Field is required" }
]
}
Render details / issues to the user so they can fix the input; don't retry — the request shape is wrong.
3. ContentViolationError — 422 content policy
Returned when a prompt trips content policy. suggested_prompt (a model-provided safe alternative) is currently emitted by the audio generation pipeline (/audio/queue, /audio/retrieve); image and video endpoints return { error: "Content policy violation" } without suggested_prompt.
{
"error": "Content policy violation",
"suggested_prompt": "A cinematic instrumental track inspired by stormy weather and dramatic tension."
}
Pattern — when suggested_prompt is present, retry once with prompt = suggested_prompt if the user consents.
4. X402InferencePaymentRequired — 402 on x402 inference calls
Returned only when the caller authenticated with SIWE and has insufficient credit. Discriminated by code: "PAYMENT_REQUIRED".
{
"error": "Payment required",
"code": "PAYMENT_REQUIRED",
"message": "Insufficient x402 balance",
"suggestedTopUpUsd": 10,
"minimumTopUpUsd": 5,
"supportedTokens"
(为兼容发布已截断)