Stateless OnlyThis API is stateless - each request is independent and no conversation state is persisted between requests. You must include the full conversation history in each request.
Error Response Format
All errors follow this structure:Error Codes
The API uses the following error codes:| Code | Description | Equivalent HTTP Status |
|---|---|---|
invalid_prompt | Request or prompt validation failed (context length exceeded, invalid request fields) | 400 |
rate_limit_exceeded | Too many requests | 429 |
image_content_policy_violation | Input or output flagged by a content filter | 400 |
server_error | Internal server error, authentication failure, provider overloaded/unavailable, or timeout | 500+ |
context_length_exceeded and invalid_request both surface as invalid_prompt here.
Canonical error_type Field
Because the native error.code vocabulary is lossy (many distinct errors collapse to server_error), failed responses also include a top-level error_type field that carries the precise canonical error type:
error_type value matches one of the typed error codes and is stable across all OpenRouter API formats. Use it to programmatically distinguish error categories when the native code is ambiguous.