Skip to main content
POST
Claude 聊天

授权

Authorization
string
header
必填

使用 Bearer Token 认证。 格式: Authorization: Bearer sk-xxxxxx

请求头

anthropic-version
string
必填

Anthropic API 版本

示例:

"2023-06-01"

x-api-key
string

Anthropic API Key (可选,也可使用 Bearer Token)

请求体

application/json
model
string
必填
示例:

"claude-3-opus-20240229"

messages
object[]
必填
max_tokens
integer
必填
必填范围: x >= 1
system
cache_control
object
inference_geo
string
temperature
number
必填范围: 0 <= x <= 1
top_p
number
top_k
integer
stream
boolean
stop_sequences
string[]
tools
object[]
tool_choice
object
thinking
object
context_management
object
output_config
object
output_format
object
container
mcp_servers
object[]
metadata
object
speed
enum<string>
可用选项:
standard,
fast
service_tier
enum<string>
可用选项:
auto,
standard_only

响应

200 - application/json

成功创建响应

id
string
type
string
示例:

"message"

role
string
示例:

"assistant"

content
object[]
model
string
stop_reason
enum<string>
可用选项:
end_turn,
max_tokens,
stop_sequence,
tool_use
usage
object