> ## 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.

# Crusoe

> Add and configure Crusoe Managed Inference models in TrueFoundry's AI Gateway using Custom Endpoints.

[Crusoe Managed Inference](https://www.crusoe.ai/cloud/managed-inference) exposes an **OpenAI-compatible** API for open-weight models such as `meta-llama/Llama-3.3-70B-Instruct`, `deepseek-ai/DeepSeek-V3-0324`, and `openai/gpt-oss-120b`. Use [Custom Endpoints](/docs/ai-gateway/custom-endpoints) in the AI Gateway to register Crusoe once, keep the Crusoe API key on the AI Gateway, and let your applications call models through a single TrueFoundry API key with access control and tracing.

### Prerequisites

**1. Create a Crusoe Cloud account**

Sign up at [console.crusoecloud.com](https://console.crusoecloud.com) if you do not already have an account.

**2. Generate a Crusoe API key**

In the [Crusoe Cloud Console](https://console.crusoecloud.com), go to **Admin** → **Security** → **Intelligence API keys** and click **Create**.

Store the key securely. You will paste it into the AI Gateway's **Custom Headers** configuration — not in client application code.

**3. Get your TrueFoundry API key and gateway URL**

You need a **TrueFoundry API key** (`TFY_API_KEY`) and your **gateway base URL** to call models through the AI Gateway. See [Gateway base URL](/docs/ai-gateway/quick-start#gateway-base-url) and [Authentication](/docs/ai-gateway/authentication).

### Adding models

Add Crusoe to the AI Gateway using **Custom Endpoints**.

**1. Create a Custom Endpoint model account**

In the TrueFoundry dashboard, go to **AI Gateway** → **Models** → **Custom Endpoints** and click **Add Custom Endpoint**.

In **Configure Account**, set:

* **Name** (Account Name): `crusoe` — this is your **model account name** and appears as the first path segment in every request URL (`{providerAccountName}`)
* **Endpoint Type**: `None`
* **Header Auth**: keep **disabled**

Add collaborators so other users or teams can use this account. See [Gateway access control](/docs/ai-gateway/gateway-access-control).

**2. Add a Crusoe endpoint**

On the **Endpoints** step, add an integration and configure:

* **Display Name**: `crusoe_managed_inference` — this is your **custom endpoint display name** and appears as the second path segment in every request URL (`{endpointName}`)
* **Base URL**: `https://api.inference.crusoecloud.com` (no trailing slash)

Enable **Custom Headers** and add:

* `Authorization`: `Bearer <CRUSOE_API_KEY>`
* `Content-Type`: `application/json`

Keep **Header Auth** and **TLS Settings** disabled unless your deployment requires them.

> [!NOTE]
>
> The **Authorization** header here is sent **from the AI Gateway to Crusoe**. Your application should only send the **TrueFoundry API key** to the AI Gateway.

**3. Set access control and save**

On the **Access Control** step, choose who can manage and use this model account, then **Save**.

* **Manager**: users/teams who can edit or delete the custom endpoint
* **User**: users/teams who can call the endpoint (for example, `everyone`)

### Inference

Once saved, call Crusoe through the AI Gateway's **proxy-api** path. URL shape and path rules are documented under [Custom Endpoints](/docs/ai-gateway/custom-endpoints#endpoint-structure).

#### How the request URL is built

The AI Gateway URL has two values **you configure in the dashboard** — they are not Crusoe model IDs:

| URL segment | Dashboard field | Example in this guide |
| - | - | - |
| `{providerAccountName}` | **Account Name** (Configure Account → **Name**) | `crusoe` |
| `{endpointName}` | **Custom endpoint Display Name** (Endpoints step) | `crusoe_managed_inference` |

Full URL pattern:

```
{GATEWAY_BASE_URL}/proxy-api/{providerAccountName}/{endpointName}/v1/chat/completions
```

With the example configuration above:

```
{GATEWAY_BASE_URL}/proxy-api/crusoe/crusoe_managed_inference/v1/chat/completions
```

| Segment | Example value | Meaning |
| - | - | - |
| `{GATEWAY_BASE_URL}` | `https://internal.devtest.truefoundry.tech/api/llm` | Your AI Gateway base URL |
| `crusoe` | Account Name you set in **Configure Account** | `{providerAccountName}` |
| `crusoe_managed_inference` | Display Name you set for the custom endpoint | `{endpointName}` |
| `v1/chat/completions` | Upstream path | Appended to the integration **Base URL** |

The AI Gateway forwards the request to:

```
https://api.inference.crusoecloud.com/v1/chat/completions
```

#### Choosing a Crusoe model

Crusoe hosts open-weight models such as `meta-llama/Llama-3.3-70B-Instruct`, `deepseek-ai/DeepSeek-V3-0324`, and `openai/gpt-oss-120b`. You do **not** need a separate custom endpoint per model — set the `model` field in the JSON request body to the Crusoe model ID you want. See the [Crusoe serverless inference docs](https://docs.crusoecloud.com/serverless-inference) for the full list.

> [!NOTE]
>
> Replace `crusoe` and `crusoe_managed_inference` in the URL with your own **Account Name** and **Display Name** if you used different values during setup.

### Supported APIs

| API | Endpoint | Tracing | Cost Tracking |
| - | - | - | - |
| [Chat Completions](#chat-completions) | `/proxy-api/{providerAccountName}/{endpointName}/v1/chat/completions` | **✅** | |

> **Chat Completions**
>
> **Before you start:** Replace `{GATEWAY_BASE_URL}` with your gateway base URL ([how to find it](/docs/ai-gateway/quick-start#gateway-base-url)) and set `TFY_API_KEY` to your TrueFoundry API key.
>
> #### Request headers (client → gateway)
>
> | Header | Value |
> | - | - |
> | `Authorization` | `Bearer <TFY_API_KEY>` |
> | `Content-Type` | `application/json` |
> | `Accept-Encoding` | `identity` |
>
> #### OpenAI Python SDK
>
> Because Crusoe is OpenAI-compatible, you can point the OpenAI SDK at the AI Gateway proxy path:
>
> ```python lines theme={"dark"}
> import os
>
> from openai import OpenAI
>
> GATEWAY_BASE_URL = "{GATEWAY_BASE_URL}"  # e.g. https://internal.devtest.truefoundry.tech/api/llm
> TFY_API_KEY = os.environ.get("TFY_API_KEY", "your-tfy-api-key")
>
> PROVIDER_ACCOUNT_NAME = "crusoe"  # Account Name
> ENDPOINT_NAME = "crusoe_managed_inference"  # Custom endpoint Display Name
>
> client = OpenAI(
>     api_key=TFY_API_KEY,
>     base_url=f"{GATEWAY_BASE_URL}/proxy-api/{PROVIDER_ACCOUNT_NAME}/{ENDPOINT_NAME}/v1",
> )
>
> response = client.chat.completions.create(
>     model="meta-llama/Llama-3.3-70B-Instruct",
>     messages=[
>         {"role": "system", "content": "You are a helpful assistant."},
>         {"role": "user", "content": "Tell me about TrueFoundry AI Gateway"},
>     ],
> )
>
> print(response.choices[0].message.content)
> ```
>
> #### cURL
>
> ```bash theme={"dark"}
> curl -X POST "{GATEWAY_BASE_URL}/proxy-api/crusoe/crusoe_managed_inference/v1/chat/completions" \
>   -H "Authorization: Bearer $TFY_API_KEY" \
>   -H "Content-Type: application/json" \
>   -H "Accept-Encoding: identity" \
>   -d '{
>     "model": "meta-llama/Llama-3.3-70B-Instruct",
>     "messages": [
>       {"role": "user", "content": "Tell me about TrueFoundry AI Gateway"}
>     ]
>   }'
> ```
>
> > [!NOTE]
> >
> > **Support scope:** Custom Endpoints proxy requests transparently to Crusoe. See the [Crusoe Managed Inference docs](https://www.crusoe.ai/cloud/managed-inference) for supported models and request fields. For gateway limitations on Custom Endpoints (HTTPS, streaming, and so on), see [Custom Endpoints](/docs/ai-gateway/custom-endpoints).


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