AgentRouterDocsStorefront ↗
Menu

Anthropic-compatible API

Run Anthropic-compatible inference with a purchased key

Verify zai/glm-5.3 is offered with anthropic in the current catalog before spending. Set AGENTROUTER_KEY privately. Retain this identity and exact body for retries; generate another identity only for a genuinely new intended request.

HTTP 200 returns an Anthropic-compatible messages object. Purchased keys do not support SSE. Replays return request status, not the original completion. Do not create a fresh identity after an uncertain charge. The native x-api-key header is also supported.

Request

Shell
REQUEST_ID=$(uuidgen)

curl -sS https://api.agentrouter.cc/v1/messages \
  -H "Authorization: Bearer ${AGENTROUTER_KEY:?set your key privately}" \
  -H "Idempotency-Key: $REQUEST_ID" \
  -H 'Content-Type: application/json' \
  -H 'anthropic-version: 2023-06-01' \
  -d '{
    "model": "zai/glm-5.3",
    "max_tokens": 512,
    "stream": false,
    "messages": [{ "role": "user", "content": "Reply with exactly OK." }]
  }'

Expected response

Expected inference result

HTTP 200 returns an Anthropic-compatible message with content and usage. Output can stop at the requested token limit; a successful HTTP response does not guarantee the requested phrase. Purchased keys use non-streaming responses.

Retain the request identity after a timeout or uncertain charge. A replay returns request status, not the original completion; do not generate a new identity merely to retry an uncertain result.