aisdk / cerebras
Official Cerebras provider for the PHP AI SDK.
Fund package maintenance!
v0.8.1
2026-07-22 06:51 UTC
Requires
- php: ^8.3
- aisdk/core: ^0.8.0
- aisdk/openai-compatible: ^0.8.0
Requires (Dev)
- laravel/pint: ^1.18
- nyholm/psr7: ^1.8
- pestphp/pest: ^3.0 || ^4.0
- phpstan/phpstan: ^2.0
- rector/rector: ^2.0
README
Official Cerebras provider for the PHP AI SDK. Uses Cerebras Inference's OpenAI-compatible API.
Installation
composer require aisdk/cerebras
Basic Usage
use AiSdk\Cerebras; use AiSdk\Generate; Cerebras::create(['apiKey' => $_ENV['CEREBRAS_API_KEY']]); $result = Generate::text('Explain this code briefly.') ->model(Cerebras::model('gpt-oss-120b')) ->run();
Configuration
| Variable | Description | Default |
|---|---|---|
CEREBRAS_API_KEY |
API key for authentication | Required |
CEREBRAS_BASE_URL |
Base URL for API requests | https://api.cerebras.ai/v1 |
Supported Capabilities
| Capability | Support |
|---|---|
| Text generation and streaming | Native OpenAI-compatible chat |
| Tool calling, structured output, reasoning | Passed through for supported models |
| Image input | Passed through for compatible models |
Use providerOptions('cerebras', ['raw' => [...]]) for documented Cerebras chat-completions fields outside the portable SDK surface. Model IDs are opaque strings and are validated by Cerebras.