{
"type": "message",
"id": "msg_example",
"role": "assistant",
"stop_reason": "end_turn",
"content": [
{
"type": "text",
"text": "Hello."
}
]
}{}API reference
Claude Messages
Create a native Claude message with content blocks and stop reasons.
{
"type": "message",
"id": "msg_example",
"role": "assistant",
"stop_reason": "end_turn",
"content": [
{
"type": "text",
"text": "Hello."
}
]
}{}POST /v1/messages
Send the gateway token through x-api-key and set anthropic-version explicitly. Native requests include model and messages; the example explicitly supplies max_tokens, with system instructions at top-level system. The schema preserves the gateway’s optional budget behavior; actual native provider requests should supply a model-supported budget.
Read nonstreaming content[] and check stop_reason. Values other than end_turn require appropriate handling: tool_use is not a final text answer and max_tokens may indicate truncation. With stream: true, use Claude SSE rather than a Chat / Responses event parser.
The native Claude guide and complete TypeScript example include environment variables, run commands, and failure behavior. Only common text fields are expanded here; native extensions and conversion paths depend on channel support. /v1/messages/count_tokens is not enabled.
Verified revision: d851a5faa49a00abaafd27bf91b311506fbfbc52. Source files are recorded in this operation’s x-source-files.
The Python native SSE and tool-loop example offers text and tool modes, preserving native result association and signatures.
阅读中文
Native cache and reasoning controls
The project DTO represents request-level and content-blockcache_control, plus top-level thinking, output_config, and context_management. Actual support, TTLs, budgets, and modes depend on the channel and model. Claude context_management is a protocol-specific object and is not copied directly during Responses conversion; identical names do not imply equivalent semantics.
Native cache usage may contain usage.cache_read_input_tokens and cache_creation_input_tokens. Caching, reasoning, and compaction state do not automatically increase the model’s context window. Preserve thinking / signature / redacted_thinking continuation items according to the native protocol.
Added fields verified against revision 30a6d88a4.
Prompt caching · Reasoning · Context managementAuthorizations
ClaudeApiKeyBearerAuth
网关令牌 / Gateway token
Headers
适配器缺省版本;建议显式发送 / Adapter fallback version; send explicitly.
Body
application/json
Minimum string length:
1Example:
"YOUR_MODEL_ID"
Minimum array length:
1Show child attributes
Show child attributes
输出预算,实际范围依赖模型;调用原生供应商时应显式设置 / Output budget; model limits apply. Set explicitly for native provider requests.
Required range:
0 <= x <= 1073741823Example:
256
Show child attributes
Show child attributes
原生缓存控制;依赖渠道,TTL 与断点限制不能跨供应商假定一致 / Native cache control; channel dependent, TTL and breakpoint limits vary
Example:
{ "type": "ephemeral" }
原生推理配置;模式与预算由目标模型决定 / Native reasoning configuration; target model determines modes and budgets
原生输出配置,包含条件支持的 effort / Native output configuration, including conditional effort support
Claude 专用上下文编辑对象;Claude 转 Responses 不直接复制 / Claude-specific context editing; not copied directly into Responses