AI Code With LogoAI Code With

Trae × AI Code With

Use AI Code With in Trae: third-party API / relay setup

This page shows how to connect a third-party API in international Trae so you can edit code and run the terminal with custom models.

Dual-protocol custom-model quick reference4 settings per protocol
API format
OpenAI Chat Completions
Request URL
https://api.aicodewith.ai/v1
Claude Request URL
https://api.aicodewith.ai
API Key
sk-xxxxxxxx
Model ID
deepseek-v4-flash

Quick setup

In international Trae, turn off Auto and use Add Model. Claude uses Anthropic Messages; every other family uses OpenAI Chat Completions. Setup takes about 3 minutes.

International Trae supports custom models. Turn off Auto, click Add Model, pick Anthropic Messages or OpenAI Chat Completions by family, then enter the matching Request URL, API key, and Model ID.

  1. Download and install international Trae

    Download the macOS, Windows, or Linux installer from trae.ai and install it. After launch, turn off Auto and use a custom model. This page covers the international edition only — not the China edition, the Claude plugin, or local Claude Code.

    After Trae is open, click the current model name at the bottom of the Agent panel, then click Add Model. Keep Auto Mode off.
  2. Add a custom model by protocol

    Open Add Model. For Claude, pick Anthropic Messages and enter https://api.aicodewith.ai (no /v1). For GPT, Gemini, DeepSeek, GLM, and Kimi, pick OpenAI Chat Completions and enter https://api.aicodewith.ai/v1. Keep Full URL off. Paste your AI Code With API key, then type the Model ID. Add each model once.

    Quick copy

    Claude must use Anthropic Messages at the root without /v1. Every other family must use OpenAI Chat Completions with /v1. The two protocols are not converted.

    API format

    OpenAI Chat Completions

    Request URL

    https://api.aicodewith.ai/v1

    Model ID

    deepseek-v4-flash

    After copying, return to Trae: paste the API format and Request URL into Add Model. Paste the API key only inside Trae. Keep Full URL off.

    Switch to Custom configuration. For Claude pick Anthropic Messages, keep Full URL off, paste the Base URL from this page with no /v1, type a matching Model ID, paste the API key only in this dialog, then click Add Model.
  3. Pick the model and verify

    Turn off Auto, pick the custom model you just added, and send a test message. A normal reply means the setup works — then match the call by time and model name in AI Code With usage records. Copying or saving the model is not enough.

    Copy Model ID

    Trae does not fetch the model list. Turn off Auto, click Add Model, paste the Request URL for the matching protocol, then enter the exact Model ID below.

    Pick a family, then copy the Model ID. Claude uses Anthropic Messages (no /v1); every other family uses OpenAI Chat Completions (with /v1).

    Currently selected

    Provider
    Claude
    API format
    Anthropic Messages
    Request URL
    https://api.aicodewith.ai
    Model ID
    claude-sonnet-4-6

    The full list follows the AI Code With docs and pricing page. Claude must use Anthropic Messages; every other family must use OpenAI Chat Completions. GPT uses Chat Completions, not the Responses API.

    View the full model list
    After saving, open the model list at the bottom of the Agent panel and pick the new model under Custom models. Keep Auto off, send a test message, then match the call by time in AI Code With usage records.

How does Trae connect to AI Code With?

Trae's Add Model dialog supports two API formats. Pick the protocol by model family — do not mix URLs:

API format
Choose Anthropic Messages for Claude; choose OpenAI Chat Completions for GPT, Gemini, DeepSeek, GLM, and Kimi. The two protocols are not converted — the wrong format 404s or fails to parse.
Request URL
Claude uses https://api.aicodewith.ai (no /v1). Every other family uses https://api.aicodewith.ai/v1. Keep Full URL off and enter only the Base URL.
API Key
Paste your AI Code With API key in the Add Model dialog. The key stays in Trae on this machine.
Model ID
Type an AI Code With Model ID (for example, deepseek-v4-flash or claude-sonnet-5). Trae does not auto-fetch the relay catalog.

Flow: Trae Add Model → Anthropic Messages or OpenAI Chat Completions by family → AI Code With. Keep Auto off and add each model once.

Frequently asked questions

Don't have Trae installed?

Download the macOS, Windows, or Linux client from the international Trae site and install it. This page covers trae.ai only, not the China edition.

Trae international download

Visit trae.ai, pick the installer for your platform, launch Trae, turn off Auto, and use a custom model.

Download from the official page

Full install guidance follows Trae official docs; this site does not host or modify installers. Do not use the Claude plugin or a local Claude Code path.

Common error troubleshooting

The most frequent problems fall into 4 categories.

401 / Invalid API Key

Symptom: Sending a message returns 401, Unauthorized, or Invalid API Key.

Cause: Usually the API key is invalid, mistyped, or copied with extra characters.

  • Open Add Model and re-paste the full API key (no spaces)
  • Confirm the key is a valid AI Code With API key
  • Save, turn off Auto, pick that model, and send a test message
Read full guide →

Model Not Found / Wrong Model ID

Symptom: The request reports Model Not Found or unknown model, or the custom model cannot be called.

Cause: The Model ID was typed by hand, or the model is currently unavailable.

  • Copy the exact Model ID from this page instead of typing it
  • Confirm the current key can access that model
  • Turn off Auto, then select the custom model you just added
Read full guide →

Request URL error

Symptom: Sending fails, times out, 404s, or reports a wrong endpoint path.

Cause: Claude was given /v1, a non-Claude model is missing /v1, or Full URL was turned on and a path was appended.

  • For Claude enter https://api.aicodewith.ai with no /v1
  • For every other family enter https://api.aicodewith.ai/v1
  • Keep Full URL off; do not append /messages or /chat/completions
Read full guide →

Protocol does not match the model

Symptom: Claude is set to OpenAI Chat Completions, or GPT/Gemini is set to Anthropic Messages; the request 404s or fails to parse.

Cause: API format does not match the Model ID family. AI Code With does not convert protocols.

  • All Claude models use Anthropic Messages
  • GPT, Gemini, DeepSeek, GLM, and Kimi use OpenAI Chat Completions
  • Add each model separately — do not reuse a mismatched protocol row
Read full guide →

Need the full guide?

Every config parameter, the complete model list, and more troubleshooting live in the AI Code With docs.

Open the AI Code With docs

Sources

Related links