AgentRouterDocsStorefront ↗
Menu

OpenAI-compatible API

Run OpenAI-compatible inference with a purchased key

Verify zai/glm-5.3 is offered with openai in the current catalog before spending. Set AGENTROUTER_KEY privately. Create one identity per intended request; retain it and the exact body for retries. Do not rerun uuidgen to bypass an uncertain result.

Purchased keys do not support streaming. HTTP 200 returns an OpenAI-compatible completion. Replays return request status, not the original completion. HTTP 401 means an invalid key; 402 means allowance exhausted. Do not create a fresh identity after an uncertain charge.

Request

Shell
REQUEST_ID=$(uuidgen)

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

Expected response

Expected inference result

HTTP 200 returns an OpenAI-compatible completion, with the answer in choices[0].message.content and token counts in usage. The tested request returned OK; model output can vary. A 200 status with no visible answer is not proof of a useful reply. Keep the request identity if the result is uncertain; do not create a new billable request automatically.