Skip to content
Docs

Messages (v1/messages)

Pass-through endpoint for Anthropic Messages API requests.

Endpoint

http
1POST /v1/messages2Content-Type: application/json

Request example

bash
1curl "$UNI_API_BASE_URL/messages?beta=true" \2  -H "Authorization: Bearer $UNI_API_KEY" \3  -H "Content-Type: application/json" \4  -H "anthropic-version: 2023-06-01" \5  -d '{6    "model": "claude-sonnet-4-6",7    "max_tokens": 128,8    "messages": [{"role":"user","content":"Hello"}]9  }'

Pass-through behavior

Uni API forwards the request body, compatible headers, and query string upstream, then returns the upstream response body unchanged. The gateway still authenticates your Uni API key and records usage.

Usage accounting

  • Claude input_tokens, cache_creation_input_tokens, and cache_read_input_tokens are counted as input tokens.
  • cache_read_input_tokens are recorded as cached tokens.