Skip to main content

Basic call

Use POST /v1/messages with an anthropic-messages model. Supply x-api-key, anthropic-version, and an explicit max_tokens limit. For the Python example, first run python -m pip install anthropic. The SDK Base URL is the gateway root without the final /v1.

Streaming and tools

Set stream: true for native Messages events; the Anthropic SDK’s messages.stream exposes text output. Tool calling and multimodal input require compatible models and channels. Do not parse OpenAI events as Messages events. POST /v1/messages/count_tokens requires the channel’s count_tokens capability. Token counting has no generation charge and does not guarantee admission of a subsequent request.

Claude Code

See Claude Code for client configuration. This endpoint does not expose Responses storage or HTTP continuation APIs. Check platform request logs after interruptions to avoid duplicate generation.