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

# Baseten

> Add and configure Baseten models in TrueFoundry's AI Gateway.

[Baseten](https://www.baseten.co/) hosts open-source and custom models behind an OpenAI-compatible Model API. TrueFoundry connects to Baseten through the **AI Gateway** at `https://inference.baseten.co/v1`.

Baseten models support **chat completions**, **streaming**, and **embeddings** (where the model supports it).

### Adding Models

This section explains the steps to add Baseten models and configure the required access controls.

<Steps>
  <Step title="Navigate to Baseten in AI Gateway">
    From the TrueFoundry dashboard, navigate to `AI Gateway` > `Models` and select `Baseten`.
  </Step>

  <Step title="Add Baseten Account Details">
    Click `Add Baseten Account`. Give a unique name to your Baseten account and complete the form with your Baseten authentication details (API Key). Add collaborators to your account, this will give access to the account to other users/teams. Learn more about access control [here](/docs/ai-gateway/gateway-access-control).

    Under advanced settings, you can optionally set a **Discount %** that is applied to the upstream list price for this account.
  </Step>

  <Step title="Add Models">
    Click `+ Add Model` and fill the form:

    * **Display Name**: the name shown in the TrueFoundry UI.
    * **Model ID**: the model identifier from Baseten's model catalog.
    * **Model Types**: select the type of the model (defaults to **Chat**).
    * **Cost** (optional): cost metrics used for cost tracking.
  </Step>
</Steps>

### Inference

After adding the models, you can perform inference using an OpenAI-compatible API via the Playground or by integrating with your own application.

Use the TrueFoundry model ID in the format `your-baseten-account/your-model-display-name`. See [Chat Completions - Getting Started](/docs/ai-gateway/chat-completions-overview#getting-started) for a full code example:

```python lines theme={"dark"}
from openai import OpenAI

client = OpenAI(
    api_key="your_truefoundry_api_key",
    base_url="{GATEWAY_BASE_URL}"
)

response = client.chat.completions.create(
    model="my-baseten-account/my-model",  # provider account / model display name
    messages=[{"role": "user", "content": "Hello, how are you?"}]
)

print(response.choices[0].message.content)
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.