plaingateway
API reference

Errors

Read recorded error bodies and supported statuses.

OpenAI-shaped errors contain error.message, error.code, and optional error.metadata. Messages uses Anthropic type, error, and request_id. The gateway documents 400, 401, 402, 403, 408, 429, 502, and 503; routing exhaustion also returns 404. Recordings for 402, 429, and 502 are missing.

Request

http
POST https://plaingateway.com/api/v1/chat/completions
Authorization: Bearer sk-pg-v1-...
Content-Type: application/json

{
  "model": "openai/gpt-5.6-luna",
  "messages": [
    {
      "role": "user",
      "content": "Say hello in five words."
    }
  ],
  "max_tokens": 32
}

Response

http
HTTP/1.1 401
{
  "error": {
    "message": "User not found.",
    "code": 401
  }
}