Tool setup · checked 2026-10-07

Trae Custom Model Setup: Use a Third-Party API for Claude and GPT

As of 2026-10-07, Trae (now called TraeCode in its official docs) connects a third-party API when you open Settings > Models, click Add Model and choose Custom Model: pick the API format, Anthropic Messages or OpenAI Chat Completions, then enter the request URL, model ID and API key. The official docs say the Anthropic Messages format suits the Claude series and list “some Claude API proxy services” among compatible services. This page walks through every field, the Auto mode limitation and the common errors, based on the Trae and QCode documentation.

Updated 2026-10-07

#Trae custom model#Anthropic Messages#OpenAI Chat Completions#TraeCode

Four key fields and limits

2 formats

API formats for custom models

The official docs offer OpenAI Chat Completions (compatible with /v1/chat/completions) and Anthropic Messages (compatible with /v1/messages); the latter is described as suitable for the Claude series.

/api

Anthropic Messages base URL

Per the QCode docs: with Full URL off, enter https://api.qcode.cc/api; with it on, enter https://api.qcode.cc/api/v1/messages.

/openai/v1

OpenAI Chat Completions base URL

With Full URL off, enter https://api.qcode.cc/openai/v1; with it on, enter https://api.qcode.cc/openai/v1/chat/completions.

Auto skips it

Auto mode and custom models

Trae's Auto mode page states: after enabling the Auto mode, the system will not use the custom models added by you. Turn Auto off to use your own model.

What Trae's custom models are

As of 2026-10-07, Trae's official docs state: “In addition to TraeCode's built-in models, you can also add custom models to meet your personal needs.” There are two sources: a preset model provider, where you pick from TraeCode's list and enter an API key, and a custom configuration, where you set the API format, request URL, model ID and authentication yourself to add models TraeCode does not preset. A third-party API such as QCode goes through the second route. As of 2026-10-07, the official built-in model list shows the Seed, GPT, GLM, DeepSeek, Kimi, Gemini and MiniMax families, and no Claude model appears in it; to use Claude in Trae's built-in AI, you can add a custom model in the Anthropic Messages format. The other route is the Claude Code extension, which runs independently of the built-in AI and can coexist with it.

The official framing (Trae docs and changelog)

Trae's docs describe the Anthropic Messages format as “Compatible with the Anthropic /v1/messages API specification. Suitable for the Claude series and model services compatible with the Anthropic Messages API”, with Anthropic Claude and “some Claude API proxy services” as typical examples; the OpenAI Chat Completions format is “Suitable for most OpenAI-compatible model services.” The changelog shows that Trae v1.1.0 on 2025-03-11 supported adding custom models by using your own API keys, and that TRAE v3.5.51 on 2026-04-14 supported configuring custom request URLs for custom models. When you click Add Model, TraeCode calls the provider's API to check whether the key is valid; if the connection fails, the window shows the error messages and logs returned by the provider.

Timeline of Trae custom models

2025-03-11

Trae v1.1.0 ships; the official changelog says it supports adding custom models by using your own API keys.

2026-04-14

TRAE v3.5.51 ships with support for configuring custom request URLs for custom models.

2026-09-18

The update date shown on the QCode docs' Trae Integration page, which lists QCode URLs for both API formats and marks them as a reference mapping not tested inside Trae; this page was checked against the official pages on 2026-10-07.

Confirmed vs not verified

Confirmed (verbatim in the official pages)

Each of these can be checked word for word in Trae's official docs or the QCode docs: custom models are added from Settings > Models with the Add Model button; a custom configuration takes an API format, request URL, model ID and authentication; the API formats are OpenAI Chat Completions and Anthropic Messages, the latter suitable for the Claude series; the request URL has a Full URL switch, and with it off TraeCode appends the request path for the chosen format; TraeCode checks the key against the provider's API when you add the model; with Auto mode on, custom models are not used. On the QCode side: Claude models only run over the Anthropic protocol, GPT models only over OpenAI, and GLM, Kimi, DeepSeek and Qwen over both; one API key works across protocols.

Unverified or not documented

Three things are not verified: ① the QCode docs mark their Trae mapping as a reference written from the official semantics and not tested inside Trae, so on first setup go by the key check Trae runs when you add the model; ② neither Trae's nor QCode's docs say whether the Model Series presets under advanced settings (GPT-5 series, Deepseek-4 series and so on) suit gpt-6.1-sol or deepseek-v4-pro on QCode, so this page recommends none; if unsure, select nothing, and per the official docs the default configuration is used; ③ the official docs do not describe regional differences between Trae CN and the international edition (as the QCode docs note), and this page makes no claim about the China edition's custom model screen.

Which API format, which route

Anthropic Messages vs OpenAI Chat Completions

Choose by model family. The QCode docs state that Claude models only run over the Anthropic protocol, GPT models only over OpenAI, and GLM, Kimi, DeepSeek and Qwen over both. So claude-sonnet-5-5 and claude-opus-5-5 take Anthropic Messages with base URL https://api.qcode.cc/api; gpt-6.1-sol takes OpenAI Chat Completions with base URL https://api.qcode.cc/openai/v1; deepseek-v4-pro and glm-5.3 work with either. Put a Claude model into the OpenAI format and QCode returns model_not_available_on_endpoint.

Built-in AI custom model vs Claude Code extension

The two run independently and can coexist. A custom model serves Trae's built-in AI (Agent and Chat), in either the Anthropic Messages or the OpenAI Chat Completions format; the Claude Code extension speaks Anthropic Messages only, reads ANTHROPIC_BASE_URL and needs a primaryApiKey field in ~/.claude/config.json. The QCode docs recommend that users who have purchased QCode service work mainly through the Claude Code extension.

Seven steps to add QCode as a custom model in Trae

① Open Settings > Models to reach the model management panel. ② Click Add Model and choose Custom Model in the dialog, not a preset provider. ③ Set the API format: Anthropic Messages for Claude models, OpenAI Chat Completions for GPT models; GLM, Kimi, DeepSeek and Qwen work with either. ④ Set the request URL: with Full URL off, enter the base URL https://api.qcode.cc/api (Anthropic) or https://api.qcode.cc/openai/v1 (OpenAI) and TraeCode appends the path; with it on, enter https://api.qcode.cc/api/v1/messages or https://api.qcode.cc/openai/v1/chat/completions. ⑤ Enter a model ID listed on qcode.cc/models, character for character, such as claude-sonnet-5-5; if you leave Display Name empty, the model ID is shown. ⑥ Paste your QCode cr_ key as the API key. ⑦ Click Add Model; TraeCode checks the key and, if the connection succeeds, adds the model to the list. Before chatting, turn Auto mode off, click the current model name in the lower-right corner of the chat input box and pick your model.

On QCode

One QCode API key covers both formats in Trae: the QCode docs state that the same API key works across all three protocols, with the protocol decided by the request path. Among the models you can call on QCode as of 2026-10-07 are claude-sonnet-5-5, claude-opus-5-5 and claude-sonnet-5 for Claude, gpt-6.1-sol for GPT, and deepseek-v4-pro, glm-5.3, qwen3.8-max and kimi-k3 among the Chinese models; in Trae, add each one as its own custom model. Billing is per token, with each model's price on /models. Users in North America and Europe can swap api.qcode.cc for us.qcode.cc (Los Angeles) and keep the same key, and request records can be viewed at probe.qcode.cc by entering your API key.

Frequently asked questions

Can Trae connect to the Claude API?

Yes. Trae's official docs say the Anthropic Messages format for custom models is compatible with the /v1/messages specification and suitable for the Claude series and compatible services, naming “some Claude API proxy services” among them. For QCode: choose Anthropic Messages, base URL https://api.qcode.cc/api, a listed model ID such as claude-sonnet-5-5, and your cr_ key. The QCode docs note that this mapping is a reference and was not tested inside Trae.

Should the request URL be the full URL or the base URL?

Either, depending on the Full URL switch. With it on, enter the full address: https://api.qcode.cc/api/v1/messages or https://api.qcode.cc/openai/v1/chat/completions. With it off, enter only the base URL, https://api.qcode.cc/api or https://api.qcode.cc/openai/v1, and per the official docs TraeCode appends the request path for the chosen API format. The QCode docs also warn SDK users not to add a trailing slash, which produces //v1/messages and a 404; leaving it off in Trae is the safe choice too.

What does model_not_available_on_endpoint mean?

The protocol is wrong, not the key. The QCode docs state that Claude models only run over the Anthropic protocol; putting a Claude model into OpenAI Chat Completions returns this error, and the check happens before authentication, while a bad key returns Invalid API key instead. Switch the API format to Anthropic Messages and the URL to https://api.qcode.cc/api. Trae's docs say a failed connection shows the provider's error messages and logs in the window, which you can use for troubleshooting.

The model is added, so why isn't it used in chat?

Most likely Auto mode is on. Trae's docs state that with Auto mode enabled, the system will not use the custom models you added. Turn Auto off, click the current model name in the lower-right corner of the chat input box and pick your model. Also, a disabled custom model stays on the model management panel but does not appear in the chat input box's model list.

Built-in AI custom model or the Claude Code extension?

You can run both. If you only want to switch models in Trae's Agent and Chat, a custom model is enough. To use Claude Code inside Trae, install the extension: it relies on the ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN environment variables and also needs a primaryApiKey field in ~/.claude/config.json (any value works; note that it is config.json, not settings.json). The QCode docs recommend the Claude Code extension as the main route for users who have purchased QCode service.

Can GPT and Chinese models be connected the same way?

Yes, with the right format. The QCode docs state that GPT models only run over the OpenAI protocol, so gpt-6.1-sol takes OpenAI Chat Completions with base URL https://api.qcode.cc/openai/v1; GLM, Kimi, DeepSeek and Qwen run over both protocols, so deepseek-v4-pro, glm-5.3, qwen3.8-max and kimi-k3 work with either format. Go by the live list on /models for model IDs and match them character for character.

Sources

Trae side: the official Trae docs page “Built-in models & custom models” in English and Chinese (the two custom model sources, the steps, API formats, the Full URL switch, model ID, key check, advanced settings and the built-in model list), the “Auto mode” page (custom models are not used while it is on) and the changelog (the 2025-03-11 v1.1.0 and 2026-04-14 v3.5.51 entries), all crawled 2026-10-07. QCode side: the QCode docs page “Trae Integration” (updated 2026-09-18: QCode URLs for both formats, the cr_ key, the Claude Code extension setup) and “Endpoints & API Paths” (updated 2026-09-25: which model families run over which protocol, the model_not_available_on_endpoint error, the three domains, probe.qcode.cc), crawled the same day.

One key for Claude and GPT in Trae

Anthropic Messages and OpenAI Chat Completions share one QCode API key; claude-sonnet-5-5, gpt-6.1-sol and the rest are billed per token, with each model's price on /models.

Related reading

The field names, steps and quotes on this page were checked on 2026-10-07 against Trae's official docs and the QCode docs, which take precedence; Trae's interface and fields may change between versions without notice. The QCode docs mark the Trae mapping as a reference not tested inside Trae, so go by the key check Trae runs when you add the model. Model availability is whatever /models shows.

Try first, then decide

Not sure which tier? Start with Starter ($8.57/mo) and upgrade when you're happy — the unused value of the old plan goes back to your balance.