Skip to main content

Messages API (Anthropic-compatible)

POST https://gateway.primexos.com/v1/messages

The Anthropic Messages API format is used by the Anthropic SDK, Claude Code, and Cline. Note the base URL has no /v1 prefix on its own; the SDK appends /v1/messages.

Anthropic-compatible

Accepts the standard Anthropic Messages parameters. Primex differences: authenticate with your prx- key (x-api-key: prx-… or Authorization: Bearer prx-…), set model to a Primex model ID, and see Errors & Limits for status codes.

Request​

curl https://gateway.primexos.com/v1/messages \
-H "x-api-key: prx-YOUR_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-opus-4-8",
"max_tokens": 512,
"messages": [{"role": "user", "content": "Hello, Claude via Primex."}]
}'

Supported models​

Use any enabled Anthropic model returned by the live catalogue.

note

Claude Code and the Anthropic format are Claude-only. To use GPT / Grok / DeepSeek etc., use the OpenAI-compatible endpoint with Cursor, Windsurf, Codex, or the OpenAI SDK.

Token counting​

POST /v1/messages/count_tokens is supported for pre-flighting request sizes, mirroring the Anthropic API.

Response​

{
"id": "msg_…",
"type": "message",
"role": "assistant",
"model": "claude-opus-4-8",
"content": [{"type": "text", "text": "Hello! …"}],
"usage": {"input_tokens": 12, "output_tokens": 9}
}

See Client Setup → Claude Code for the CLI workflow.