Skip to main content
The MetrixLLM gateway returns standard HTTP status codes with structured JSON error bodies. This reference covers all possible error responses.

4xx Client Errors

400 Bad Request

The request body is malformed or contains invalid parameters.
Common causes:
  • Missing required fields (model, messages)
  • Invalid JSON syntax
  • Unsupported parameters for the target provider

401 Unauthorized

The API key is missing, invalid, or has been revoked.
Common causes:
  • Missing Authorization header
  • API key doesn’t start with sk-metrix-
  • API key has been deleted or deactivated
  • Key hash doesn’t match any active key in the database

402 Payment Required

The workspace has insufficient credits or has exceeded its budget cap.
Common causes:
  • Monthly budget cap reached
  • Prepaid credit balance depleted
  • Workspace billing overdue

403 Forbidden

The request is blocked by workspace security policies.
Other 403 variants:

404 Not Found

The requested resource doesn’t exist.
Common causes:
  • Requested endpoint doesn’t exist (e.g. /v1/unknown-endpoint)
  • Batch ID not found in /v1/batches/:id/results

413 Payload Too Large

The request body exceeds the gateway’s 2MB limit.

429 Too Many Requests

A rate limit has been exceeded.
See Rate Limits for full details on rate limit headers and configuration.

5xx Server Errors

500 Internal Server Error

An unexpected error occurred within the gateway.
Error codes:

502 Bad Gateway

The upstream LLM provider returned an invalid response or is unreachable.
Common causes:
  • Provider API returned non-JSON response
  • Network timeout connecting to provider
  • Provider returned an unexpected response format

503 Service Unavailable

All providers in the fallback chain are down or the circuit breaker is open.

Provider-Specific Errors

When a provider returns an error, the gateway forwards it with the original status code:

OpenAI errors

Anthropic errors

Google Gemini errors


Batch API Errors


Circuit Breaker Errors

When a provider experiences repeated failures, the gateway’s circuit breaker activates: The circuit breaker opens after 5 consecutive failures and closes after 3 successful requests.

Error Response Structure

All error responses follow this structure: