{"type":"root","children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"这篇解决什么问题"}]},{"type":"text","value":"：把已经在用别的模型平台的代码迁到 Tare 上，需要改什么、按什么顺序改。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"迁移时不要一次性切全部模型。先完成一条最小链路，再逐步接渠道、路由和告警。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{},"children":[{"type":"text","value":"推荐迁移顺序"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"ol","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"只改 base URL 和 key，先发一条最小 chat 请求。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"确认能拿到 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"gen-..."}]},{"type":"text","value":" 编号并查到成本。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"接入一条 BYOK 渠道。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"为这条渠道录入进价。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"在 Routing 里把一个模型指向这条渠道。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"配置告警和错误处理。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"再迁移更多模型。"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"下图把上面的七个步骤合并为四个阶段。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"img","properties":{"src":"diagram:migrating-order","alt":"推荐迁移顺序：先跑通最小链路，再一批一批搬","data-block":"true"},"children":[]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{},"children":[{"type":"text","value":"从 OpenAI 兼容平台迁移时特别注意"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"Tare 的 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"model"}]},{"type":"text","value":" 是平台侧模型名，不一定等于上游模型名。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"图片接口同时返回长期有效的 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"b64_json"}]},{"type":"text","value":" 和 24 小时失效的 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"url"}]},{"type":"text","value":"。不要持久化临时 URL。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"未识别字段会原样转发给上游；如果上游不支持，返回的是上游错误。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"流式末帧主要用于 usage，不一定有可渲染文本。"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{},"children":[{"type":"text","value":"详细说明"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{},"children":[{"type":"text","value":"从 OpenAI"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"base_url"}]},{"type":"text","value":" 改成 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"https://tare.jamerly.ai/v1"}]},{"type":"text","value":"，key 换成你的 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"ak-…"}]},{"type":"text","value":"。只发标准字段的客户端\n到此就迁完了。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{},"children":[{"type":"text","value":"从别的聚合平台"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"端点为 OpenAI 格式，编号以 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"gen-"}]},{"type":"text","value":" 开头，未识别的请求字段原样转发给上游，不会丢弃，\n多数客户端只需修改 base URL 与 key。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"以下三项行为存在差异，切换前需先确认："}]},{"type":"text","value":"\n"},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"模型名由你定义。"}]},{"type":"text","value":" 在 Routing 页决定 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"GLM 5.1"}]},{"type":"text","value":" 指向谁，不必沿用供应商的命名。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"自有渠道的成本取决于已录入的进价。"}]},{"type":"text","value":" 上游在回包中自报成本时以自报值为准；\n不自报的（多数 BYOK 渠道）按录入的"},{"type":"element","tagName":"a","properties":{"href":"cost-prices"},"children":[{"type":"text","value":"进价"}]},{"type":"text","value":"计算。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"strong","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"/v1/images"}]},{"type":"text","value":" 是 Tare 的图片生成格式。"}]},{"type":"text","value":" 回包里同时有 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"data[].b64_json"}]},{"type":"text","value":" 和 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"data[].url"}]},{"type":"text","value":"：\n"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"b64_json"}]},{"type":"text","value":" 是长期有效的图片字节；"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"url"}]},{"type":"text","value":" 是同一份字节的托管地址，调用后 24 小时失效，\n失效时刻见 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"data[].expires_at"}]},{"type":"text","value":"。需要长期保存时不要持久化 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"url"}]},{"type":"text","value":"，请保存 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"b64_json"}]},{"type":"text","value":"\n或转存到自己的对象存储。请求除了 OpenAI 风格的 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"size"}]},{"type":"text","value":" 之外，还认 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"resolution"}]},{"type":"text","value":"/"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"aspect_ratio"}]},{"type":"text","value":"。\n完整格式见"},{"type":"element","tagName":"a","properties":{"href":"endpoints"},"children":[{"type":"text","value":"接口列表"}]},{"type":"text","value":"。"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"不止 chat 这一个接口："},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"/v1/embeddings"}]},{"type":"text","value":"、"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"/v1/videos/generations"}]},{"type":"text","value":"（异步，见"},{"type":"element","tagName":"a","properties":{"href":"endpoints"},"children":[{"type":"text","value":"接口列表"}]},{"type":"text","value":"）、\n"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"GET /v1/generation"}]},{"type":"text","value":"（按次回查成本与耗时）都存在，chat completions 上还有 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"models"}]},{"type":"text","value":"（备用模型链）\n和 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"provider"}]},{"type":"text","value":"（按次路由偏好）两个请求字段，都在"},{"type":"element","tagName":"a","properties":{"href":"routing"},"children":[{"type":"text","value":"路由"}]},{"type":"text","value":"一节。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{},"children":[{"type":"text","value":"未知字段原样转发的副作用"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"未识别字段原样转发给上游是刻意设计，也是最容易引起意外的地方：传入上游不支持的参数时，返回的是\n"},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"上游的"}]},{"type":"text","value":"报错，不是平台的报错。这一取舍换来的是 "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"cache_control"}]},{"type":"text","value":"、"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"reasoning"}]},{"type":"text","value":"、\n"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"plugins"}]},{"type":"text","value":" 以及供应商后续新增的参数第一天就能用，不用等平台先发版。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{},"children":[{"type":"text","value":"建议的顺序"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"ol","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"一把 key、一个模型、一次调用，先确认链路通。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"接入自有渠道，"},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"在真实流量进来之前录好进价"}]},{"type":"text","value":"。成本事后重建的效果远不如当场记录。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"先把一个模型指向你的渠道，平台那条留在后面备选。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"配好告警和错误处理。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"再迁其余模型。"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{},"children":[{"type":"text","value":"下一步"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"想马上跑通第一条请求：读 "},{"type":"element","tagName":"a","properties":{"href":"quickstart"},"children":[{"type":"text","value":"快速上手"}]},{"type":"text","value":"。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"要接自己的供应商：读 "},{"type":"element","tagName":"a","properties":{"href":"channels"},"children":[{"type":"text","value":"渠道"}]},{"type":"text","value":"、"},{"type":"element","tagName":"a","properties":{"href":"cost-prices"},"children":[{"type":"text","value":"进价"}]},{"type":"text","value":"。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"要配模型路由：读 "},{"type":"element","tagName":"a","properties":{"href":"routing"},"children":[{"type":"text","value":"路由"}]},{"type":"text","value":"。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"想按任务查接口字段：读 "},{"type":"element","tagName":"a","properties":{"href":"endpoints"},"children":[{"type":"text","value":"接口列表"}]},{"type":"text","value":"。"}]},{"type":"text","value":"\n"}]}]}