跳转到内容

Chat Completions

POST /v1/chat/completions  compatible  语义操作 generate  契约修订 1

状态语义:stateless

逐条来自契约,不是补充说明:

  • gateway routes model names; provider-owned chat state is not exposed
  • unknown request fields are rejected before provider I/O
  • provider-specific unsupported fields are rejected before provider I/O
Terminal window
curl https://halro.example.com/v1/chat/completions \
-H "Authorization: Bearer $HALRO_GATEWAY_KEY" \
-H "Content-Type: application/json" \
-d '{ "model": "chat", "max_tokens": 256,
"messages": [{"role": "user", "content": "你好"}] }'
  • Authorization
  • Content-Type
字段不支持该字段的 Provider Profile组合级限制
model
messages
messages[].nameanthropic.messages.2023-06-01gemini.generate-content.text.v1betabedrock.runtime.converse.text.v1bedrock.mantle.anthropic.messages.v1
stream1 见脚注 1
stream_options
temperature
top_p
max_tokens2 见脚注 2
max_completion_tokensdeepseek.chat.v13 见脚注 3
nanthropic.messages.2023-06-01deepseek.chat.v1bedrock.runtime.converse.text.v1bedrock.mantle.openai.responses.v1bedrock.mantle.anthropic.messages.v14 见脚注 4
stopbedrock.mantle.openai.responses.v1
seedanthropic.messages.2023-06-01deepseek.chat.v1gemini.generate-content.text.v1betabedrock.runtime.converse.text.v1bedrock.mantle.openai.responses.v1bedrock.mantle.anthropic.messages.v1
toolsgemini.generate-content.text.v1betabedrock.runtime.converse.text.v15 见脚注 5
tool_choicegemini.generate-content.text.v1betabedrock.runtime.converse.text.v1
parallel_tool_callsdeepseek.chat.v1gemini.generate-content.text.v1betabedrock.runtime.converse.text.v16 见脚注 6
response_formatanthropic.messages.2023-06-01deepseek.chat.v1gemini.generate-content.text.v1betabedrock.runtime.converse.text.v1bedrock.mantle.anthropic.messages.v17 见脚注 7
reasoning_effortanthropic.messages.2023-06-01deepseek.chat.v1gemini.generate-content.text.v1betabedrock.runtime.converse.text.v1bedrock.mantle.openai.responses.v1bedrock.mantle.anthropic.messages.v18 见脚注 8
useranthropic.messages.2023-06-01gemini.generate-content.text.v1betabedrock.runtime.converse.text.v1bedrock.mantle.anthropic.messages.v1

id object created model choices usage

chat.completion.chunk [DONE] error

可路由的 Provider Profile 及各自成熟度

Section titled “可路由的 Provider Profile 及各自成熟度”
Provider Profile成熟度不支持的请求字段
openai.chat-embeddings.v1compatible未声明
anthropic.messages.2023-06-01compatiblemessages[].namenseedresponse_formatreasoning_effortuser
azure-openai.chat-embeddings.v1compatible未声明
deepseek.chat.v1compatiblenseedmax_completion_tokensparallel_tool_callsresponse_formatreasoning_effort
openai-compatible.chat-embeddings.v1compatible未声明
gemini.generate-content.text.v1betacompatiblemessages[].nameseedtoolstool_choiceparallel_tool_callsresponse_formatreasoning_effortuser
bedrock.runtime.converse.text.v1compatiblemessages[].namenseedtoolstool_choiceparallel_tool_callsresponse_formatreasoning_effortuser
bedrock.mantle.openai.chat.v1compatible未声明
bedrock.mantle.openai.responses.v1compatiblenstopseedreasoning_effort
bedrock.mantle.anthropic.messages.v1compatiblemessages[].namenseedresponse_formatreasoning_effortuser
anthropic.messages.2023-06-01
  • portable Chat content is mapped to Anthropic Messages blocks
  • response_format and reasoning_effort are declared unsupported at field granularity because support is value-dependent: json_schema maps to output_config.format and the low/medium/high/xhigh/max ladder maps to output_config.effort, while json_object and any effort outside that ladder have no Anthropic representation and are routed away before provider I/O
deepseek.chat.v1
  • DeepSeek speaks this wire format but accepts a smaller member list, so the fields it has no place for are rejected before provider I/O rather than sent and ignored
  • user is carried as DeepSeek’s user_id
  • reasoning_effort and response_format are declared unsupported at field granularity because support is value-dependent: none maps to thinking.type=disabled and the low and high rungs map to thinking.reasoning_effort with thinking enabled, while minimal, medium and xhigh have no DeepSeek rung; json_object maps to response_format and json_schema has no DeepSeek counterpart
  • max_completion_tokens is value-dependent too: it counts reasoning tokens and DeepSeek’s max_tokens does not, so it is carried as max_tokens on a request with thinking off and rejected before provider I/O on one with thinking on, or on one that already carries max_tokens
  • n and parallel_tool_calls are value-dependent in the same way: n=1 and parallel_tool_calls=true are what omitting the member already means, and only n>1 and a request to run tools one at a time are rejected
gemini.generate-content.text.v1beta
  • developer messages are merged into Gemini system_instruction
bedrock.runtime.converse.text.v1
  • Bedrock stop reasons are normalized to OpenAI finish reasons
bedrock.mantle.openai.responses.v1
  • Chat messages are mapped to stateless Responses input items
  • store=false is always sent upstream
  • streaming requests with tools are rejected before provider I/O
bedrock.mantle.anthropic.messages.v1
  • portable Chat content is mapped to Bedrock Mantle Anthropic Messages blocks

已验证的证据:gateway_contractprovider_transport_fixturesdk_blackbox

openai-goopenai-nodeopenai-python


本页的字段表、覆盖矩阵与偏差列表由 Halro 7117fdc38491 的兼容性契约生成 (scripts/generate-api-pages.mjs,契约摘要 9f8a5c57f76ae870…)。 字段的类型、是否必填与语义说明尚未进入契约,因此本页只列字段名。

  1. stream —— bedrock.mantle.openai.responses.v1:streaming requests with tools are rejected before provider I/O

  2. max_tokens —— deepseek.chat.v1:max_completion_tokens is value-dependent too: it counts reasoning tokens and DeepSeek’s max_tokens does not, so it is carried as max_tokens on a request with thinking off and rejected before provider I/O on one with thinking on, or on one that already carries max_tokens

  3. max_completion_tokens —— deepseek.chat.v1:max_completion_tokens is value-dependent too: it counts reasoning tokens and DeepSeek’s max_tokens does not, so it is carried as max_tokens on a request with thinking off and rejected before provider I/O on one with thinking on, or on one that already carries max_tokens

  4. n —— deepseek.chat.v1:n and parallel_tool_calls are value-dependent in the same way: n=1 and parallel_tool_calls=true are what omitting the member already means, and only n>1 and a request to run tools one at a time are rejected

  5. tools —— deepseek.chat.v1:n and parallel_tool_calls are value-dependent in the same way: n=1 and parallel_tool_calls=true are what omitting the member already means, and only n>1 and a request to run tools one at a time are rejected;bedrock.mantle.openai.responses.v1:streaming requests with tools are rejected before provider I/O

  6. parallel_tool_calls —— deepseek.chat.v1:n and parallel_tool_calls are value-dependent in the same way: n=1 and parallel_tool_calls=true are what omitting the member already means, and only n>1 and a request to run tools one at a time are rejected

  7. response_format —— anthropic.messages.2023-06-01:response_format and reasoning_effort are declared unsupported at field granularity because support is value-dependent: json_schema maps to output_config.format and the low/medium/high/xhigh/max ladder maps to output_config.effort, while json_object and any effort outside that ladder have no Anthropic representation and are routed away before provider I/O

  8. reasoning_effort —— anthropic.messages.2023-06-01:response_format and reasoning_effort are declared unsupported at field granularity because support is value-dependent: json_schema maps to output_config.format and the low/medium/high/xhigh/max ladder maps to output_config.effort, while json_object and any effort outside that ladder have no Anthropic representation and are routed away before provider I/O