Cerebras
The Cerebras provider offers access to powerful language models through the Cerebras API, including their high-speed inference capabilities powered by Wafer-Scale Engines and CS-3 systems.
API keys can be obtained from the Cerebras Platform.
Setup
The Cerebras provider is available via the @ai-sdk/cerebras module. You can install it with:
$ pnpm add @ai-sdk/cerebras
$ npm install @ai-sdk/cerebras
$ yarn add @ai-sdk/cerebras
$ bun add @ai-sdk/cerebras
Provider Instance
You can import the default provider instance cerebras from @ai-sdk/cerebras:
For custom configuration, you can import createCerebras and create a provider instance with your settings:
You can use the following optional settings to customize the Cerebras provider instance:
-
baseURL string
Use a different URL prefix for API calls. The default prefix is
https://api.cerebras.ai/v1. -
apiKey string
API key that is being sent using the
Authorizationheader. It defaults to theCEREBRAS_API_KEYenvironment variable. -
headers Record<string,string>
Custom headers to include in the requests.
-
fetch (input: RequestInfo, init?: RequestInit) => Promise<Response>
Custom fetch implementation.
Language Models
You can create language models using a provider instance:
Cerebras language models can be used in the streamText function
(see AI SDK Core).
You can create Cerebras language models using a provider instance. The first argument is the model ID, e.g. llama-3.3-70b:
You can also use the .languageModel() and .chat() methods:
Model Capabilities
| Model | Image Input | Object Generation | Tool Usage | Tool Streaming |
|---|---|---|---|---|
llama3.1-8b | ||||
llama-3.3-70b | ||||
gpt-oss-120b | ||||
qwen-3-32b | ||||
qwen-3-235b-a22b-instruct-2507 | ||||
qwen-3-235b-a22b-thinking-2507 | ||||
zai-glm-4.6 |
Please see the Cerebras docs for more details about the available models. Note that context windows are temporarily limited to 8192 tokens in the Free Tier. You can also pass any available provider model ID as a string if needed.