Skip to content

Commit 470de96

Browse files
fix cerebras provider + update model list
1 parent e0e6b30 commit 470de96

File tree

3 files changed

+114
-315
lines changed

3 files changed

+114
-315
lines changed

docs/configuration/models.mdx

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ OPENAI_API_KEY=your_openai_key_here
3636
ANTHROPIC_API_KEY=your_anthropic_key_here
3737
GOOGLE_API_KEY=your_google_key_here
3838
GROQ_API_KEY=your_groq_key_here
39+
CEREBRAS_API_KEY=your_cerebras_key_here
3940
```
4041
</CodeGroup>
4142

@@ -151,8 +152,79 @@ stagehand = Stagehand(
151152
```
152153
</CodeGroup>
153154
</Tab>
155+
156+
<Tab title="Cerebras">
157+
<CodeGroup>
158+
```typescript TypeScript
159+
import { Stagehand } from "@browserbasehq/stagehand";
160+
161+
const stagehand = new Stagehand({
162+
modelName: "cerebras-gpt-oss-120b",
163+
modelClientOptions: {
164+
apiKey: process.env.CEREBRAS_API_KEY,
165+
},
166+
});
167+
```
168+
```python Python
169+
import os
170+
from stagehand import Stagehand
171+
172+
stagehand = Stagehand(
173+
model_name="cerebras-gpt-oss-120b",
174+
model_api_key=os.getenv("CEREBRAS_API_KEY")
175+
)
176+
```
177+
</CodeGroup>
178+
</Tab>
154179
</Tabs>
155180

181+
## Cerebras Models
182+
183+
Cerebras provides high-speed inference with competitive pricing for Llama models. Their infrastructure is optimized for fast token generation, making them ideal for development and high-throughput automation tasks.
184+
185+
### Available Models
186+
187+
| Model | Size | Best For | Speed |
188+
|-------|------|----------|-------|
189+
| `cerebras-llama-3.3-70b` | 70B parameters | Complex reasoning, production | Fast |
190+
| `cerebras-llama-3.1-8b` | 8B parameters | Development, simple tasks | Very Fast |
191+
| `cerebras-qwen-3-32b` | 32B parameters | Balanced performance, general use | Fast |
192+
| `cerebras-qwen-3-235b-a22b-instruct-2507` | 235B parameters | Advanced reasoning, complex tasks | Medium |
193+
| `cerebras-qwen-3-235b-a22b-thinking-2507` | 235B parameters | Deep reasoning, problem solving | Medium |
194+
| `cerebras-qwen-3-coder-480b` | 480B parameters | Code generation, programming tasks | Medium |
195+
| `cerebras-llama-4-maverick-17b-128e-instruct` | 17B parameters | Instruction following, fast inference | Very Fast |
196+
| `cerebras-llama-4-scout-17b-16e-instruct` | 17B parameters | Scouting, exploration tasks | Very Fast |
197+
| `cerebras-gpt-oss-120b` | 120B parameters | Open source GPT alternative | Fast |
198+
199+
### Cerebras Configuration
200+
201+
Cerebras models use a custom client that handles the API authentication and model name transformation:
202+
203+
```typescript
204+
import { Stagehand } from "@browserbasehq/stagehand";
205+
import { CerebrasClient } from "@browserbasehq/stagehand";
206+
207+
const stagehand = new Stagehand({
208+
llmClient: new CerebrasClient({
209+
modelName: "cerebras-qwen-3-32b",
210+
clientOptions: {
211+
apiKey: process.env.CEREBRAS_API_KEY,
212+
},
213+
logger: (message) => console.log(message),
214+
}),
215+
});
216+
```
217+
218+
### Getting Started with Cerebras
219+
220+
1. **Get API Key**: Sign up at [Cerebras Cloud](https://www.cerebras.net/) and obtain your API key
221+
2. **Set Environment Variable**: Add `CEREBRAS_API_KEY=your_key_here` to your `.env` file
222+
3. **Choose Model**: Select from the available models:
223+
- **Fast & Simple**: `cerebras-llama-3.1-8b`, `cerebras-llama-4-scout-17b-16e-instruct`
224+
- **Balanced**: `cerebras-qwen-3-32b`, `cerebras-llama-3.3-70b`
225+
- **Advanced**: `cerebras-qwen-3-235b-a22b-instruct-2507`, `cerebras-qwen-3-coder-480b`
226+
4. **Configure Client**: Use the CerebrasClient for optimal performance
227+
156228
## Custom LLM Integration
157229

158230
<Note>
@@ -248,6 +320,7 @@ For each provider, use their latest models that meet these requirements. Some ex
248320
- **OpenAI**: GPT-4 series or newer
249321
- **Anthropic**: Claude 3 series or newer
250322
- **Google**: Gemini 2 series or newer
323+
- **Cerebras**: Llama 3.1+ series (both 8B and 70B models supported)
251324
- **Other providers**: Latest models with structured output support
252325

253326
**Note**: Avoid base language models without structured output capabilities or fine-tuning for instruction following. When in doubt, check our [Model Evaluation](https://www.stagehand.dev/evals) page for up-to-date recommendations.

0 commit comments

Comments
 (0)