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

# Anthropic

> Use the Anthropic Claude LLM plugin in a Zero Runtime pipeline. Setup, options, and usage in Python, JavaScript, and Go.

Anthropic Claude is an **LLM** plugin. It takes the transcribed conversation and generates
the reply, with support for tool calling, prompt caching, and extended thinking.

## Setup

Set your Anthropic API key in the worker environment. Generate a key from the [Anthropic console](https://console.anthropic.com/dashboard):

```bash theme={null}
export ANTHROPIC_API_KEY=<key>
```

## Usage

Import the plugin and pass it to the pipeline's `llm` slot.

<CodeGroup>
  ```python Python theme={null}
  from zrt.plugins import AnthropicLLM

  llm = AnthropicLLM(
      model="claude-sonnet-4-20250514",
      temperature=0.7,
  )

  # Pipeline(llm=llm, ...)
  ```
</CodeGroup>

## Configuration Options

*Constructor parameters for the Python SDK (`AnthropicLLM`). The JavaScript and Go SDKs expose `api_key`, `model`, `temperature`, and `max_tokens`/`maxOutputTokens` in their idiomatic form (camelCase / `LLMOptions` struct).*

### Core

| Parameter           | Type    | Default                      | Description                                                                                                                    |
| ------------------- | ------- | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| `api_key`           | `str`   | `None`                       | Anthropic API key. Falls back to the `ANTHROPIC_API_KEY` environment variable when unset.                                      |
| `model`             | `str`   | `"claude-sonnet-4-20250514"` | Claude model used to generate replies.                                                                                         |
| `temperature`       | `float` | `0.7`                        | Sampling randomness; lower is more deterministic.                                                                              |
| `max_output_tokens` | `int`   | `1024`                       | Maximum number of tokens the model may generate per response. The legacy `max_tokens` kwarg is accepted as a deprecated alias. |

### Sampling

| Parameter        | Type                 | Default | Description                                                                                            |
| ---------------- | -------------------- | ------- | ------------------------------------------------------------------------------------------------------ |
| `top_k`          | `int`                | `None`  | Top-k sampling cutoff.                                                                                 |
| `top_p`          | `float`              | `None`  | Nucleus-sampling probability cutoff.                                                                   |
| `stop_sequences` | `str` or `list[str]` | `None`  | One or more strings at which the model stops generating. Accepts a single string or a list of strings. |

### Advanced

| Parameter         | Type  | Default | Description                                                                                                                                                                                                           |
| ----------------- | ----- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `thinking_budget` | `int` | `None`  | Token budget for Claude's extended thinking (chain-of-thought reasoning). A positive value (e.g. `1024`) enables thinking; `None` disables it. The legacy `thinking={"budget_tokens": N}` dict form is also accepted. |

<Tip>
  For voice, short replies feel best. Keep `max_output_tokens` modest and the system instruction
  concise to keep latency down.
</Tip>

## Import paths

| SDK        | Import                                 | Constructor                                   |
| ---------- | -------------------------------------- | --------------------------------------------- |
| Python     | `from zrt.plugins import AnthropicLLM` | `AnthropicLLM(...)`                           |
| JavaScript | `from '@zrt/js-sdk/plugins/anthropic'` | `AnthropicLLM({ ... })`                       |
| Go         | `.../zrt-golang-sdk/plugins/anthropic` | `anthropic.NewLLM(anthropic.LLMOptions{...})` |

The reply is streamed to the [text-to-speech](/plugins/tts/cartesia) plugin, which
synthesizes the agent's voice.
