迁移自 OpenRouter
请求与响应形状按 OpenRouter 对齐:models 回退列表、reasoning 推理参数、响应顶层 provider 都同名同形,代码基本不用改。需要注意三点。
三处差异
| 差异 | 说明 |
|---|---|
| 模型名 | 去掉供应商前缀:openai/gpt-4o → gpt-4o,deepseek/deepseek-chat → deepseek-chat。以 GET /v1/models 为准,见模型列表。 |
| provider 路由偏好 | OpenRouter 请求体里的 provider: { order, allow_fallbacks, … }、route、transforms 网关不识别,会被丢弃;渠道由网关按权重与健康度选择。 |
| 费用与请求头 | 费用查询同为 GET /api/v1/generation?id=,字段名一致,只是金额为人民币 cost_cny。HTTP-Referer、X-Title 不需要,带上也无害。 |
对照
对照(Python)