Prerequisites
Before you begin, ensure you have:- OpenRouter API Key - Create a free account and get your API key at OpenRouter
- Python 3.8 or higher (for Python examples) or Node.js 16+ (for JavaScript examples)
Quick Start
1
Install Dependencies
Choose your preferred method:
2
Set Your API Key
Create a Or set it as an environment variable:
.env file in your project directory:3
Make Your First API Call
Choose your preferred method to query GPT-OSS 120B on Cerebras:
4
Advanced Examples
You did it — your first API call is complete! Now, let’s explore how to make your model smarter at handling tasks and more precise in how it formats its responses via structured outputs and tool calling. See the examples below for how to use both.
Available Models
OpenRouter provides access to all Cerebras models:
Visit the OpenRouter Cerebras provider page for the complete list of available models.
FAQ
What context length can I run?
What context length can I run?
This varies by model. See our provider page to view max context length for each model.
What additional latency can I expect when using Cerebras through OpenRouter?
What additional latency can I expect when using Cerebras through OpenRouter?
A marginal amount of latency may appear as Cerebras Inference is only available via proxy, which has to be queried after your initial API request.
Why do I see “Wrong API Format“ when running the OpenRouter test code?
Why do I see “Wrong API Format“ when running the OpenRouter test code?
The official OpenRouter inference example uses a multimodal input call, which is not currently supported by Cerebras. To avoid this error, use the code provided in Step 2 of the tutorial above.

