> ## Documentation Index
> Fetch the complete documentation index at: https://docs.standardagents.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# @standardagents/cerebras

> Cerebras provider package for Standard Agents using the Cerebras Chat Completions API

> [!NOTE]
>
> **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.

> [card] 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

```bash npm theme={null}
npm install @standardagents/cerebras
```

```bash pnpm theme={null}
pnpm add @standardagents/cerebras
```

```bash yarn theme={null}
yarn add @standardagents/cerebras
```

## Quick Start

```typescript agents/models/cerebras_fast.ts theme={null}
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

```typescript theme={null}
import { cerebras } from '@standardagents/cerebras';

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

## Provider Options

```typescript theme={null}
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

| Option | Type | Description |
| - | - | - |
| `service_tier` | `'priority' \| 'default' \| 'auto' \| 'flex'` | Request prioritization tier |
| `reasoning_effort` | `'none' \| 'low' \| 'medium' \| 'high'` | Override reasoning behavior directly |
| `clear_thinking` | `boolean` | Preserve or clear prior thinking on supported models |
| `user` | `string` | End-user identifier |
| `seed` | `number` | Best-effort deterministic sampling seed |
| `logprobs` | `boolean` | Return token log probabilities |
| `top_logprobs` | `number` | Number of top logprobs to return |

> [!NOTE]
>
> 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

```bash .dev.vars theme={null}
CEREBRAS_API_KEY=...
```

For Cloudflare Workers:

```bash theme={null}
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.

## Related

> [card] [Models](https://docs.standardagents.ai/core-concepts/models.md)
>
> Core model concepts

> [card] [OpenAI Provider](https://docs.standardagents.ai/providers/openai.md)
>
> Compare with OpenAI

> [card] [OpenRouter Provider](https://docs.standardagents.ai/providers/openrouter.md)
>
> Compare with OpenRouter


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.