curl --request POST \
--url https://api.tikway.ai/v1/messages \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"model": "claude-sonnet-4-6",
"max_tokens": 1024,
"system": "You are a helpful assistant.",
"messages": [
{
"role": "user",
"content": "Write a short bedtime story about a unicorn."
}
]
}
'{
"id": "msg_013Zva2CMHLNnXjNJJKqJ2EF",
"container": {
"id": "container_011CpZohnwH4vuy7gazohgSP",
"expires_at": "2019-12-27T18:11:19.117Z",
"skills": [
{
"skill_id": "pdf",
"type": "anthropic",
"version": "latest"
}
]
},
"content": [
{
"citations": [
{
"cited_text": "The grass is green. The sky is blue.",
"document_index": 0,
"document_title": "My Document",
"end_char_index": 0,
"file_id": "file_011CNha8iCJcU1wXNR6q4V8w",
"start_char_index": 0,
"type": "char_location"
}
],
"text": "Hi! My name is Claude.",
"type": "text"
}
],
"context_management": {
"applied_edits": [
{
"cleared_input_tokens": 0,
"cleared_tool_uses": 0,
"type": "clear_tool_uses_20250919"
}
]
},
"diagnostics": {
"cache_miss_reason": {
"cache_missed_input_tokens": 0,
"type": "model_changed"
}
},
"model": "claude-opus-5",
"role": "assistant",
"stop_details": {
"category": "cyber",
"explanation": "This request was declined because it conflicts with Anthropic's Usage Policy.",
"fallback_credit_token": "QW50aHJvcGljL0NsYXVkZQ==",
"fallback_has_prefill_claim": true,
"recommended_model": "claude-opus-4-8",
"type": "refusal"
},
"stop_reason": "end_turn",
"stop_sequence": null,
"type": "message",
"usage": {
"cache_creation": {
"ephemeral_1h_input_tokens": 0,
"ephemeral_5m_input_tokens": 0
},
"cache_creation_input_tokens": 2051,
"cache_read_input_tokens": 2051,
"fallback_credit": {
"status": {
"type": "redeemed"
}
},
"inference_geo": "global",
"input_tokens": 2095,
"iterations": [
{
"cache_creation": {
"ephemeral_1h_input_tokens": 0,
"ephemeral_5m_input_tokens": 0
},
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 0,
"input_tokens": 0,
"model": "claude-fable-5-1",
"output_tokens": 0,
"type": "message"
}
],
"output_tokens": 503,
"output_tokens_details": {
"thinking_tokens": 0
},
"server_tool_use": {
"web_fetch_requests": 2,
"web_search_requests": 0
},
"service_tier": "standard",
"speed": "standard"
},
"input_transformations": [
{
"path": "path",
"reason": "model_binding_mismatch",
"type": "thinking_dropped"
}
]
}Messages
curl --request POST \
--url https://api.tikway.ai/v1/messages \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"model": "claude-sonnet-4-6",
"max_tokens": 1024,
"system": "You are a helpful assistant.",
"messages": [
{
"role": "user",
"content": "Write a short bedtime story about a unicorn."
}
]
}
'{
"id": "msg_013Zva2CMHLNnXjNJJKqJ2EF",
"container": {
"id": "container_011CpZohnwH4vuy7gazohgSP",
"expires_at": "2019-12-27T18:11:19.117Z",
"skills": [
{
"skill_id": "pdf",
"type": "anthropic",
"version": "latest"
}
]
},
"content": [
{
"citations": [
{
"cited_text": "The grass is green. The sky is blue.",
"document_index": 0,
"document_title": "My Document",
"end_char_index": 0,
"file_id": "file_011CNha8iCJcU1wXNR6q4V8w",
"start_char_index": 0,
"type": "char_location"
}
],
"text": "Hi! My name is Claude.",
"type": "text"
}
],
"context_management": {
"applied_edits": [
{
"cleared_input_tokens": 0,
"cleared_tool_uses": 0,
"type": "clear_tool_uses_20250919"
}
]
},
"diagnostics": {
"cache_miss_reason": {
"cache_missed_input_tokens": 0,
"type": "model_changed"
}
},
"model": "claude-opus-5",
"role": "assistant",
"stop_details": {
"category": "cyber",
"explanation": "This request was declined because it conflicts with Anthropic's Usage Policy.",
"fallback_credit_token": "QW50aHJvcGljL0NsYXVkZQ==",
"fallback_has_prefill_claim": true,
"recommended_model": "claude-opus-4-8",
"type": "refusal"
},
"stop_reason": "end_turn",
"stop_sequence": null,
"type": "message",
"usage": {
"cache_creation": {
"ephemeral_1h_input_tokens": 0,
"ephemeral_5m_input_tokens": 0
},
"cache_creation_input_tokens": 2051,
"cache_read_input_tokens": 2051,
"fallback_credit": {
"status": {
"type": "redeemed"
}
},
"inference_geo": "global",
"input_tokens": 2095,
"iterations": [
{
"cache_creation": {
"ephemeral_1h_input_tokens": 0,
"ephemeral_5m_input_tokens": 0
},
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 0,
"input_tokens": 0,
"model": "claude-fable-5-1",
"output_tokens": 0,
"type": "message"
}
],
"output_tokens": 503,
"output_tokens_details": {
"thinking_tokens": 0
},
"server_tool_use": {
"web_fetch_requests": 2,
"web_search_requests": 0
},
"service_tier": "standard",
"speed": "standard"
},
"input_transformations": [
{
"path": "path",
"reason": "model_binding_mismatch",
"type": "thinking_dropped"
}
]
}授权
Tikway API Key。按 Anthropic 原生协议通过 x-api-key 请求头传递。
请求体
用于生成消息的 Claude 模型 ID,例如 claude-opus-5。
生成内容的最大词元数。模型可在达到上限前停止;设为 0 可仅预热提示词缓存而不生成回复。
x >= 0系统提示词。Messages API 不支持 system 角色消息,应使用此字段。
是否以 Server-Sent Events 流式返回消息事件。
自定义停止序列;模型生成到任一序列时停止。
采样温度。较高值使输出更随机;通常与 top_p、top_k 二选一调整。
0 <= x <= 1核采样阈值。
0 <= x <= 1每步采样时保留的最高概率候选词元数。
x >= 0可供 Claude 调用的工具定义。
Hide child attributes
Hide child attributes
服务层级选择。
auto, standard_only 推理速度模式。
standard, fast 代码执行容器配置或容器 ID。
上下文管理配置。
诊断信息配置。
回退服务抵扣令牌。
模型回退配置。
推理地域偏好。
响应
消息唯一 ID。
对象类型,固定为 message。
message 消息角色,固定为 assistant。
assistant 实际使用的 Claude 模型 ID。
Claude 生成的内容块列表。
Hide child attributes
Hide child attributes
输出内容块类型。
text, thinking, redacted_thinking, tool_use, server_tool_use, web_search_tool_result, web_fetch_tool_result, code_execution_tool_result text 内容块的生成文本。
文本引用列表。
Hide child attributes
Hide child attributes
引用类型。
被引用文本。
源文档索引。
源文档标题。
扩展思考文本。
思考内容签名;下轮回传时必须保持原样。
redacted_thinking 的加密数据。
工具调用 ID。
被调用工具名称。
工具调用输入参数。
服务器工具调用结果内容。
关联的工具调用 ID。
服务器工具结果是否出错。
生成停止原因。
end_turn, max_tokens, stop_sequence, tool_use, pause_turn, refusal, model_context_window_exceeded 计费与限流词元使用统计。
Hide child attributes
Hide child attributes
输入词元数。
x >= 0输出词元数。
x >= 0创建缓存所用输入词元数。
x >= 0从缓存读取的输入词元数。
x >= 0实际服务层级。
standard, priority, batch 实际推理速度。
standard, fast 若因自定义停止序列结束,则为命中的序列。
服务端应用的上下文管理结果。
诊断信息,例如缓存未命中原因。