APIs and setup
Anthropic Messages API
The Messages API is Anthropic's API for Claude models: a request sends a model ID, a token limit and a list of user and assistant messages, and the answer is a list of content blocks.
Also called Messages API, Claude API, /v1/messages
Checked November 29, 2026
At a glance
- Endpoint
POST /v1/messages- Made by
- Anthropic, for Claude
- Headers
- The key (
Authorization: Bearerorx-api-key) andanthropic-version - Instructions
- The top-level
systemfield - Output
- Content blocks:
text,thinking,tool_use - On /model
- Base URL
https://api.slashmodel.com, without/v1
It is POST /v1/messages on Anthropic's REST API at https://api.anthropic.com. A request carries the key, in Authorization: Bearer or in the older x-api-key header, and an anthropic-version header; the SDKs send these for you (Anthropic).
How it differs from OpenAI's format
- The app's instructions go in the top-level
systemfield. - An answer is a list of content blocks, such as
text,thinkingandtool_use. Read the answer from thetextblocks. - A tool call arrives as a
tool_useblock withstop_reasontool_use, and its result goes back as atool_resultblock (Anthropic). - An answer cut off by the token limit ends with
stop_reasonmax_tokens(Anthropic). - An error is JSON with
"type": "error", anerrorobject with its owntypeandmessage, and arequest_id(Anthropic).
The Messages API on /model
/model serves /v1/messages in Anthropic's format, which Claude Code calls (Endpoints). Set the Anthropic SDK's base_url to https://api.slashmodel.com, without /v1, because the SDK adds the path itself; any anthropic-version header is accepted (Anthropic SDK).
- Errors come back in Anthropic's format, so the SDK raises its usual exceptions (Errors).
- Images go in as base64; images and documents given as a URL are refused with a 400 (Images).
POST /v1/messages/count_tokenscounts a request's input tokens: exactly for GPT models, as an estimate for the others.- Prompt caching, thinking effort and JSON output work as described in the docs.
curl https://api.slashmodel.com/v1/messages \
-H "x-api-key: $SLASHMODEL_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-5-5",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "Hello!"}]
}'Where it applies on /model
Questions
Do other models use the Messages API?
Some makers accept Anthropic's format for their own models; DeepSeek has an Anthropic-compatible API. On /model, Models on each API lists the models that answer on /v1/messages, and so in Claude Code.
Why does the Anthropic SDK get a 404?
The base URL most likely ends in /v1. The Anthropic SDK adds /v1/messages itself, so its base URL is https://api.slashmodel.com.
Sources
The makers' own pages, each opened on November 29, 2026.