跳转到主要内容
POST
/
v1
/
messages
curl --request POST \
  --url https://api.shuyou.ai/v1/messages \
  --header 'Content-Type: application/json' \
  --header 'anthropic-version: <anthropic-version>' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "model": "anthropic/claude-sonnet-4.6",
  "max_tokens": 1024,
  "messages": [
    {
      "role": "user",
      "content": "Hello, Claude"
    }
  ]
}
'
{
  "id": "msg_example",
  "type": "message",
  "role": "assistant",
  "model": "anthropic/claude-sonnet-4.6",
  "content": [
    {
      "type": "text",
      "text": "Hello! How can I help you today?"
    }
  ],
  "stop_reason": "end_turn",
  "stop_sequence": null,
  "usage": {
    "input_tokens": 12,
    "output_tokens": 15
  }
}

授权

x-api-key
string
header
必填

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

请求头

anthropic-version
string
必填

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

示例:

"2023-06-01"

anthropic-beta
string

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

请求体

application/json
model
string
必填

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

示例:

"anthropic/claude-sonnet-4.6"

max_tokens
integer
必填

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

必填范围: x >= 1
示例:

1024

messages
object[]
必填

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
已弃用

Not supported on ShuYou.

stop_sequences
string[]

Custom sequences that stop generation (stop_reason: stop_sequence).

stream
boolean
默认值:false

Stream the response via server-sent events.

temperature
number
默认值:1

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

必填范围: 0 <= x <= 1
top_p
number

Nucleus sampling. Prefer tuning either temperature or top_p.

必填范围: 0 <= x <= 1
top_k
integer

Sample only from the top K tokens (advanced).

必填范围: 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>
已弃用

Not supported on ShuYou.

可用选项:
auto,
standard_only

响应

Message object, or SSE stream when stream is true

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