Trae Custom Models: Claude & GPT
This guide needs an API key
Create an account and generate one in about a minute, then use it wherever the steps below expect a key.
No card required to sign up · API usage requires a top-up
Trae is ByteDance's AI IDE; its custom model form accepts an OpenAI-compatible endpoint, so one Code By AI key covers Claude and GPT.
Trae ships with built-in models and a Custom configuration entry for third-party endpoints. The form takes an API format, request URL, model ID and credentials — enough to point the IDE at Code By AI without changing how the agent works.
One command?
setup.sh does not configure Trae. Trae keeps custom models inside the app and documents no file for them, so there is nothing the script could edit safely. Use the steps below.
1. Create a Code By AI API key
Sign in to Code By AI, open API Keys, and create a key. It looks like sk-proj-....
2. Open the model settings
Open Settings → Models in Trae and click Add model. The same model manager is reachable from the model picker in a chat.
3. Add a custom configuration
- Choose Custom configuration.
- Set API format to OpenAI Chat Completions.
- Set the request URL to
https://www.codebyai.net/api/agent/v1. - Keep Full URL off. Trae appends
/chat/completions; if you turn the switch on, enter the fullhttps://www.codebyai.net/api/agent/v1/chat/completionsinstead. - Paste the Code By AI API key.
- Enter the model ID
gpt-5.6-terra. - Save the model and select it in the chat model picker.
4. Add Claude
Add a second custom configuration with the same URL and key, and set the model ID to claude-sonnet-5. The gateway forwards claude-* IDs to the Claude channel and bills Claude prices, so both families share one endpoint.
Inside SOLO, turn off AUTO before choosing a custom model; otherwise the agent may keep routing to a built-in model.
5. Verify
Send a short request in a new chat. A normal answer confirms the URL, key and model ID. If the model does not appear, re-open the model manager and check that the custom entry was saved and enabled.
Troubleshooting
404— the request URL and the Full URL switch disagree: either a base URL with the switch off, or the full/chat/completionspath with it on. Do not mix the two.401/ invalid key — the key has stray spaces, was deleted, or expired. Create a new one on the API Keys page.- Insufficient balance — top up on the Wallet page.
- The model is missing from the picker — the custom entry was not saved, or AUTO is still on in SOLO.
- Tool calls fail — pick an agentic model ID from the Model Plaza. The gateway serves both families over Chat Completions, but a model still has to support tool calling.
Get started
Four steps to your first request
- 01
Create a free account
Sign up with Google, GitHub or email and set a password. No card is required.
- 02
Generate an API key
Create a key in one click from the dashboard. It lets your CLI authenticate with Code By AI.
- 03
Top up your balance
Add credit before your first request; usage is charged per token from your balance.
- 04
Point your CLI at Code By AI
Export one base-URL variable, or add a model provider block to config.toml. The setup guides list the exact lines for each agent.
No card required to sign up · API usage requires a top-up