# How to Connect OpenRouter to Unsloth: API Key & Model Setup

This guide explains how to connect **OpenRouter to** [**Unsloth**](https://github.com/unslothai/unsloth) so you can access hosted AI models from providers like **OpenAI, Anthropic,** and **Google** through an open-source local UI chat interface. You’ll learn how to create an OpenRouter API key, add OpenRouter as a provider in Unsloth, load or manually enter model IDs, and enable external models for chat.

Once a single API key is connected, OpenRouter models in Unsloth can provide advanced features such as thinking, web search, tool calling, code execution, and customizable generation settings directly from the chat page.

### Setup

{% stepper %}
{% step %}

#### Create an OpenRouter API key

Sign in to your OpenRouter account. Create an API key from the [OpenRouter dashboard](https://openrouter.ai/settings/keys):

<figure><img src="/files/eq9ChRNda6w66bG9BMAH" alt="" width="563"><figcaption></figcaption></figure>

Copy the key. You will paste it into Unsloth in the next step.

When creating the key, you can optionally set a credit limit or expiration date.
{% endstep %}

{% step %}

#### Connect OpenRouter to Unsloth

Open **Settings → Connections**, then click **Add Provider**.

Select **OpenRouter**, then enter your connection details.

Enter your OpenRouter details:

* **API key:** paste your OpenRouter API key

<figure><img src="/files/uEnc4GfWoMPGRsSnd0y2" alt="" width="375"><figcaption></figcaption></figure>

* **Model IDs:** click **Load Models**, or enter model IDs manually

<figure><img src="/files/3HzfTW7WXVvclpFn5AHy" alt="" width="375"><figcaption></figcaption></figure>

Click **Add Provider**. The enabled models will appear under **External** in the model dropdown.
{% endstep %}

{% step %}

#### Ready to Chat

After saving the connection, select an OpenRouter model under **External** in the model dropdown.

OpenRouter models can expose different controls depending on the upstream model, including web search, thinking, tool-calling, and generation settings.

{% endstep %}
{% endstepper %}

### Model Selection

OpenRouter provides access to many models from different providers. If **Load Models** does not return the models you want to select, enter the model IDs you want enabled.

<figure><img src="/files/mUoNuWesdwHDpWYzZ6RG" alt="" width="563"><figcaption></figcaption></figure>

Example model IDs:

```
openai/gpt-5.5 
anthropic/claude-sonnet-4.6 
google/gemini-3-pro
```

### Troubleshooting

If OpenRouter fails to connect, check that the API key is valid and belongs to the correct OpenRouter account.

If a model does not appear after clicking **Load Models**, it may not be available for your account or region. You can enter the model ID manually or choose another model.


---

# 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://unsloth.ai/docs/integrations/connections/openrouter.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.
