curl --request POST \
--url https://api.omniall.ai/v1/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'anthropic-version: <anthropic-version>' \
--data '
{
"model": "claude-sonnet-4",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": "你好,Claude"
}
]
}
'{
"id": "<string>",
"type": "message",
"role": "assistant",
"model": "<string>",
"content": [
{
"type": "<string>",
"text": "<string>",
"name": "<string>",
"input": {}
}
],
"stop_reason": "end_turn",
"usage": {
"input_tokens": 123,
"output_tokens": 123
}
}{
"error": {
"message": "<string>",
"type": "new_api_error",
"code": "<string>"
}
}{
"error": {
"message": "无效的令牌 (request id: ...)",
"type": "new_api_error",
"code": ""
}
}{
"error": {
"message": "<string>",
"type": "new_api_error",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "new_api_error",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "new_api_error",
"code": "<string>"
}
}Claude Messages 对话
Omniall AI 转发的 Anthropic Messages 接口。支持视觉、文档、工具调用与扩展思考。
curl --request POST \
--url https://api.omniall.ai/v1/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'anthropic-version: <anthropic-version>' \
--data '
{
"model": "claude-sonnet-4",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": "你好,Claude"
}
]
}
'{
"id": "<string>",
"type": "message",
"role": "assistant",
"model": "<string>",
"content": [
{
"type": "<string>",
"text": "<string>",
"name": "<string>",
"input": {}
}
],
"stop_reason": "end_turn",
"usage": {
"input_tokens": 123,
"output_tokens": 123
}
}{
"error": {
"message": "<string>",
"type": "new_api_error",
"code": "<string>"
}
}{
"error": {
"message": "无效的令牌 (request id: ...)",
"type": "new_api_error",
"code": ""
}
}{
"error": {
"message": "<string>",
"type": "new_api_error",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "new_api_error",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "new_api_error",
"code": "<string>"
}
}授权
使用来自 https://omniall.ai/dashboard 的 Authorization: Bearer sk-...
请求头
Anthropic API 版本请求头。
"2023-06-01"
可选的 Anthropic 风格 Key(也可用 Bearer)。
请求体
Anthropic Messages 请求体(POST /v1/messages)。必须提供 model、messages、max_tokens。
模型广场中的 Claude 模型 ID。
"claude-sonnet-4"
角色为 user / assistant 的对话轮次。内容可为字符串或内容块(text、
Show child attributes
Show child attributes
Claude 最多可生成的 token。Anthropic 必填;也用于控制成本/延迟。
x >= 1系统提示(字符串或内容块),设定整体行为。
随机性(Claude 为 0–1)。
0 <= x <= 1核采样。
Top-K 采样。
为 true 时流式返回 SSE 事件。
自定义停止字符串。
Claude 工具:自定义工具,和/或模型/渠道启用时的服务端工具(如 web_search)。
工具选择策略。
Show child attributes
Show child attributes
扩展思考控制。
Show child attributes
Show child attributes
使用 Claude MCP 功能时的 MCP 服务器定义。
请求元数据透传。
上下文管理选项(厂商相关)。
支持时的输出配置(如 effort)。
结构化输出格式控制。
支持时的提示缓存控制。
响应
Claude 消息响应(或 SSE 流)。
Anthropic Messages 响应。
消息 ID。
通常为 message。
"message"
通常为 assistant。
"assistant"
所用模型。
内容块(text、tool_use 等)。拼接 text 块得到可见回答。
Show child attributes
Show child attributes
Claude 停止原因:end_turn、max_tokens、stop_sequence、tool_use 等。
end_turn, max_tokens, stop_sequence, tool_use Token 用量。
Show child attributes
Show child attributes