> ## Documentation Index
> Fetch the complete documentation index at: https://docs.orq.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# TRAE | AI Gateway

> Route any AI Gateway model through TRAE IDE using its built-in Custom Config panel. One entry for OpenAI-compatible models, one for Claude, both routed through Orq.ai with unified tracing and cost tracking.

## Overview

[TRAE](https://trae.ai) is an AI-native IDE by ByteDance. Its built-in Custom Config panel accepts any OpenAI-compatible or Anthropic-compatible endpoint, routing the full **AI Gateway** catalog through **Orq.ai** for unified tracing, cost tracking, and access controls without any plugin or extension.

## Prerequisites

* [TRAE](https://trae.ai) installed
* Active **Orq.ai** account
* [Orq.ai API key](/docs/ai-studio/organization/api-keys)

## Setup

<Steps>
  <Step title="Open the Models settings">
    In **TRAE**, click the <Icon icon="gear" /> icon in the top-right of the chat panel to open **Settings**, then navigate to **Models**.
  </Step>

  <Step title="Add a provider entry">
    Two provider formats are needed. For each, click **+ Add Model**, expand the **Custom Config** section, and fill the fields for the relevant format below.

    <Warning>
      Always use the `provider/model_id` format for Model ID (e.g. `openai/gpt-4o`, `anthropic/claude-sonnet-4-6`). Model IDs without the provider prefix return a `400 invalid model format` error.
    </Warning>

    <Tabs>
      <Tab title="OpenAI-compatible models">
        For OpenAI, Google, DeepSeek, and all other non-Anthropic models:

        | Field                  | Value                                                                    |
        | ---------------------- | ------------------------------------------------------------------------ |
        | **API Format**         | `OpenAI Chat Completions`                                                |
        | **Custom Request URL** | `https://api.orq.ai/v3/router`                                           |
        | **Full URL**           | OFF (**TRAE** auto-appends `/chat/completions`)                          |
        | **Model ID**           | `openai/gpt-4o` (or any non-Anthropic model with the `provider/` prefix) |
        | **Multimodal**         | ON if the model supports vision                                          |
        | **API Key**            | `<ORQ_API_KEY>`                                                          |

        Replace `<ORQ_API_KEY>` with the key from [Workspace Settings → API Keys](https://my.orq.ai/settings/api-keys).
      </Tab>

      <Tab title="Anthropic models">
        For all Anthropic Claude models:

        | Field                  | Value                                                                                    |
        | ---------------------- | ---------------------------------------------------------------------------------------- |
        | **API Format**         | `Anthropic Messages`                                                                     |
        | **Custom Request URL** | `https://api.orq.ai/v3/anthropic`                                                        |
        | **Full URL**           | OFF (**TRAE** auto-appends `/v1/messages`)                                               |
        | **Model ID**           | `anthropic/claude-sonnet-4-6` (or any current Claude model with the `anthropic/` prefix) |
        | **Multimodal**         | ON if the model supports vision                                                          |
        | **API Key**            | `<ORQ_API_KEY>`                                                                          |

        Replace `<ORQ_API_KEY>` with the key from [Workspace Settings → API Keys](https://my.orq.ai/settings/api-keys).
      </Tab>
    </Tabs>
  </Step>

  <Step title="Configure Advanced Settings (optional)">
    Expand **Advanced Settings** to tune per-model behavior:

    | Field                | Notes                                                                                                                                                       |
    | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
    | **Model Series**     | Default works for all **AI Gateway** models. Other options tune hyperparameters per provider family; leave as Default unless a specific family requires it. |
    | **Display Name**     | Optional label shown in the model picker. Defaults to Model ID.                                                                                             |
    | **Context Window**   | Set input/output token limits explicitly if the model requires it.                                                                                          |
    | **Tool Call Rounds** | Defaults to 200. Raise for long agentic loops.                                                                                                              |
  </Step>

  <Step title="Submit">
    Click **Submit**. The model appears in the **TRAE** model selector.
  </Step>

  <Step title="Select the model in a chat">
    Use the model selector in the bottom-right of the **TRAE** chat panel to pick the **AI Gateway**-routed provider for the current session.
  </Step>
</Steps>

## Troubleshooting

<AccordionGroup>
  <Accordion title="400 invalid model format">
    The Model ID is missing the provider prefix. Change `gpt-4o` to `openai/gpt-4o`, `claude-sonnet-4-6` to `anthropic/claude-sonnet-4-6`, and so on. All **AI Gateway** model IDs require the `provider/` prefix.
  </Accordion>

  <Accordion title="Error 4028: temperature and top_p cannot both be specified">
    A Claude model is configured under the OpenAI Chat Completions format. Create a separate provider entry using **API Format: Anthropic Messages** pointing at `https://api.orq.ai/v3/anthropic` instead.
  </Accordion>

  <Accordion title="Requests bypassing Orq.ai">
    If `OPENAI_API_KEY` or `OPENAI_BASE_URL` are set in the environment and a legacy OpenAI provider is also configured in **TRAE**, requests may resolve to the wrong endpoint. Unset those variables if not in use:

    ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
    unset OPENAI_API_KEY OPENAI_BASE_URL
    ```
  </Accordion>

  <Accordion title="No Traces appearing in Orq.ai">
    Confirm the **API Key** field contains a valid **Orq.ai** [API key](/docs/ai-studio/organization/api-keys) (not an OpenAI or Anthropic key) and that **Custom Request URL** points to the correct Orq endpoint for the chosen format.
  </Accordion>
</AccordionGroup>

## Verification

Select the **AI Gateway**-routed model in the **TRAE** chat panel and send a message. The response appears in the chat and the request appears in [**Orq.ai** Traces](/docs/ai-studio/observability/traces) with the selected model identifier.
