plaingateway
API reference

Messages

Create an Anthropic-shaped message.

POST /messages is the Anthropic Messages API. It takes model, messages and max_tokens, all required, plus Anthropic fields such as system, tools, thinking, cache_control and stream. Send the key as x-api-key or Authorization: Bearer. anthropic-version and anthropic-beta are passed to Anthropic hosts; the gateway sends anthropic-version: 2023-06-01 when you omit it. A model on a non-Anthropic host is translated to and from chat completions, so Anthropic-only features such as thinking and cache_control need an Anthropic host. Errors use Anthropic's shape; see Errors. The Anthropic SDK base URL is https://api.plaingateway.com/api; the SDK appends /v1/messages. The model must be one an AI provider key serves. Today no key serves an anthropic/ model, so the example uses openai/gpt-5.6-luna, which the gateway translates to chat completions.

Request

sh
curl https://api.plaingateway.com/api/v1/messages \
  -H "Authorization: Bearer $PLAINGATEWAY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "openai/gpt-5.6-luna",
  "max_tokens": 32,
  "messages": [
    {
      "role": "user",
      "content": "Say hello in five words."
    }
  ]
}'

Response

http
HTTP/1.1 200
{
  "id": "msg_6f2d0c5e9a1b4c7d8e3f2a10",
  "type": "message",
  "role": "assistant",
  "container": null,
  "content": [
    {
      "type": "text",
      "text": "Hello there, friend, how are you?",
      "citations": []
    }
  ],
  "model": "openai/gpt-5.6-luna",
  "stop_reason": "end_turn",
  "stop_details": null,
  "stop_sequence": null,
  "usage": {
    "input_tokens": 16,
    "output_tokens": 14,
    "output_tokens_details": {
      "thinking_tokens": 0
    },
    "cache_creation_input_tokens": 0,
    "cache_read_input_tokens": 0,
    "cache_creation": {
      "ephemeral_5m_input_tokens": 0,
      "ephemeral_1h_input_tokens": 0
    },
    "inference_geo": "global",
    "server_tool_use": null,
    "service_tier": "standard",
    "speed": "standard",
    "cost": 2e-05,
    "is_byok": false,
    "cost_details": {
      "upstream_inference_cost": 2e-05,
      "upstream_inference_prompt_cost": 3.2e-06,
      "upstream_inference_completions_cost": 1.68e-05
    }
  },
  "context_management": null,
  "provider": "Azure"
}