Add Router One to TRAE (TraeCode) as a custom model
TRAE's AI IDE is named TraeCode in both its international (trae.ai) and China (trae.cn) documentation, and it takes a custom model under Settings > Models > Add Model > Custom Model: an API format (OpenAI Chat Completions or Anthropic Messages), a request URL, a model ID and an API key. Point that form at Router One and the requests TraeCode sends with that model selected go to the gateway on your key, with each request's tokens, cost and status in Dashboard → Logs. Neither edition's built-in model list includes a Claude model as of 2026-09-27, so a custom model is how you call a Claude ID from TraeCode. Checked against TraeCode 3.3.101 (China edition, released 2026-09-15) and TRAE's model documentation for both editions on 2026-09-27.
Before you add the model: what runs on your Router One key
TraeCode's Add Model window offers two sources: a preset model provider, where you only paste that provider's API key, or Custom Model, where you set the API format, request URL, model ID and key yourself. Router One goes in Custom Model. Requests reach Router One only while that custom model is selected: TRAE's docs state that Auto Mode calls built-in models only and never your custom models, so switch Auto Mode off in the model menu at the bottom right of the chat input. Max Mode's documented model table lists built-in models only; for a custom model, the Context Window fields in Advanced Settings set the limits. Create a dedicated Router One key for TraeCode with a maxSpend cap in the dashboard, then copy a chat model ID from /models, for example anthropic/claude-sonnet-5, openai/gpt-5.5 or deepseek-v4.1-flash.
Configure TRAE to use the Router One base URL
Open Settings > Models, click Add Model and choose Custom Model. Set API Format to OpenAI Chat Completions, leave the Full URL switch off and enter https://api.router.one/v1 as Custom Request URL; TraeCode appends the request path for the selected format, as the international docs show with the base https://api.openai.com/v1. Enter the exact catalog ID in Model ID, an optional Display Name, and the dedicated Router One key in API Key. For the first test, leave Advanced Settings at their defaults with Model Series on Default, then click Add Model: TraeCode checks the connection and adds the model only if the check succeeds. The finished form for a Claude ID looks like this:
- 自定义请求地址 / Custom Request URL (OpenAI Chat Completions)
- https://api.router.one/v1
- 自定义请求地址 / Custom Request URL (Anthropic Messages)
- https://api.router.one
# TraeCode:设置 > 模型 > 添加模型 > 自定义模型 # TraeCode: Settings > Models > Add Model > Custom Model API 格式 / API Format: OpenAI Chat Completions 完整 URL / Full URL: 关闭 / Off 自定义请求地址 / Custom Request URL: https://api.router.one/v1 模型 ID / Model ID: anthropic/claude-sonnet-5 模型展示名称 / Display Name: Claude Sonnet 5 (Router One) API 密钥 / API Key: sk-your-router-one-key # 高级配置 / Advanced Settings(首次测试 / first test) 模型系列 / Model Series: 默认 / Default 上下文窗口 / Context Window: 输入与输出留空 / input and output empty (TraeCode defaults) 支持图片输入 / Image Input Support: 仅当模型详情页列出图片输入时开启 / On only if the model page lists image input 思考模式 / Thinking Mode: 跟随模型默认配置 / Follow model default # Claude 与 DeepSeek V4 的 ID 也可以选 Anthropic 格式 / Claude and DeepSeek V4 IDs can use the Anthropic format instead: # API 格式 / API Format: Anthropic Messages,完整 URL 关闭 / Full URL off: https://api.router.one # 完整 URL 打开 / Full URL on: https://api.router.one/v1/chat/completions # 或 / or https://api.router.one/v1/messages
Which API format and URL each Router One model ID needs
TraeCode joins paths the way its docs describe: with Full URL off, the OpenAI Chat Completions format takes a base ending in /v1 and the Anthropic Messages format takes the host root; with Full URL on, you paste the complete endpoint. Router One serves every chat model on Chat Completions, and Claude-family and DeepSeek V4 IDs on Messages, so the format follows the model ID. A GPT, Gemini or Grok ID sent with Anthropic Messages is rejected with HTTP 400 before any model runs, and the message names the path to use (model '<id>' must be called via …); switch that model to OpenAI Chat Completions. Router One accepts the key either as an Authorization: Bearer header or as x-api-key, so the same key serves both formats. Channel IDs such as aws/claude-sonnet-5 are separate catalog entries with their own rates; bare or vendor-prefixed IDs keep the default channel.
| API Format in TraeCode | Full URL off | Full URL on | Router One model IDs |
|---|---|---|---|
| OpenAI Chat Completions | https://api.router.one/v1 | https://api.router.one/v1/chat/completions | Every chat model in the catalog: Claude, GPT, Gemini, Grok and DeepSeek IDs |
| Anthropic Messages | https://api.router.one | https://api.router.one/v1/messages | Claude-family IDs, aws/claude-… and vertex/claude-… channel IDs included, plus deepseek-v4.1-flash and deepseek-v4-flash |
Advanced Settings: model series, context window, tool rounds and images
Advanced Settings change the request TraeCode builds, so keep the defaults for the first test and change one field at a time:
- Model Series: start with Default and switch only after a plain request works. Both editions offer GPT-5, Gemini-3, DeepSeek-4 and Default; in the China edition the Claude-4 and GPT-6 options, among others, are enterprise-only. Per TRAE's docs, the GPT-5 option switches the output-limit field from max_tokens to max_completion_tokens, fixes Temperature at 1 and applies GPT-5 prompt templates. Router One's Chat Completions reference documents max_tokens as the output cap; where the client offers a choice, send max_tokens, which in TraeCode means Default. The DeepSeek-4 option turns thinking on by default, and the international docs say it does not support image input.
- Context Window: an input and an output value; left empty, TraeCode uses its own defaults. If you enter an input value, keep it at or below the context window on the model's Router One page (1,048,576 tokens for anthropic/claude-sonnet-5, 1,050,000 for openai/gpt-5.5, 1,000,000 for deepseek-v4.1-flash): a larger window lets long agent sessions send more input per request, and every input token is billed. The output value is a cap you choose.
- Tool Call Rounds: the most tool calls the model may make in one task. Each round is another billed request, so keep the default or lower it.
- Image Input Support: turn it on only when the model page lists image input; deepseek-v4-flash, for example, is text-only.
- Tool calling and Thinking Mode: the agent depends on tool calls, so prefer IDs whose model page lists tool calling; for other IDs, test one tool call first. Leave Thinking Mode on Follow model default for the first test.
Read the Add Model check and your first requests in Logs
When you click Add Model, TraeCode calls the service to check the key; if the check fails, the window shows the error message and the log the service returned. The common Router One causes: 401 means the key is missing or wrong; 404 usually means the URL does not match the Full URL switch, for example a complete /v1/chat/completions URL entered with the switch off, or https://api.router.one/v1 used with Anthropic Messages, where TraeCode appends /v1/messages to a base that already ends in /v1; 400 with must be called via means the ID needs the other API format; 402 means the wallet balance or the key's maxSpend is used up. TRAE's docs don't say whether the check itself sends a billable model request, so look for it in Dashboard → Logs after adding the model. Then send one plain message with the custom model selected and match it in Logs by time, model and request_id: the log shows tokens, cost, status, total time and, for streamed requests that produced output, time to first token (TTFT). One agent task can produce a request per tool round, so give TraeCode its own key with maxSpend; once the cap is reached, requests on that key return HTTP 402 while your other keys keep working.
Which model ID should TRAE send?
Copy the exact model ID from /models, preserving case, hyphens, and version suffixes; do not substitute a display name. Open its detail page and match the supported API endpoints, context window, and capabilities such as tool calling to the provider and features selected in TRAE. A catalog listing does not mean the client can use every feature of that model. Give each client or application a dedicated API key with a maxSpend cap.
Which API protocol is TRAE using?
OpenAI-compatible describes an interface format; it does not make Chat Completions (/v1/chat/completions), Responses (/v1/responses), and Anthropic Messages (/v1/messages) interchangeable. Check the installed client version, provider configuration, and actual request path against the model detail page and API compatibility fact sheet. A successful plain-text chat does not establish support for hosted tools, conversation state, or file-editing features.
Verify the TRAE call in your request trace
Send a simple text request from TRAE, then match its trace in Dashboard → Logs by time, model, and request_id: tokens, cost, latency, and status. Next, test streaming, tool calls, and multi-turn history separately. For failures, retain the actual request path, full error message, and request_id. If there is no matching log, check client configuration and connectivity before attributing the error to the gateway or upstream.
FAQ
Where do I add a custom model in TRAE?
In TraeCode, open Settings > Models and click Add Model. Choose Custom Model rather than a preset model provider, then fill in API Format, Custom Request URL (with its Full URL switch), Model ID, Display Name and API Key, and optionally Advanced Settings. After it is added you can edit, delete, enable or disable the model in the same panel; a disabled model stays in Settings but disappears from the chat's model list. The China edition labels the same path 设置 > 模型 > 添加模型 > 自定义模型.
Can I use Claude models in TRAE through Router One?
Yes, as a custom model. Neither TraeCode edition's built-in list includes a Claude model as of 2026-09-27, and TRAE's docs describe the Anthropic Messages format as the one suited to Claude-series models. With Router One, a Claude ID such as anthropic/claude-sonnet-5 is served with Anthropic Messages at https://api.router.one and with OpenAI Chat Completions at https://api.router.one/v1. Keep Model Series on Default: the Claude-4 option is enterprise-only in the China edition and not offered in the international docs. Router One bills each request on your key at the model's posted rate; this uses TraeCode's own custom-model feature with your key and does not imply any partnership between TRAE and Router One.
Why does TraeCode still answer with a built-in model?
Auto Mode is on, or the custom model is not selected. TRAE's docs state that Auto Mode picks among built-in models only and never calls your custom models. Open the model menu at the bottom right of the chat input, switch Auto Mode off and select your Router One model by its display name. If it is missing from that list, check in Settings > Models that the model is enabled. Requests that never reach Router One do not appear in Dashboard → Logs.
Should I switch Full URL on?
Either way works as long as the value matches the switch. With Full URL off, enter the base: https://api.router.one/v1 for OpenAI Chat Completions or https://api.router.one for Anthropic Messages, and TraeCode appends the path. With Full URL on, enter the complete endpoint: https://api.router.one/v1/chat/completions or https://api.router.one/v1/messages. A mismatch doubles or drops part of the path, which usually returns 404.
Which models can TRAE use through the gateway?
Choose a current catalog model that supports both the endpoint and the features TRAE uses. Check /models and the model detail page for the exact ID, current rates, and capabilities; a family name such as GPT or Claude is not a compatibility guarantee. A client that lists a model has only read the ID, from its own configuration or from GET /v1/models; verify an actual request too.
Models are listed, but requests fail with 400 or 404. What should I check?
Record the actual request path and error message, then check the exact model ID. A 400 can indicate invalid parameters, unsupported tools, or a model/endpoint mismatch; a 404 can indicate an incorrect path or missing resource, so it does not by itself establish that a model was retired. If the error says must be called via, use the named endpoint or select a model supported on the current endpoint. Do not add or remove /v1 or /chat/completions across all clients indiscriminately.
Does this work from Mainland China?
Yes. The gateway is reachable from Mainland China without a VPN, and the configuration is identical to the global setup.
How do I debug a 401/402/403/429?
Match the request and error message in Dashboard → Logs. For 401, check whether the key was sent and is valid; for 402, check wallet balance and maxSpend; for 403, check key permissions and access restrictions. For 429, distinguish request/token limits from upstream throttling using the error details. Keep the request_id and follow the error-codes reference.