{"article":{"title":"Migration","breadcrumb":["Operations","Migration"],"body":"**What this solves**: What you need to change to migrate code that already runs against another model platform over to Tare, and in what order.\n\nDon't switch all your models at once when migrating. Get one minimal path working first, then bring in channels, routing, and alerts step by step.\n\n### Recommended migration order\n\n1. Change only the base URL and key, and send one minimal chat request first.\n2. Confirm you can get a `gen-...` ID and look up the cost.\n3. Add one BYOK channel.\n4. Enter the cost price for this channel.\n5. In Routing, point a model at this channel.\n6. Configure alerts and error handling.\n7. Migrate more models.\n\nThe diagram below merges the seven steps above into four stages.\n\n![Recommended migration order: get one minimal path working first, then move over batch by batch](diagram:en-migrating-order)\n\n### Things to watch out for when migrating from an OpenAI-compatible platform\n\n- Tare's `model` is a platform-side model name, and it isn't necessarily the same as the upstream model name.\n- The images endpoint returns both a long-lived `b64_json` and a `url` that expires after 24 hours. Don't persist the temporary URL.\n- Unrecognized fields are forwarded to the upstream as-is; if the upstream doesn't support them, you get the upstream's error back.\n- The final streaming frame is mainly for usage; it doesn't necessarily have renderable text.\n\n### Details\n\n#### From OpenAI\n\nChange `base_url` to `https://tare.jamerly.ai/v1` and swap the key for your `ak-…`. A client that only sends standard fields is fully migrated at this point.\n\n#### From another aggregation platform\n\nThe endpoint is in OpenAI format, IDs start with `gen-`, and unrecognized request fields are forwarded to the upstream as-is rather than dropped, so most clients only need to change the base URL and key.\n\nThree behaviors differ, so confirm them before switching:\n\n- **The model name is yours to define.** On the Routing page you decide who `GLM 5.1` points to; you don't have to follow the vendor's naming.\n- **The cost of your own channel depends on the cost price you've entered.** When the upstream self-reports the cost in its response, the self-reported value wins; when it doesn't (most BYOK channels), it's computed from the [cost price](cost-prices) you entered.\n- **`/v1/images` is Tare's image-generation format.** The response contains both `data[].b64_json` and `data[].url`: `b64_json` is the image bytes, valid long term; `url` is a hosted address for the same bytes that expires 24 hours after the call, with the expiry time in `data[].expires_at`. When you need to keep it long term, don't persist the `url` — save the `b64_json` or copy it to your own object storage. Besides the OpenAI-style `size`, requests also accept `resolution`/`aspect_ratio`. For the full format see the [Endpoint list](endpoints).\n\nIt's not just chat: `/v1/embeddings`, `/v1/videos/generations` (async, see the [Endpoint list](endpoints)), and `GET /v1/generation` (look up the cost and duration of a call by request) all exist, and chat completions also has the two request fields `models` (backup model chain) and `provider` (per-request routing preference), both in the [Routing](routing) section.\n\n#### The side effect of forwarding unknown fields as-is\n\nForwarding unrecognized fields to the upstream as-is is a deliberate design, and also the most surprising part: when you pass a parameter the upstream doesn't support, you get back the **upstream's** error, not the platform's. What this trade-off buys is that `cache_control`, `reasoning`, `plugins`, and parameters vendors add later work on day one, without waiting for the platform to ship a release first.\n\n#### Recommended order\n\n1. One key, one model, one call — confirm the path works first.\n2. Add your own channel, and **enter the cost price before real traffic arrives**. Reconstructing costs after the fact works far worse than recording them on the spot.\n3. Point one model at your channel first, and keep the platform one as a fallback later.\n4. Set up alerts and error handling.\n5. Then migrate the remaining models.\n\n### Next steps\n\n- To get your first request working right away: read [Quickstart](quickstart).\n- To connect your own provider: read [Channels](channels), [Cost prices](cost-prices).\n- To configure model routing: read [Routing](routing).\n- To look up endpoint fields by task: read the [Endpoint list](endpoints).\n"},"diagrams":{"en-migrating-order":"<svg viewBox=\"0 0 700 430\" width=\"700\" role=\"img\" xmlns=\"http://www.w3.org/2000/svg\">\n  <title>Migrate one small path, then batch by batch</title>\n  <desc>Get one small chat path working, add one BYOK channel and its cost prices, point one model at it in Routing, then configure alerts before moving the rest one batch at a time.</desc>\n  <style>\n    text { font-family: 'PingFang SC', 'Microsoft YaHei', 'Noto Sans CJK SC', system-ui, sans-serif; }\n  </style>\n  <defs>\n    <marker id=\"arrow\" markerWidth=\"8\" markerHeight=\"8\" refX=\"2\" refY=\"4\" orient=\"auto\" markerUnits=\"userSpaceOnUse\">\n      <path d=\"M0,0 L8,4 L0,8 L2,4 z\" fill=\"#64748b\"/>\n    </marker>\n  </defs>\n\n  <!-- 浅色画布 -->\n  <rect x=\"0\" y=\"0\" width=\"700\" height=\"430\" fill=\"#ffffff\"/>\n\n  <!-- 版式算术：\n       四步全宽横条，22..678（宽 656），高 54（12px + 10px），\n       顶边 60 / 142 / 224 / 306，底边 114 / 196 / 278 / 360，步间 28。\n       三段连线全竖直落在内容中心 350，起点 = 上条底边 + 5，终点 = 下条顶边 - 11。\n       内容左右边界 22..678，中心 350；viewBox 宽 = 656 + 两侧各 22 = 700。\n       高度 = 脚注末行基线 405 + 下伸 2.5 + 22px 边距 = 429.5，取整 430。 -->\n\n  <text x=\"350\" y=\"34\" font-size=\"16\" fill=\"#1e293b\" text-anchor=\"middle\">Migrate one small path, then batch by batch</text>\n\n  <path d=\"M350,119 L 350,131\" fill=\"none\" stroke=\"#64748b\" stroke-width=\"1.5\" marker-end=\"url(#arrow)\"/>\n  <path d=\"M350,201 L 350,213\" fill=\"none\" stroke=\"#64748b\" stroke-width=\"1.5\" marker-end=\"url(#arrow)\"/>\n  <path d=\"M350,283 L 350,295\" fill=\"none\" stroke=\"#64748b\" stroke-width=\"1.5\" marker-end=\"url(#arrow)\"/>\n\n  <rect x=\"22\" y=\"60\" width=\"656\" height=\"54\" rx=\"6\" fill=\"#dbeafe\" stroke=\"#3b82f6\"/>\n  <text x=\"350\" y=\"82\" font-size=\"12\" fill=\"#1e40af\" text-anchor=\"middle\">1. Get one small path working</text>\n  <text x=\"350\" y=\"100\" font-size=\"10\" fill=\"#1e40af\" text-anchor=\"middle\">Change only base URL and key. Send one small chat. Confirm a gen-… id and its cost.</text>\n\n  <rect x=\"22\" y=\"142\" width=\"656\" height=\"54\" rx=\"6\" fill=\"#fef3c7\" stroke=\"#f59e0b\"/>\n  <text x=\"350\" y=\"164\" font-size=\"12\" fill=\"#b45309\" text-anchor=\"middle\">2. Add one BYOK channel, enter prices if needed</text>\n  <text x=\"350\" y=\"182\" font-size=\"10\" fill=\"#b45309\" text-anchor=\"middle\">Enter prices only if cost is omitted, and do it before real traffic.</text>\n\n  <rect x=\"22\" y=\"224\" width=\"656\" height=\"54\" rx=\"6\" fill=\"#dbeafe\" stroke=\"#3b82f6\"/>\n  <text x=\"350\" y=\"246\" font-size=\"12\" fill=\"#1e40af\" text-anchor=\"middle\">3. In Routing, point one model at this channel</text>\n  <text x=\"350\" y=\"264\" font-size=\"10\" fill=\"#1e40af\" text-anchor=\"middle\">Keep the platform route as backup. enablePlatformModels must be on, and the model must exist there.</text>\n\n  <rect x=\"22\" y=\"306\" width=\"656\" height=\"54\" rx=\"6\" fill=\"#d1fae5\" stroke=\"#22c55e\"/>\n  <text x=\"350\" y=\"328\" font-size=\"12\" fill=\"#166534\" text-anchor=\"middle\">4. Set alerts and errors, then move the rest</text>\n  <text x=\"350\" y=\"346\" font-size=\"10\" fill=\"#166534\" text-anchor=\"middle\">Back to step 2, one batch at a time. Do not cut every model over at once.</text>\n\n  <!-- 脚注 -->\n  <text x=\"350\" y=\"390\" font-size=\"10\" fill=\"#64748b\" text-anchor=\"middle\">From an OpenAI-compatible platform, most clients change base URL and key. Standard fields are done there.</text>\n  <text x=\"350\" y=\"405\" font-size=\"10\" fill=\"#64748b\" text-anchor=\"middle\">Unknown fields are forwarded as-is. If the upstream rejects a parameter, that error is the upstream's.</text>\n</svg>\n"}}