> For the complete documentation index, see [llms.txt](https://unsloth.ai/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://unsloth.ai/docs/integrations/connections/anthropic-claude.md).

# Connect Anthropic to Unsloth: Run Claude Models in Local Chat

Connect the Anthropic API to [Unsloth](https://github.com/unslothai/unsloth) to chat with Claude models including Claude Opus 4.7 directly alongside your local models in an open-source UI chat interface. This guide shows you how to create an Anthropic API key, add Anthropic as a provider in Unsloth, load Claude LLMs, and start chatting.

Supported Claude models in Unsloth can also access advanced features such as thinking, [web search](#web-search-and-thinking), Anthropic [code execution](#code-execution), and [prompt caching](#prompt-caching) to improve cost effiencey.

### Setup

{% stepper %}
{% step %}

#### Create an Anthropic API key

Create an API key from the [Anthropic Console](https://console.anthropic.com/settings/keys). Copy the key. You will paste it into Unsloth in the next step.
{% endstep %}

{% step %}

#### Connect Anthropic to Unsloth

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

Next, connect Anthropic to Unsloth.

1. Open **Settings** → **Connections**, then click **Add Connection.**
2. Select the provider you want to add, then paste the API key you copied earlier.
3. Click **Reload Models** to refresh the list with models available to your account.
4. Choose the models you want to enable, then hit save.&#x20;
   {% endstep %}

{% step %}

#### Ready to Chat

After saving the connection, select a Claude model under **Connected** in the model dropdown. Supported Claude models can expose extra controls including image generation, thinking, web search and code execution.

<figure><img src="/files/j7XVwXmv37LeP0VWlu7g" alt="" width="337"><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

### Code Execution

When enabled, supported Claude models can run code in Anthropic’s provider sandbox to solve problems, analyze data, and work with files. Claude uses Anthropic’s Code execution tool. Code execution appears in the response timeline as tool activity, alongside other tool calls.

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

### Prompt Caching

{% columns %}
{% column width="66.66666666666666%" %}
Prompt caching reduces latency and cost when requests reuse the same long prefix. It is supported for compatible providers and servers, including Anthropic models. Use the **Prompt caching** setting in the side panel to control caching behavior for supported connections.
{% endcolumn %}

{% column width="33.33333333333334%" %}

<figure><img src="/files/QSJQ82qfp3z5H35zIou6" alt=""><figcaption></figcaption></figure>
{% endcolumn %}
{% endcolumns %}

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

### Web Search & Thinking

Supported Claude models can use provider-side web search. The **Think** control appears when the selected model supports thinking. Depending on the model, this may expose different thinking levels or availability.

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

The **Think** control adapts to the selected model: some models use an on/off toggle, while reasoning-effort models use model specific thinking levels.&#x20;

### Troubleshooting

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

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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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/anthropic-claude.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.
