Skip to main content

Overview

CerebrasLLMService provides access to Cerebras’s language models through an OpenAI-compatible interface. It inherits from OpenAILLMService and supports streaming responses, function calling, and context management with ultra-fast inference speeds.

Installation

To use Cerebras services, install the required dependency:
pip install "pipecat-ai[cerebras]"

Prerequisites

Cerebras Account Setup

Before using Cerebras LLM services, you need:
  1. Cerebras Account: Sign up at Cerebras Cloud
  2. API Key: Generate an API key from your account dashboard
  3. Model Selection: Choose from available Cerebras models with ultra-fast inference

Required Environment Variables

  • CEREBRAS_API_KEY: Your Cerebras API key for authentication

Configuration

api_key
str
required
Cerebras API key for authentication.
base_url
str
default:"https://api.cerebras.ai/v1"
Base URL for Cerebras API endpoint.
model
str
default:"None"
deprecated
Model identifier to use.Deprecated in v0.0.105. Use settings=CerebrasLLMService.Settings(model=...) instead.
settings
CerebrasLLMService.Settings
default:"None"
Runtime-configurable settings. See Settings below.

Settings

Runtime-configurable settings passed via the settings constructor argument using CerebrasLLMService.Settings(...). These can be updated mid-conversation with LLMUpdateSettingsFrame. See Service Settings for details. This service uses the same settings as OpenAILLMService. See OpenAI LLM Settings for the full parameter reference.

Usage

Basic Setup

import os
from pipecat.services.cerebras import CerebrasLLMService

llm = CerebrasLLMService(
    api_key=os.getenv("CEREBRAS_API_KEY"),
    model="gpt-oss-120b",
)

With Custom Settings

from pipecat.services.cerebras import CerebrasLLMService

llm = CerebrasLLMService(
    api_key=os.getenv("CEREBRAS_API_KEY"),
    settings=CerebrasLLMService.Settings(
        model="gpt-oss-120b",
        temperature=0.7,
        top_p=0.9,
        max_completion_tokens=1024,
    ),
)

Notes

  • Cerebras supports a subset of OpenAI parameters. Advanced parameters like frequency_penalty and presence_penalty are not passed to the API.
  • Cerebras is known for ultra-fast inference speeds on supported models.
The InputParams / params= pattern is deprecated as of v0.0.105. Use Settings / settings= instead. See the Service Settings guide for migration details.