Trae
AI Agents overview: tools, API base URLs and FAQs
The first turn of a session spends more credits
Each agent request carries a fixed set of tool definitions and a system prompt, often tens of thousands of tokens. The first turn writes that prefix into the cache and is billed as a full input. Later turns hit the cache and cost less. This is expected. For heavy use, contact support.
Trae's custom models speak OpenAI Chat Completions. Open Settings → Models → Add model → Custom configuration and fill in the API format, request URL, model ID, and API key. Agent mode sends tools on the same request.
Trae cannot fetch the model list. Copy a model ID from All model IDs and paste it in by hand. Tools that can fetch the list should use GET https://modelfold.ai/v1/models.
URL rules follow Trae's own docs, checked on 2026-11-09: Custom models (CN) and Built-in models and custom models. The CN changelog for 14 April 2026, v3.3.51 is the release that added custom request URLs. The international build the same day, v3.5.51, is the same feature.
When v3.3.51 first shipped, community guides said to paste the full endpoint and that the client would use it as-is. Current official docs are not "always as-is". The request URL has a Full URL switch. Both forms below are valid. Both must end up at https://modelfold.ai/v1/chat/completions.
Connectivity below was checked by calling that URL with an API key (plain chat, stream: true, and tools). The Trae window was not clicked through.
Add a model
- Open Console → API Keys and create a key that starts with
mf-. Paste the raw key. Do not addBearer. - In the IDE or Agent window, open Settings → Models and click Add model.
- Choose Custom configuration (some builds say Custom model). Do not pick the preset OpenAI provider. That channel uses OpenAI's own host.
- Set API format to OpenAI Chat Completions. Use this format for Claude, GPT, and Gemini on this page. Do not pick Anthropic Messages. That requests
/v1/messages. - Fill the request URL from the next section. Do not add a trailing slash.
- Set Model ID to an id from the catalog, for example
claude-sonnet-4-6. Leave the display name empty to show the model ID. - Paste the
mf-key into API key. - Click Add model. Trae probes the key. After it succeeds, pick this entry in the chat or Agent model list.
Leave Model series in Advanced at Default. The checks on this page did not change Temperature, and did not select the GPT-5 or GPT-6 series (those options rename the max-length field).
Screenshot placeholder
Settings → Models → Add model, with Custom configuration at the bottom. A real screenshot is not in yet.
Two ways to write the URL
The international docs spell this out with examples:
| Full URL | What you enter | What Trae does | Enter this for ModelFold |
|---|---|---|---|
| Off (default) | Base URL | Appends the path for the API format. OpenAI Chat Completions only appends /chat/completions, so the base URL must already include /v1 | https://modelfold.ai/v1 |
| On | Full request URL | Uses the value as-is and does not append | https://modelfold.ai/v1/chat/completions |
Do not enter the marketing homepage, and do not enter https://modelfold.ai/v1/ with a trailing slash. If the switch is off and you also include /chat/completions, Trae appends it again and the path becomes /chat/completions/chat/completions.
Screenshot placeholder
Full URL off, request URL https://modelfold.ai/v1. A real screenshot is not in yet.
Screenshot placeholder
Full URL on, request URL https://modelfold.ai/v1/chat/completions. A real screenshot is not in yet.
Models to use
Model IDs are the id values from GET https://modelfold.ai/v1/models. The rows below were on that list on 2026-11-09 and were called with a test key at POST /v1/chat/completions.
| Model ID | Chat | Stream stream: true | Tools | Use it for |
|---|---|---|---|---|
claude-sonnet-4-6 | OK | OK (SSE, text arrives in deltas) | OK (finish_reason is tool_calls) | Chat and Agent |
gpt-6-sol | OK | OK | OK | Chat and Agent |
gemini-3-8-flash | OK | OK | OK | Chat and Agent. The model page still says chat-only; this Chat Completions tool call returned real tool_calls. A very small output cap can be spent on thinking, so the visible text is empty |
gemini-3-pro | Unstable | OK this time | Not OK | Do not use it for Agent. See the table below |
gemini-3.1-pro is in the catalog. The same tool-call probe returned 502, so this page does not recommend it.
Common problems
| What you see | What to do |
|---|---|
| 404, or an HTML page | The /v1 segment is missing. https://modelfold.ai/chat/completions is the website's 404 page, not the API. With Full URL off, enter https://modelfold.ai/v1. With it on, include /v1/chat/completions. |
{"ok":false,"error":"not_found"} | One path segment too many. https://modelfold.ai/v1/v1/chat/completions returns this. Usually Full URL is on and the value already contains a suffix Trae appends again, or the base URL contains an extra /v1. |
401, invalid_api_key | A key that is not mf-, hex, underscore, then the secret, returns "missing or malformed API key". A well-formed key that does not exist or was revoked returns "invalid or revoked". Do not type Bearer into the key field. Trae adds the Authorization: Bearer header. |
| The form says ModelFold, but the request goes somewhere else | If the process that launched Trae has OPENAI_BASE_URL or OPENAI_API_BASE, an OpenAI-compatible client uses that host instead of the URL in Settings. A key that does not belong to that host is a 401. A path appended onto the wrong host is a 404. Remove both variables from the shell profile, quit Trae completely, and open it from the dock or Start menu. Do not launch it from a terminal that exported those variables. |
| Agent does not run the tool, and the reply is a JSON blob | The model did not return tool_calls. gemini-3-pro does this today: the tool definition comes back as handwritten JSON in the message text. Switch to claude-sonnet-4-6, gpt-6-sol, or gemini-3-8-flash. |
| You picked Gemini 3 Pro and the answer is not from that model | gemini-3-pro stays on its original upstream and fails over to the answering fallback. On 2026-11-09 one plain chat came back with model set to gpt-6-luna. A stream the same day was answered by gemini-3-pro itself. For a stable Gemini model, use gemini-3-8-flash. |
