Usage guide
Setup, environment variables, and Python/JavaScript/Go usage examples.
CerebrasLLM
Ultra-fast LLM inference on Cerebras wafer-scale hardware. OpenAI-compatible chat completions with streaming and tool calling.Constructor
Cerebras API key. Falls back to
CEREBRAS_API_KEY.Model id:
gpt-oss-120b, zai-glm-4.7, or llama3.3-70b (default).Sampling temperature, 0.0–1.5. Default 0.7.
Tool selection mode (
"auto"/"none"/"required").Max tokens to generate. Default 1024.
Nucleus sampling probability mass. Default None.
Seed for reproducible sampling. Default None.
Stop sequence that halts generation. Default None.
Stable end-user identifier for abuse monitoring. Default None.
aclose
cancel_current_generation
chat
The conversation history to send to the model.
Optional tool definitions the model may call.
Optional conversational graph guiding the exchange.
LLMResponse: Response chunks produced as the model generates output.
emit
The event to emit.
off
The event the handler was registered for.
The handler to remove.
on
callback is omitted.
The event to listen for.
The handler to invoke when the event is emitted. If
None, a decorator is returned that registers the decorated function.The registered callback when
callback is provided, otherwise a decorator that registers and returns the function it wraps.