跳转到内容

协议

ProxAI 协议取值的统一参考:是什么、用在哪里、支持哪些转换对。Provider 名字只是用户标签,protocol 取值才是语义标识。

协议取值Wire 协议请求 path
openai_responsesOpenAI Responses API/v1/responses
openai_chat_completionsOpenAI Chat Completions API/v1/chat/completions
anthropic_messagesAnthropic Messages API/v1/messages
配置 / phase 位置接受的取值说明
`routing.default_provider_names.<key>`三个协议取值之一key 是入站请求协议,value 是 provider 名称。
`[[routing.routes]].request_protocol`可选,三个取值之一可选入站协议保护条件;省略表示匹配任意入站协议。
`[providers.<name>].protocol`三个协议取值之一决定出站 wire 格式并选择转换 pair。
`inbound_request.protocol`由请求 path 检测由 ingress 设置,不直接配置。
`provider_request.protocol`等于选中 provider 的 protocolrouting 选定 provider 后设置。
`upstream_response.protocol`等于 provider protocol由 provider 实现决定。
`outbound_response.protocol`等于入站请求协议translation 还原成客户端协议。
入站 \ ProviderResponsesChatAnthropic
openai_responses透传支持支持
openai_chat_completions不支持透传支持
anthropic_messages支持不支持透传

其他所有协议对都会显式失败。刻意未支持的典型 pair:

  • anthropic_messagesopenai_chat_completions
  • openai_chat_completionsopenai_responses

每新增一个 pair 都要补齐 runtime 路由、请求/响应转换、流式转换和聚焦测试。路由规则实现了 行为契约 C7–C10

src/translation/<inbound_protocol>/to_<provider_protocol>/

示例:

src/translation/openai_responses/to_anthropic_messages/
src/translation/anthropic_messages/to_openai_responses/
src/translation/openai_chat_completions/to_anthropic_messages/

转换设计规则见 协议转换