> ## Documentation Index
> Fetch the complete documentation index at: https://docs.venice.ai/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> The Venice API is OpenAI-compatible: use any OpenAI SDK with the base URL `https://api.venice.ai/api/v1` and a Venice API key, or pay per request from a USDC wallet through x402 with no account.
> Read model IDs from `GET /models` or `GET /models/traits` at runtime instead of hardcoding them from memory or from these pages. Models are added and retired often.
> Every model's price is in https://docs.venice.ai/pricing.md. Quote video and audio jobs with `POST /video/quote` or `POST /audio/quote` before you queue them.
> Search these docs from an MCP client at https://docs.venice.ai/mcp. The full agent guide is https://docs.venice.ai/agents.md.

# Error Codes

> Venice API error codes: HTTP status codes, error response format, validation details, credit refund status, rate limits, and retry guidance.

When an error occurs, the Venice API returns an HTTP status code and a descriptive message. Some errors also include additional fields, such as refund status, suggested retry models, validation details, or request IDs.

## Error response format

Most errors return an `error` field with a human-readable message:

```json theme={"system"}
{
  "error": "Invalid request parameters"
}
```

Some endpoints include additional fields that are specific to the endpoint. For example, video moderation errors can include whether credits were refunded:

```json theme={"system"}
{
  "error": "Your generation was blocked due to the model provider's content policies. Credits have been refunded.",
  "credits_refunded": true
}
```

Validation errors may include `details` and `issues` fields with field-level validation information:

```json theme={"system"}
{
  "error": "Invalid request parameters",
  "details": {
    "_errors": [],
    "field": {
      "_errors": ["Field is required"]
    }
  },
  "issues": []
}
```

Some OpenAI-compatible endpoints may return OpenAI-style error objects for specific cases, such as context length errors:

```json theme={"system"}
{
  "error": {
    "message": "Your request exceeds the model's maximum context. Please reduce your prompt or completion length.",
    "type": "invalid_request_error",
    "param": "messages",
    "code": "context_length_exceeded"
  }
}
```

## Missing credentials

A request with no credentials returns `402 Payment Required`, not `401`. Most paid routes also accept [x402 wallet authentication](https://docs.venice.ai/guides/integrations/x402-venice-api.md), so the response is a payment challenge: it includes a `PAYMENT-REQUIRED` header and a body describing both ways to authenticate. Video and voice changer routes send the same challenge but currently accept only an API key.

```json theme={"system"}
{
  "x402Version": 2,
  "error": "Authentication required",
  "accepts": [ ... ],
  "authOptions": {
    "apiKey": {
      "header": "Authorization: Bearer YOUR_API_KEY",
      "getKey": "https://venice.ai/settings/api"
    },
    "x402Wallet": {
      "header": "SIGN-IN-WITH-X",
      "topUp": "POST /api/v1/x402/top-up"
    }
  }
}
```

If a `402` on a paid route surprises you, it is usually a missing credentials header rather than a billing problem. A body with `x402Version` and `accepts` means nothing authenticated the request: set `Authorization: Bearer $VENICE_API_KEY` and retry. The `authOptions.apiKey.header` field in the body spells out the exact header shape.

A `402` that says "Insufficient USD or Diem balance" (`INSUFFICIENT_BALANCE` in the table below) is different: that one is the account balance. See [paying for usage](https://docs.venice.ai/pricing#paying-for-usage).

A key that is present but invalid returns `401`.

## Request format errors

These errors come from reading the request body, before any endpoint-specific validation runs.

| HTTP Status | Message | Cause |
| - | - | - |
| 400 | `'Content-Type' must be 'application/json'` | A `POST`, `PUT`, or `PATCH` body sent without `Content-Type: application/json`. Endpoints that take file uploads also accept `multipart/form-data` |
| 400 | `Invalid JSON request` | The body is not valid JSON |
| 400 | `Invalid multipart request: malformed part header` | A `multipart/form-data` body that can't be parsed |
| 413 | `Request body exceeds the maximum allowed size.` | The request body is too large |
| 415 | `Request encoding is not supported` | A `Content-Encoding` or charset the API can't decode |

A wrong `Content-Type` returns `400`, not `415`. Size-limit `413` responses also include a `code` field:

```json theme={"system"}
{
  "code": "PAYLOAD_TOO_LARGE",
  "error": "Request body exceeds the maximum allowed size."
}
```

## Error codes

The codes in this table name each error for reference. Most responses don't include them: the body carries only the message in `error`. The exceptions are `413` responses and x402 wallet errors, which add a `code` field. Branch on the HTTP status, and don't match on the message text, which can vary.

| Error Code | HTTP Status | Message | What to do |
| - | - | - | - |
| `AUTHENTICATION_FAILED` | 401 | Authentication failed | Check the `Authorization: Bearer` header and that the key hasn't been deleted or expired. Account and key-management endpoints answer an Inference key with this code too; use an Admin key there. |
| `AUTHENTICATION_FAILED_INACTIVE_KEY` | 401 | Authentication failed - Pro subscription is inactive. Please upgrade your subscription to continue using the API | The key's account can't use the API. Sign in at venice.ai to check the account, or contact [support@venice.ai](mailto:support@venice.ai). |
| `X402_INVALID_SIGN_IN` | 401 | Invalid Sign-in-with-x signature | Sign a new `SIGN-IN-WITH-X` proof with the nonce from the latest `402` challenge. See [x402](https://docs.venice.ai/guides/integrations/x402-venice-api.md). |
| `X402_USER_NOT_ALLOWED` | 401 | Wallet user is not allowed to authenticate | The wallet's Venice account is banned or deleted, or its credits belong to another user. Use a different wallet. |
| `PRO_ONLY_MODEL` | 401 | This model is only available to Pro users | Use a model your plan includes, or upgrade to a paid plan. |
| `INSUFFICIENT_BALANCE` | 402 | Insufficient USD or Diem balance to complete request. Visit [https://venice.ai/settings/api](https://venice.ai/settings/api) to add credits. | Add credits or stake [DIEM](https://docs.venice.ai/overview/vvv-diem.md), then retry. |
| `API_KEY_DIEM_SPEND_LIMIT_EXCEEDED` | 402 | API key DIEM spend limit exceeded. Your account may still have DIEM balance, but this API key has reached its configured DIEM spending limit. | Raise or remove the key's DIEM limit, or wait for its limit period to reset. |
| `API_KEY_USD_SPEND_LIMIT_EXCEEDED` | 402 | API key USD spend limit exceeded. Your account may still have USD balance, but this API key has reached its configured USD spending limit. | Raise or remove the key's USD limit, or wait for its limit period to reset. |
| `UNAUTHORIZED` | 403 | Unauthorized access | Read the message, which names what blocked the request, such as your region. |
| `API_ACCESS_DISABLED` | 403 | API access has been disabled for this account. Please contact [support@venice.ai](mailto:support@venice.ai) | Contact [support@venice.ai](mailto:support@venice.ai). |
| `X402_WALLET_MISMATCH` | 403 | You can only access resources for your own wallet | Request the balance or transactions of the wallet you signed in with. |
| `INVALID_REQUEST` | 400 | Invalid request parameters | Fix the fields named in `details`, `issues`, or the message. |
| `INVALID_MODEL` | 400 | Invalid model specified | Use a model that supports this endpoint. `GET /models` lists each model's capabilities. |
| `REQUEST_ID_NOT_FOUND` | 400 | Request ID is invalid. | Check that the queue ID and model match a job you queued. |
| `INVALID_AUDIO_FORMAT` | 400 | Invalid audio format. Supported formats are WAV and MP3. | Convert the audio to a format the endpoint accepts. |
| `INVALID_VIDEO_FORMAT` | 400 | Invalid video format. Supported formats include MP4, MOV, WebM, MKV, AVI, and others. | Convert the video to a supported format such as MP4. |
| `CORRUPTED_IMAGE` | 400 | The image file is corrupted or unreadable | Re-encode the image or send a different file. |
| `IMAGE_TOO_SMALL` | 400 | Image dimensions are too small | Send a larger image. |
| `TOO_MANY_TOKENS` | 400 | Your request exceeds the model's maximum context. Please reduce your prompt or completion length. | Shorten the messages or lower `max_tokens`. `GET /models` lists each model's context size. |
| `CHARACTER_NOT_FOUND` | 404 | No character could be found from the provided `character_slug` | Use a slug from [`GET /characters`](https://docs.venice.ai/api-reference/endpoint/characters/list). |
| `MODEL_NOT_FOUND` | 404 | Specified model not found | Use a current ID from `GET /models`. Retired models are listed on [Deprecations](https://docs.venice.ai/overview/deprecations.md). |
| `MEDIA_NOT_FOUND` | 404 | Media could not be found. Request may be invalid, expired, or deleted. | The result expired or was deleted. Queue the job again. |
| `PAYLOAD_TOO_LARGE` | 413 | The request payload is too large. Please reduce the size of your request. | Send a smaller body or file. |
| `INVALID_CONTENT_TYPE` | 415 | Invalid request content-type. Returned only by `/image/multi-edit` | Send `multipart/form-data` or `application/json`. |
| `VIDEO_DURATION_TOO_LONG` | 422 | Video duration exceeds the maximum allowed. | Use a duration the model lists in `GET /models?type=video`. |
| `VIDEO_DURATION_TOO_SHORT` | 422 | Video duration is too short. | Use a duration the model lists in `GET /models?type=video`. |
| `IMAGE_TOO_LARGE` | 422 | Image dimensions exceed the maximum allowed. | Downscale the image. |
| `CONTENT_POLICY_VIOLATION` | 422 | Your prompt violates the content policy of Venice.ai or the model provider | Change the prompt or use another model. Policies vary by model and provider. |
| `ASR_UPSTREAM_VALIDATION_FAILED` | 422 | The audio could not be processed for transcription. Common causes: zero-length, silent, corrupt, or unsupported-language audio. Please verify the file and retry. | Check that the audio isn't empty, silent, or corrupt, and that its language is supported. |
| `RATE_LIMIT_EXCEEDED` | 429 | Rate limit exceeded | Wait until `x-ratelimit-reset-requests`, then retry. See [Rate Limits](https://docs.venice.ai/api-reference/rate-limiting.md). |
| `MODEL_OVERLOADED` | 429 | The model is currently overloaded. Please try again later. | Retry after the `Retry-After` header, or switch models. |
| `INFERENCE_FAILED` | 500 | Inference processing failed | Retry with backoff. Failed requests count toward the [error budget](https://docs.venice.ai/api-reference/rate-limiting.md#error-budgets). |
| `UPSCALE_FAILED` | 500 | Image upscaling failed | Retry with backoff. |
| `IMAGE_EDIT_ERROR` | 500 | Image edit failed | Retry with backoff. |
| `UNKNOWN_ERROR` | 500 | An unknown error occurred | Retry with backoff. If it keeps happening, contact [support@venice.ai](mailto:support@venice.ai). |
| `TEE_ATTESTATION_FAILED` | 502 | TEE attestation request failed. The Trusted Execution Environment provider may be temporarily unavailable. | Retry later. |
| `TEE_SIGNATURE_FAILED` | 502 | TEE signature request failed. The Trusted Execution Environment provider may be temporarily unavailable. | Retry later. |
| `ASR_UPSTREAM_FAILED` | 502 | Audio transcription failed due to a temporary upstream error. Please retry. | Retry the request. |
| `MODEL_OFFLINE` | 503 | The model is temporarily offline. Please try again later. | Retry later or switch models. |
| `MODEL_AT_CAPACITY` | 503 | The model is at capacity. Please try again later. | Retry later or switch models. |
| `REQUEST_TIMEOUT` | 504 | The request took too long to complete and was timed-out. For non-streaming requests, use the streaming API by setting `stream=true`. A streaming chat completion that times out before the model's first chunk reports the failure as an in-band SSE error frame instead. | Set `stream: true`, or send a shorter request. |

## Other errors

The table above is not exhaustive. Some errors are returned without a listed code, and messages can vary by model and endpoint, so branch on the HTTP status rather than on message text. Errors you may see that aren't in the table:

| HTTP Status | When it happens |
| - | - |
| 400 | An image input in a chat or Responses request is in an unsupported format |
| 400 | The requested voice isn't available for the text-to-speech model |
| 403 | The request comes from an IP address that isn't on the API key's allowlist |
| 403 | The requested model isn't permitted by the API key's privacy setting |
| 403 | Access to the requested model is restricted. Contact [support@venice.ai](mailto:support@venice.ai) |
| 409 | A video, music, or voice-changer result is still uploading when you retrieve it. Retry shortly |
| 410 | The endpoint has been retired |
| 422 | Audio is too long or too short (voice cloning, voice changer, and audio jobs) |
| 422 | A video request's input image has a width-to-height ratio outside the range the model accepts |
| 422 | A video request's input was blocked by content moderation |
| 500 | Video or voice-changer generation failed |
| 502 | Speech synthesis failed upstream, or a generated video couldn't be retrieved. Retry the request |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.