RuntokenDocs

Anthropic Messages

Revision 1 · Updated 2026-11-12 · 1 min read

Call the native Anthropic Messages interface through Runtoken.

Prerequisites#

Before you start, prepare:

  • A platform API key created in the console.
  • The exact ID of a model using Anthropic Messages.
  • A server-side HTTP environment that can send the required headers.

Endpoint and authentication#

Use your platform key in x-api-key and include anthropic-version.

POST/v1/messages

This example uses anthropic-version: 2023-06-01 and sends JSON to https://api.runtoken.net.

Send a request#

Send a user message, specify an output token budget with max_tokens, and enable streaming.

Stream a messagebash
curl -N 'https://api.runtoken.net/v1/messages' \
  -H 'x-api-key: YOUR_PLATFORM_KEY' \
  -H 'anthropic-version: 2023-06-01' \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "YOUR_MODEL_ID",
    "max_tokens": 256,
    "messages": [{ "role": "user", "content": "Hello!" }],
    "stream": true
  }'

Replace these placeholders before running the example.

PlaceholderReplace with
YOUR_PLATFORM_KEYYour platform API key from the console.
YOUR_MODEL_IDA model ID that uses Messages.

max_tokens is set to 256 for this example. It is the output token budget for this request, not a platform limit.

Manage the conversation#

Retain the conversation in your application and submit the messages needed for each turn. Inference is stateless.

Read the stream as Messages protocol data. Do not assume that it has the same event structure as Chat Completions.

Model-specific options#

Confirm support before adding image inputs, tools, extended reasoning or additional protocol headers. The version header in the example does not establish support for every feature of the native API.

Handle interrupted output#

The platform can switch channels before output begins, but never after it starts. If a stream is interrupted, keep what you received and decide whether to make a new request. Interrupted streams may require billing review.

Next steps#

See Gemini v1beta for another native protocol, or return to the integration guide for the endpoint overview.

Was this page helpful?