# Claude Anthropic (/en/ai/platform/models/llm/claude)

> For AI agents: see the complete documentation index at [llms.txt](/llms.txt).

> Documentation: Conversational AI.
> Documentation version: Preview.
> This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt).


Claude from Anthropic provides helpful, harmless, and honest AI assistance with strong reasoning capabilities and natural conversational abilities.

## Sample configuration

The following example shows how to configure Claude as the agent's LLM when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent).

Claude supports BYOK only. It isn't available in managed mode. Store your Anthropic API key in a secret set, and refer to it from the agent. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys).

**Python SDK**

```python
from agora_agent import Agent, Anthropic, secret_ref

# client is your configured Agora client
agent = (
    Agent(client=client)
    .with_stt(...)  # configure your ASR vendor
    .with_llm(
        Anthropic(
            api_key=secret_ref("support_prod", "anthropic"),
            vendor="anthropic",
            url="https://api.anthropic.com/v1/messages",
            headers={"anthropic-version": "2023-06-01"},
            model="claude-opus-4-8",
            max_tokens=1024,
            max_history=32,
            failure_message="Please hold on a second.",
            system_messages=[
                {"role": "system", "content": "You are a friendly support agent for Acme. Keep your answers short."}
            ],
        )
    )
    .with_tts(...)  # configure your TTS vendor
)
```

**TypeScript SDK**

```ts
import { Agent, Anthropic, secretRef } from 'agora-agents';

// client is your configured Agora client
const agent = new Agent({ client })
  .withStt(/* configure your ASR vendor */)
  .withLlm(
    new Anthropic({
      apiKey: secretRef('support_prod', 'anthropic'),
      vendor: 'anthropic',
      url: 'https://api.anthropic.com/v1/messages',
      headers: { 'anthropic-version': '2023-06-01' },
      model: 'claude-opus-4-8',
      maxTokens: 1024,
      maxHistory: 32,
      failureMessage: 'Please hold on a second.',
      systemMessages: [
        { role: 'system', content: 'You are a friendly support agent for Acme. Keep your answers short.' },
      ],
    }),
  )
  .withTts(/* configure your TTS vendor */);
```

**Go SDK**

```go
// client is your configured Agora client
maxTokens, maxHistory := 1024, 32
agent := agentkit.NewAgent(client).
	WithStt( /* configure your ASR vendor */ ).
	WithLlm(vendors.NewAnthropic(vendors.AnthropicOptions{
		APIKey:         agentkit.SecretRef("support_prod", "anthropic"),
		Vendor:         "anthropic",
		URL:            "https://api.anthropic.com/v1/messages",
		Headers:        map[string]string{"anthropic-version": "2023-06-01"},
		Model:          "claude-opus-4-8",
		MaxTokens:      &maxTokens,
		MaxHistory:     &maxHistory,
		FailureMessage: "Please hold on a second.",
		SystemMessages: []map[string]interface{}{
			{"role": "system", "content": "You are a friendly support agent for Acme. Keep your answers short."},
		},
	})).
	WithTts( /* configure your TTS vendor */ )
```

**REST API**

Set `credential.mode` to `byok` and `credential.fields.api_key` to a reference to the key. In the following example, the key is stored as `anthropic` in the `support_prod` set:

```json
"llm": {
  "credential": {
    "mode": "byok",
    "fields": {
      "api_key": "$secrets.support_prod.anthropic"
    }
  },
  "vendor": "anthropic",
  "style": "anthropic",
  "model": "claude-opus-4-8",
  "url": "https://api.anthropic.com/v1/messages",
  "headers": {
    "anthropic-version": "2023-06-01"
  },
  "max_history": 32,
  "failure_message": "Please hold on a second.",
  "params": {
    "max_tokens": 1024
  }
}
```

Set the system prompt and the greeting with the agent's `instructions` and `greeting`, not in the `llm` block.

## Key parameters

The `llm` block takes the following fields. In the SDKs, the LLM class sets them from its options. Use the `Anthropic` class. The SDK sets the style to `anthropic` and sends `max_tokens` in `params`.

**llm**

**`vendor` (string) required**

Set to `anthropic`.

**`credential` (object) required**

Set `mode` to `byok` and `fields.api_key` to a `$secrets.<set>.<key>` reference to your Anthropic API key. Get your API key from the [Anthropic Console](https://console.anthropic.com/).

**`style` (string) required**

Set to `anthropic` to use Claude's message format.

**`model` (string) required**

Refer to [Claude models](https://docs.anthropic.com/en/docs/about-claude/models) for available models.

**`url` (string) required**

Use Anthropic's messages endpoint.

**`headers` (object) required**

Must include the `anthropic-version` header for API compatibility.

**`params` (object) required**

**`max_tokens` (integer) required**

The maximum number of tokens to generate in the response.

For complete `llm` block options, see [Create an agent](/en/api-reference/api-ref/conversational-ai/platform/create-agent). For Claude-specific options and model capabilities, see the [Claude API documentation](https://docs.anthropic.com/en/api/messages).
