# Bring your Model

In Toolhouse, you can choose what AI model and inference provider you want your agents to use.

Specifying a model gives you more flexibility:

* It gives the agent agent advanced reasoning capabilities, or the ability to perform a specific task using a more specialized model.
* When used with fast inference providers like Groq, it allows your agent to decrease its latency.
* It allows you to use the API Keys of your preferred service.

{% hint style="info" %}
Not all models work in the same way. Some models, including preview models and specialized models, may behave inconsistently. If the performance of your agent degrades, try the following:

* Switch to a production model.
* Disable MCP servers by creating a Bundle with no MCP servers.

Note that `@groq/groq/compound` and `@groq/groq/compound-mini` do not support MCP servers. When you select these models, MCP servers and bundles will be automatically disabled, even if you pass them in your th file.

If you need help, you can [talk to our team on Discord](https://discord.toolhouse.ai/).
{% endhint %}

In Toolhouse, you can specify a model in your th file in this format: `@provider/model-name`, where `model-name` is the same model name you will find from your provider. Here are some examples of valid model names:

* `@groq/llama-3.3-70b-versatile`
* `@openai/gpt-4.1-2025-04-14`
* `@anthropic/claude-sonnet-4-20250514`

Toolhouse supports these providers, and we will add more regularly.

| Provider    | Identifier    |
| ----------- | ------------- |
| Groq        | `@groq`       |
| OpenAI      | `@openai`     |
| Anthropic   | `@anthropic`  |
| Together.ai | `@togetherai` |
| OpenRouter  | `@openrouter` |

## Specifying a model for your agent

{% stepper %}
{% step %}

### Obtain the API Key for the model provider

You will need to obtain an API Key using the developer console of the provider you choose.

* [Groq Developer Console](https://console.groq.com/?utm_source=toolhouse)
* [OpenAI Developer Console](https://platform.openai.com/?urm_source=toolhouse)
* [Anthropic Developer Console](https://console.anthropic.com/?utm_source=toolhouse)
* [Together.ai Developer Console](https://api.together.ai/signin)
* [OpenRouter Developer Console](https://openrouter.ai/settings/keys)
  {% endstep %}

{% step %}

### Store your API Key in Toolhouse

You need to store the corresponding API key in Toolhouse. Toolhouse provides a secure way to store these keys. To do so, use the `th secrets add` command.

For more information about storing API keys, refer to [managing-secrets](https://docs.toolhouse.ai/toolhouse/advanced-concepts/managing-secrets "mention").

{% tabs %}
{% tab title="Groq" %}

```bash
th secrets set GROQ_API_KEY=your_api_key
```

{% endtab %}

{% tab title="OpenAI" %}

```bash
th secrets set OPENAI_API_KEY=your_api_key
```

{% endtab %}

{% tab title="Anthropic" %}

```bash
th secrets set ANTHROPIC_API_KEY=your_api_key
```

{% endtab %}

{% tab title="Together.ai" %}

```bash
th secrets set TOGETHER_API_KEY=your_api_key
```

{% endtab %}

{% tab title="OpenRouter" %}

```bash
th secrets set OPENROUTER_API_KEY=your_api_key
```

{% endtab %}
{% endtabs %}
{% endstep %}

{% step %}

### Specify the model in your th file

To use a specific model with your agent, you need to specify it in your `th` file. The model is defined using a string that includes the provider and the model name.

The format for specifying the model is: `@provider/model-name`.

For example:

```yaml
model: @groq/llama-3.3-70b-versatile
```

or

```yaml
model: @openai/gpt-4o-mini
```

{% endstep %}

{% step %}

### Test your agent

Testing your agent ensures that your configuration is valid and that the agent is working as intended.

To test your agent, simply run:

```bash
th run
```

{% endstep %}

{% step %}

### Deploy your agent

If the agent is running, you can deploy it to start using the model you chose.

```bash
th deploy
```

{% endstep %}
{% endstepper %}

## Supported models

This list shows the models supported by Toolhouse. Use the value in Toolhouse model identifier in your th file to reference the model in your configuration.

{% hint style="info" %}
`@groq/groq/compound` and `@groq/groq/compound-mini` do not support Tools or MCP servers. When you select these models, MCP servers and bundles will be automatically disabled, even if you pass them in your th file.
{% endhint %}

<table><thead><tr><th width="126.3125">Provider</th><th>Model</th><th>Toolhouse model identifier</th></tr></thead><tbody><tr><td>Groq</td><td><code>meta-llama/llama-4-maverick-17b-128e-instruct</code></td><td><pre class="language-yaml" data-full-width="false"><code class="lang-yaml">@groq/meta-llama/llama-4-maverick-17b-128e-instruct
</code></pre></td></tr><tr><td>Groq</td><td><code>meta-llama/llama-4-scout-17b-16e-instruct</code></td><td><pre class="language-yaml"><code class="lang-yaml">@groq/meta-llama/llama-4-scout-17b-16e-instruct
</code></pre></td></tr><tr><td>Groq</td><td><code>llama-3.3-70b-versatile</code></td><td><pre class="language-objective-cpp"><code class="lang-objective-cpp">@groq/llama-3.3-70b-versatile
</code></pre></td></tr><tr><td>Groq</td><td><code>llama-3.1-8b-instant</code></td><td><pre class="language-objective-cpp"><code class="lang-objective-cpp">@groq/llama-3.1-8b-instant
</code></pre></td></tr><tr><td>Groq</td><td><code>compound</code></td><td><pre class="language-objective-cpp"><code class="lang-objective-cpp">@groq/groq/compound
</code></pre></td></tr><tr><td>Groq</td><td><code>compound-mini</code></td><td><pre class="language-objective-cpp"><code class="lang-objective-cpp">@groq/groq/compound-mini
</code></pre></td></tr><tr><td>Groq</td><td><code>qwen/qwen3-32b</code></td><td><pre data-full-width="true"><code>@groq/qwen/qwen3-32b
</code></pre></td></tr><tr><td>OpenAI</td><td><code>gpt-4.1</code></td><td><pre class="language-objective-cpp"><code class="lang-objective-cpp">@openai/gpt-4.1
</code></pre></td></tr><tr><td>OpenAI</td><td><code>gpt-4.1-mini</code></td><td><pre class="language-objective-cpp"><code class="lang-objective-cpp">@openai/gpt-4.1-mini
</code></pre></td></tr><tr><td>OpenAI</td><td><code>gpt-4.1-nano</code></td><td><pre class="language-objective-cpp"><code class="lang-objective-cpp">@openai/gpt-4.1-nano
</code></pre></td></tr><tr><td>OpenAI</td><td><code>gpt-4o</code></td><td><pre class="language-objective-cpp"><code class="lang-objective-cpp">@openai/gpt-4o
</code></pre></td></tr><tr><td>OpenAI</td><td><code>gpt-4o-mini</code></td><td><pre class="language-objective-cpp"><code class="lang-objective-cpp">@openai/gpt-4o-mini
</code></pre></td></tr><tr><td>OpenAI</td><td><code>gpt-4-turbo</code></td><td><pre class="language-objective-cpp"><code class="lang-objective-cpp">@openai/gpt-4-turbo
</code></pre></td></tr><tr><td>OpenAI</td><td><code>gpt-4</code></td><td><pre class="language-objective-cpp"><code class="lang-objective-cpp">@openai/gpt-4
</code></pre></td></tr><tr><td>OpenAI</td><td><code>o3-mini</code></td><td><pre class="language-objective-cpp"><code class="lang-objective-cpp">@openai/o3-mini
</code></pre></td></tr><tr><td>OpenAI</td><td><code>o3</code></td><td><pre class="language-objective-cpp"><code class="lang-objective-cpp">@openai/o3
</code></pre></td></tr><tr><td>OpenAI</td><td><code>o4-mini</code></td><td><pre class="language-objective-cpp"><code class="lang-objective-cpp">@openai/o4-mini
</code></pre></td></tr><tr><td>OpenAI</td><td><code>o1</code></td><td><pre class="language-objective-cpp"><code class="lang-objective-cpp">@openai/o1
</code></pre></td></tr><tr><td>OpenAI</td><td><code>o1-mini</code></td><td><pre class="language-objective-cpp"><code class="lang-objective-cpp">@openai/o1-mini
</code></pre></td></tr><tr><td>Anthropic</td><td><code>claude-opus-4-20250514</code></td><td><pre class="language-objective-cpp"><code class="lang-objective-cpp">@anthropic/claude-opus-4-20250514
</code></pre></td></tr><tr><td>Anthropic</td><td><code>claude-sonnet-4-20250514</code></td><td><pre class="language-objective-cpp"><code class="lang-objective-cpp">@anthropic/claude-sonnet-4-20250514
</code></pre></td></tr><tr><td>Anthropic</td><td><code>claude-3-7-sonnet-20250219</code></td><td><pre class="language-objective-cpp"><code class="lang-objective-cpp">@anthropic/claude-3-7-sonnet-20250219
</code></pre></td></tr><tr><td>Anthropic</td><td><code>claude-3-5-sonnet-20241022</code></td><td><pre class="language-objective-cpp"><code class="lang-objective-cpp">@anthropic/claude-3-5-sonnet-20241022
</code></pre></td></tr><tr><td>Anthropic</td><td><code>claude-3-5-sonnet-20240620</code></td><td><pre class="language-objective-cpp"><code class="lang-objective-cpp">@anthropic/claude-3-5-sonnet-20240620
</code></pre></td></tr><tr><td>Anthropic</td><td><code>claude-3-5-haiku-20241022</code></td><td><pre class="language-objective-cpp"><code class="lang-objective-cpp">@anthropic/claude-3-5-haiku-20241022
</code></pre></td></tr><tr><td>Together.ai</td><td><code>moonshotai/Kimi-K2-Instruct</code></td><td><pre><code>@togetherai/moonshotai/Kimi-K2-Instruct
</code></pre></td></tr><tr><td>Together.ai</td><td><code>meta-llama/Llama-4-Maverick-17B-128E-Instruct-FP8</code></td><td><pre><code>@togetherai/meta-llama/Llama-4-Maverick-17B-128E-Instruct-FP8
</code></pre></td></tr><tr><td>Together.ai</td><td><code>meta-llama/Llama-4-Scout-17B-16E-Instruct</code></td><td><pre><code>@togetherai/meta-llama/Llama-4-Scout-17B-16E-Instruct
</code></pre></td></tr><tr><td>Together.ai</td><td><code>meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo</code></td><td><pre><code>@togetherai/meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo
</code></pre></td></tr><tr><td>Together.ai</td><td><code>meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo</code></td><td><pre><code>@togetherai/meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo
</code></pre></td></tr><tr><td>Together.ai</td><td><code>meta-llama/Meta-Llama-3.1-405B-Instruct-Turbo</code></td><td><pre><code>@togetherai/meta-llama/Meta-Llama-3.1-405B-Instruct-Turbo
</code></pre></td></tr><tr><td>Together.ai</td><td><code>meta-llama/Llama-3.3-70B-Instruct-Turbo</code></td><td><pre><code>@togetherai/meta-llama/Llama-3.3-70B-Instruct-Turbo
</code></pre></td></tr><tr><td>Together.ai</td><td><code>meta-llama/Llama-3.2-3B-Instruct-Turbo</code></td><td><pre><code>@togetherai/meta-llama/Llama-3.2-3B-Instruct-Turbo
</code></pre></td></tr><tr><td>Together.ai</td><td><code>Qwen/Qwen2.5-7B-Instruct-Turbo</code></td><td><pre><code>@togetherai/Qwen/Qwen2.5-7B-Instruct-Turbo
</code></pre></td></tr><tr><td>Together.ai</td><td><code>Qwen/Qwen2.5-72B-Instruct-Turbo</code></td><td><pre><code>@togetherai/Qwen/Qwen2.5-72B-Instruct-Turbo
</code></pre></td></tr><tr><td>Together.ai</td><td><code>Qwen/Qwen3-235B-A22B-fp8-tput</code></td><td><pre><code>@togetherai/Qwen/Qwen3-235B-A22B-fp8-tput
</code></pre></td></tr><tr><td>Together.ai</td><td><code>deepseek-ai/DeepSeek-V3</code></td><td><pre><code>@togetherai/deepseek-ai/DeepSeek-V3
</code></pre></td></tr><tr><td>Together.ai</td><td><code>mistralai/Mistral-Small-24B-Instruct-2501</code></td><td><pre><code>@togetherai/mistralai/Mistral-Small-24B-Instruct-2501
</code></pre></td></tr><tr><td>Together.ai</td><td><code>arcee-ai/virtuoso-large</code></td><td><pre><code>@togetherai/arcee-ai/virtuoso-large
</code></pre></td></tr><tr><td>Together.ai</td><td><code>arcee-ai/virtuoso-medium-v2</code></td><td><pre><code>@togetherai/arcee-ai/virtuoso-medium-v2
</code></pre></td></tr><tr><td>Together.ai</td><td><code>arcee-ai/caller</code></td><td><pre><code>@togetherai/arcee-ai/caller
</code></pre></td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.toolhouse.ai/toolhouse/advanced-concepts/bring-your-model.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
