Skip to main content

Cerebras LLM

CerebrasLLM plugs Cerebras’s OpenAI-compatible Inference API at https://api.cerebras.ai/v1 into Patter’s pipeline mode. It is a thin wrapper around the OpenAI Chat Completions client with a Cerebras-specific base URL and optional gzip payload compression (enabled by default) for faster TTFT on large prompts.

Why Cerebras for voice

Cerebras runs inference on the WSE-3 wafer-scale chip, which serves the default model gpt-oss-120b at ~3000 tok/sec. Patter’s downstream TTS consumption rate is ~150-300 tok/sec, so any model on Cerebras saturates the pipeline regardless of weight size — meaning you can ship a 120B model with no realtime latency penalty over an 8B model. Picking the larger one buys higher answer quality for free.

Install

Usage

The namespaced import (import * as cerebras from "getpatter/llm/cerebras" / from getpatter.llm import cerebras) auto-resolves the API key from CEREBRAS_API_KEY and exposes a uniform LLM class — the same pattern Patter uses for STT and TTS namespaces.
Plug it into an agent:

Supported models

Pricing in USD per 1M tokens. Availability is gated per-tier — when a 404 model_not_found lands, the provider logs a recovery hint with override candidates and lets the call continue (voice pipelines treat LLM failures as recoverable).
gpt-oss-120b and llama3.1-8b are billed under Cerebras’s tier plans rather than per-token rate cards, so they are not present in LLM_PRICING — pass pricing={...} overrides if your dashboard needs cost figures for them.
llama3.1-8b is deprecating 2026-05-27. Switch to gpt-oss-120b (the default), llama-3.3-70b (paid tier), or qwen-3-235b-a22b-instruct-2507 (preview) before that date.

Environment variables

Options

Payload compression

Cerebras supports gzip (TypeScript) and msgpack + gzip (Python) request bodies — see Cerebras payload optimization. Patter enables compression by default, which reduces wire size on large prompts and shaves time-to-first-token. Disable per-request by passing gzipCompression: false.

Error handling

When chat.completions.create returns a 404 model_not_found, the provider logs an ERROR-level recovery hint including the upstream message and lists override candidates (llama3.1-8b, qwen-3-235b-a22b-instruct-2507, llama-3.3-70b on paid tier) — then returns silently. Voice pipelines treat LLM failures as recoverable so the call continues and the user simply hears no LLM response for that turn. All other errors raise PatterError after one retry with exponential backoff and honour x-ratelimit-reset-* advisory headers.