Overview
This plugin allows you to use the Claude API as an LLM provider for your voice agents.
Installation
Install the plugin:
uv add "livekit-agents[anthropic]~=1.6"
pnpm add @livekit/agents-plugin-anthropic
Authentication
The Anthropic plugin requires an Anthropic API key .
Set ANTHROPIC_API_KEY in your .env file.
Usage
Use Claude within an AgentSession or as a standalone LLM service. For example, you can use this LLM in the Voice AI quickstart.
from livekit.plugins import anthropicsession = AgentSession(llm=anthropic.LLM(model="claude-sonnet-4-6",temperature=0.8,),# ... tts, stt, vad, turn_handling, etc.)
import { voice } from '@livekit/agents';import * as anthropic from '@livekit/agents-plugin-anthropic';const session = new voice.AgentSession({llm: new anthropic.LLM({model: "claude-sonnet-4-6",temperature: 0.8,}),// ... tts, stt, vad, turnHandling, etc.});
Parameters
This section describes some of the available parameters. See the plugin reference for Python or Node.js for a complete list of all available parameters.
modelstr | ChatModelsDefault: claude-sonnet-4-6Model to use. For a full list of available models and their API IDs, see the Model options .
max_tokensintDefault: 1024The maximum number of tokens to generate before stopping. To learn more, see the Anthropic API reference .
In Node.js this parameter is called maxTokens and defaults to 4096.
temperaturefloatDefault: 1Sampling temperature that controls the randomness of the model's output. Higher values make the output more random, while lower values make it more focused and deterministic. Range of valid values can vary by model.
Valid values are between 0 and 1. To learn more, see the Anthropic API reference .
parallel_tool_callsboolControls whether the model can make multiple tool calls in parallel. When enabled, the model can make multiple tool calls simultaneously, which can improve performance for complex tasks.
In Node.js this parameter is called parallelToolCalls and defaults to true.
tool_choiceToolChoice | Literal['auto', 'required', 'none']Default: autoControls how the model uses tools. String options are as follows:
'auto': Let the model decide.'required': Force tool usage.'none': Disable tool usage.
In Node.js this parameter is called toolChoice.
timeouthttpx.Timeout | NoneDefault: httpx.Timeout(5.0, read=30.0)Configures connect, read, write, and pool timeouts on the underlying HTTP client. Increase read to accommodate very large contexts or extended thinking budgets. Ignored when client parameter is set.
Provider tools
Anthropic supports the following provider tools that enable the model to use built-in capabilities executed on the model server. These tools can be used alongside function tools defined in your agent's codebase.
| Tool | Description | Parameters |
|---|---|---|
ComputerUse | Enable computer use to control a desktop environment. | display_width_px (default: 1280), display_height_px (default: 720), display_number (default: 1), tool_version |
from livekit.plugins import anthropicagent = MyAgent(llm=anthropic.LLM(model="claude-sonnet-4-6"),tools=[anthropic.ComputerUse(display_width_px=1280, display_height_px=720)], # replace with any supported provider tool)
Additional resources
The following resources provide more information about using Anthropic with LiveKit Agents.