Skip to main content
Enabled when CEREBRAS_API_KEY is set in your environment.

Overview

The @standardagents/cerebras package provides a Cerebras provider factory for Standard Agents. It targets Cerebras’ OpenAI-compatible Chat Completions API and adds typed providerOptions, public model discovery, and request inspection support in the admin UI.

Key Features

  • Direct integration with https://api.cerebras.ai/v1/chat/completions
  • Typed providerOptions for Cerebras-specific parameters
  • Public model discovery from Cerebras’ public models endpoint
  • Tool calling, structured outputs, streaming, and reasoning support

Installation

npm
npm install @standardagents/cerebras
pnpm
pnpm add @standardagents/cerebras
yarn
yarn add @standardagents/cerebras

Quick Start

agents/models/cerebras_fast.ts
import { defineModel } from '@standardagents/spec';
import { cerebras } from '@standardagents/cerebras';

export default defineModel({
  name: 'cerebras-fast',
  provider: cerebras,
  model: 'llama3.1-8b',
  inputPrice: 0.1,
  outputPrice: 0.1,
});

Provider Factory

import { cerebras } from '@standardagents/cerebras';

defineModel({
  name: 'reasoning-model',
  provider: cerebras,
  model: 'gpt-oss-120b',
});

Provider Options

import { defineModel } from '@standardagents/spec';
import { cerebras } from '@standardagents/cerebras';

export default defineModel({
  name: 'cerebras-reasoning',
  provider: cerebras,
  model: 'gpt-oss-120b',
  providerOptions: {
    service_tier: 'default',
    reasoning_effort: 'high',
    user: 'user-123',
    seed: 42,
  },
});

Available Options

OptionTypeDescription
service_tier'priority' | 'default' | 'auto' | 'flex'Request prioritization tier
reasoning_effort'none' | 'low' | 'medium' | 'high'Override reasoning behavior directly
clear_thinkingbooleanPreserve or clear prior thinking on supported models
userstringEnd-user identifier
seednumberBest-effort deterministic sampling seed
logprobsbooleanReturn token log probabilities
top_logprobsnumberNumber of top logprobs to return
Standard Agents also maps reasoning.level to Cerebras reasoning_effort automatically for supported models like gpt-oss-120b.

Model IDs

Cerebras model IDs are sent directly, for example:
  • llama3.1-8b
  • qwen-3-235b-a22b-instruct-2507
  • gpt-oss-120b
  • zai-glm-4.7
The provider reads public model metadata from https://api.cerebras.ai/public/v1/models?format=openrouter and exposes those models in the Standard Agents UI. For request cost tracking, Standard Agents uses provider-reported cost when Cerebras returns it. When the response only includes token usage, the runtime falls back to a built-in pricing map for documented models like llama3.1-8b, qwen-3-235b-a22b-instruct-2507, gpt-oss-120b, and zai-glm-4.7.

Capabilities

The provider maps Cerebras public model metadata into Standard Agents capabilities:
  • supportsToolCalls from supported_features
  • supportsJsonMode from json_mode / structured_outputs
  • maxContextTokens from context_length
  • maxOutputTokens from max_output_length
For models not returned by the current public endpoint, the package includes fallback metadata for documented models like gpt-oss-120b and zai-glm-4.7.

Environment Setup

.dev.vars
CEREBRAS_API_KEY=...
For Cloudflare Workers:
wrangler secret put CEREBRAS_API_KEY

Notes

  • The provider uses Chat Completions, not OpenAI Responses.
  • Cerebras documents frequency_penalty, presence_penalty, and logit_bias as currently unsupported.
  • json_object responses are not compatible with streaming on the Cerebras API.
  • For custom or private Cerebras models, set inputPrice and outputPrice explicitly if you want cost tracking in logs.

Models

Core model concepts

OpenAI Provider

Compare with OpenAI

OpenRouter Provider

Compare with OpenRouter