Skip to main content
POST

Overview

Anthropic Messages API format, proxied through OpenRouter on ShuYou. Supports text, images, tools, and extended thinking when the upstream model allows it.
Request parameters follow the OpenRouter official API exactly. ShuYou only routes and forwards your request — all client parameters are preserved.
Base URL: https://api.shuyou.ai/openrouter Endpoint: POST /v1/messages Include the anthropic-version header (for example 2023-06-01) as required by the Anthropic Messages specification.

Authorizations

x-api-key
string
header
required

ShuYou API key sent as x-api-key (Anthropic-compatible).

Headers

anthropic-version
string
required

Anthropic API version. Currently only 2023-06-01 is supported.

Example:

"2023-06-01"

anthropic-beta
string

Optional beta features (comma-separated). code-execution-2025-08-25 is not supported on ShuYou.

Body

application/json
model
string
required

Model ID (provider/model_name), e.g. from List Models.

Example:

"anthropic/claude-sonnet-4.6"

max_tokens
integer
required

Maximum tokens to generate (including thinking tokens when enabled).

Required range: x >= 1
Example:

1024

messages
object[]
required

Conversation history. Roles alternate user / assistant; up to 100,000 messages.

Minimum array length: 1
system

System prompt (no system role in messages).

metadata
object
deprecated

Not supported on ShuYou.

stop_sequences
string[]

Custom sequences that stop generation (stop_reason: stop_sequence).

stream
boolean
default:false

Stream the response via server-sent events.

temperature
number
default:1

Sampling temperature (0 = more deterministic, 1 = more creative).

Required range: 0 <= x <= 1
top_p
number

Nucleus sampling. Prefer tuning either temperature or top_p.

Required range: 0 <= x <= 1
top_k
integer

Sample only from the top K tokens (advanced).

Required range: x >= 0
thinking
object

Extended thinking configuration.

tool_choice
object
tools
object[]

Tools the model may call (client tools and supported server tools).

output_config
object

Output configuration such as structured JSON.

cache_control
object
container
string

Container identifier for reuse across requests (e.g. code execution).

inference_geo
string

Geographic region for inference processing.

service_tier
enum<string>
deprecated

Not supported on ShuYou.

Available options:
auto,
standard_only

Response

Message object, or SSE stream when stream is true

id
string
type
enum<string>
Available options:
message
role
enum<string>
Available options:
assistant
model
string
content
object[]
stop_reason
enum<string>
Available options:
end_turn,
max_tokens,
stop_sequence,
tool_use,
pause_turn,
refusal
stop_sequence
string | null
usage
object