Anthropic Messages API

POST /anthropic/v1/messages: the Anthropic Messages format, for Claude Code and Anthropic SDKs.

The Anthropic Messages API, for Claude Code and Anthropic SDKs. Base URL https://api.openscale.so/anthropic.

Endpoint

Create a message

POST https://api.openscale.so/anthropic/v1/messages

The Anthropic Messages API: system prompts, multi-turn messages with text, image, tool_use and tool_result blocks, client tools and tool_choice, extended thinking, stop_sequences and streaming with the standard event sequence. Any claude-* model name runs DeepSeek V4.1 Flash, and the reply echoes the name you sent. Thinking (thinking.type enabled or adaptive, or output_config.effort) turns reasoning on; it comes back as thinking blocks. Anthropic server tools are ignored. Usage reports cache_read_input_tokens for prompt tokens billed at the cached rate. Errors use the Anthropic shape.

Request body

FieldTypeRequiredDescription
modelstringYesA model id from GET /v1/models, or any claude-* name.
max_tokensintegerYes
systemstring or array of objectNo
messagesarray of objectYes
toolsarray of objectNo
tool_choiceobjectNo
thinkingobjectNo
temperaturenumberNo
stop_sequencesarray of stringNo
streambooleanNoDefault false.

Example request

bash
curl https://api.openscale.so/anthropic/v1/messages \
  -H "x-api-key: $OPENSCALE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "claude-sonnet-4-5",
  "max_tokens": 1024,
  "messages": [
    {
      "role": "user",
      "content": "Hello from OpenScale"
    }
  ]
}'

Response

200: The message, or an SSE stream when stream is true: message_start, content_block_start, content_block_delta, content_block_stop, message_delta and message_stop.

json
{
  "id": "msg_example",
  "type": "message",
  "role": "assistant",
  "model": "claude-sonnet-4-5",
  "content": [
    {
      "type": "text",
      "text": "Hello!"
    }
  ],
  "stop_reason": "end_turn",
  "stop_sequence": null,
  "usage": {
    "input_tokens": 9,
    "cache_read_input_tokens": 0,
    "output_tokens": 3
  }
}

Errors

StatusMeaning
400Invalid request. A prompt that does not fit says prompt is too long.
401Missing or invalid API key.
402Empty balance, or the key reached its spend limit.
429Rate limit crossed or model at capacity.
529The model is temporarily overloaded.

More of the API reference

  • API reference: base URLs, authentication and a first request.
  • Chat Completions: POST /v1/chat/completions: the OpenAI Chat Completions format, streamed or not, with reasoning and tools.
  • Responses: POST /v1/responses: the OpenAI Responses format with stored state, background runs and enforced tool rules.
  • Conversations: Keep the turns of a Responses conversation on our side and continue it by id.
  • Prompts: Save instructions, messages and settings once, then use them by id in the Responses API.
  • Models and pricing: Model ids, prices per 1M tokens, context windows, output limits, versions and the live catalog endpoint.
  • Batch: Upload a JSONL file of chat completions, create a batch and collect the results when it finishes.
  • Errors: The error shape, every status code and code, and which ones to retry.
  • Rate limits: Requests and tokens per minute, how a 429 tells you when to retry, and how to get more.
  • Data retention: What is stored, for how long, how to delete it, and zero data retention.
  • Interactive reference: try every endpoint in the browser.
  • OpenAPI document: the whole API as OpenAPI 3.1.

This page as Markdown: /docs/messages.md