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: Bearer or x-api-key) and anthropic-version
Instructions
The top-level system field
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 system field.
  • An answer is a list of content blocks, such as text, thinking and tool_use. Read the answer from the text blocks.
  • A tool call arrives as a tool_use block with stop_reason tool_use, and its result goes back as a tool_result block (Anthropic).
  • An answer cut off by the token limit ends with stop_reason max_tokens (Anthropic).
  • An error is JSON with "type": "error", an error object with its own type and message, and a request_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_tokens counts 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.
A message with curl
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.

One key for every model here.

Top up from $10, change one URL, and pay only for the tokens you use.