Overview
This plugin allows you to use Cerebras as an LLM provider for your voice agents. Cerebras compatibility is provided by the OpenAI plugin using the Cerebras Chat Completions API.
Some Cerebras models are also available in LiveKit Inference, with billing and integration handled automatically. See the docs for more information.
Usage
Install the OpenAI plugin to add Cerebras support:
uv add "livekit-agents[openai]~=1.4"
pnpm add @livekit/agents-plugin-openai@1.x
Set the following environment variable in your .env file:
CEREBRAS_API_KEY=<your-cerebras-api-key>
Create a Cerebras LLM using the with_cerebras method:
from livekit.plugins import openaisession = AgentSession(llm=openai.LLM.with_cerebras(model="llama3.1-8b",),# ... tts, stt, vad, turn_handling, etc.)
import * as openai from '@livekit/agents-plugin-openai';const session = new voice.AgentSession({llm: openai.LLM.withCerebras({model: "llama3.1-8b",}),// ... tts, stt, vad, turnHandling, etc.});
Parameters
This section describes some of the available parameters. See the plugin reference links in the Additional resources section for a complete list of all available parameters.
modelstr | CerebrasChatModelsDefault: llama3.1-8bModel to use for inference. To learn more, see supported models.
temperaturefloatDefault: 1.0Sampling 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.5. To learn more, see the Cerebras documentation.
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.
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.
Additional resources
The following links provide more information about the Cerebras LLM integration.