pipedog is an unofficial community port of Pipecat, not affiliated with Daily.
pipedog
LLM

Cerebras

CerebrasLLMService streams chat completions from Cerebras through its OpenAI-compatible API.

Overview

Cerebras serves open models with fast inference on its own hardware.

  • CerebrasLLMService: an OpenAILLMService subclass with Cerebras's base URL and default model.

Installation

bun add @pipedog/cerebras

It depends on @pipedog/openai, which is installed with it.

import { CerebrasLLMService } from "@pipedog/cerebras/llm";

Prerequisites

  • A Cerebras account and an API key from the Cerebras platform.
  • Pass the key as apiKey. It is required, and the service never falls back to OPENAI_API_KEY. The examples read it from CEREBRAS_API_KEY.

CerebrasLLMService

Configuration

Prop

Type

The other options (organization, project, defaultHeaders, serviceTier, retryOnTimeout, retryTimeoutSecs, function calling) are OpenAILLMService's. See OpenAI.

Base URLhttps://api.cerebras.ai/v1
Default modelgpt-oss-120b
Models to trygpt-oss-120b. See the provider's catalog for the rest.

Settings

Runtime-updatable settings, passed as settings: new CerebrasLLMService.Settings({...}) (CerebrasLLMSettings). They are OpenAI's settings, with these defaults:

SettingTypeDefaultDescription
modelstring"gpt-oss-120b"Model name.

Every other setting keeps OpenAI's default. Unset sampling settings are left out of the request, so the provider's own defaults apply. extra carries provider-specific request fields.

Usage

llm.ts
import { LLMUpdateSettingsFrame } from "@pipedog/core/frames/frames";

const llm = new CerebrasLLMService({
  apiKey: process.env.CEREBRAS_API_KEY ?? "",
  settings: new CerebrasLLMService.Settings({
    model: "gpt-oss-120b",
    systemInstruction: "You are a helpful assistant in a voice conversation.",
    temperature: 0.7,
  }),
});

Cerebras-only request fields, such as reasoning_effort, go in extra:

const reasoning = new CerebrasLLMService({
  apiKey: process.env.CEREBRAS_API_KEY ?? "",
  settings: new CerebrasLLMService.Settings({ extra: { reasoning_effort: "low" } }),
});

Change settings mid-call with an LLMUpdateSettingsFrame. The next completion uses them:

// Queue it on the worker, or push it from a processor upstream of the service.
const update = new LLMUpdateSettingsFrame({
  delta: new CerebrasLLMService.Settings({ temperature: 0.2, maxTokens: 300 }),
});

Notes

  • Runs a completion for each LLMContextFrame, between an LLMFullResponseStartFrame and an LLMFullResponseEndFrame, and streams the reply as LLMTextFrames, as OpenAILLMService does. Function calls, token usage metrics and runInference work the same way.
  • "developer" messages are sent as is: the API supports that role.
  • Cerebras honors max_tokens, max_completion_tokens and the penalties, so they are sent when set.

Runtime notes

RuntimeWorksWhat it needs
Bun✅ yesNothing.
Node.js✅ yesNothing.
Deno✅ yesNothing.
Cloudflare Workers✅ yesNothing.

Generated from pipecat.runtimes and pipecat.compat in packages/cerebras/package.json: ✅ means the compat smoke test passes on that runtime.

  • The client is the official openai JS SDK (through @pipedog/openai), which talks through fetch. It works on Bun, Node, Deno and Cloudflare Workers.
  • The deprecated model constructor option is not ported. Use settings.
  • Tested against a local OpenAI-compatible mock server, not against Cerebras itself.

pipedog is an unofficial community TypeScript port of Pipecat. It is not affiliated with or endorsed by Daily or the Pipecat project.

Portions adapted from the Pipecat documentation, Copyright (c) 2024–2025 Daily, BSD-2-Clause (see apps/docs/LICENSE-pipecat-docs).

On this page