Configure OpenAI to use the Cerebras API
Set the API key and base URL when you initialize the client. Python usesapi_key and base_url; JavaScript uses apiKey and baseURL.
qwen-3.8-27b:
Compatibility differences
Reasoning compatibility
Kimi K2.7 Code is currently available only through customer trials, not on the public shared tier.
See Reasoning and Image Inputs for complete model-specific behavior.
Image input with the OpenAI client
The standard OpenAIimage_url content shape is supported. Supply the image as a base64 data URI:
Developer-level instructions via system and developer roles
This section applies only to
gpt-oss-120b.gpt-oss-120b, the API supports both the system and developer message roles. Both are mapped to a developer-level instruction layer in the prompt hierarchy, elevated above normal user instructions and injected into the model’s internal system prompt. This gives you significant control over the assistant’s tone, style, and behavior while preserving the model’s built-in safety guardrails.
The developer role is functionally equivalent to system. The system role remains supported for backward compatibility.
Key differences from OpenAI
OpenAI’s API distinguishes betweensystem and developer roles with different behavior. On Cerebras, both roles act at the developer level, meaning they may have stronger influence than system messages in OpenAI’s API.
As a result, the same prompt may yield different behavior here compared to OpenAI. This is expected.
Unsupported parameter combinations
Support for combiningtools and response_format is model-dependent. Do not combine them unless the selected model’s documentation explicitly supports and validates the combination. gpt-oss-120b rejects requests containing both fields. For portable behavior across Cerebras models, use one of the following approaches:
- Tool calling only: Omit
response_formatand let the model invoke tools. For structured arguments, define a JSON schema in the tool’sparametersfield. - Structured Outputs only: Omit
toolsand useresponse_formatwith a JSON schema. See Structured Outputs. - Two-step pipeline: Make one request with
toolsto gather data, then make another request withresponse_formatto format the final result.
Pass non-standard parameters
reasoning_effort is a standard OpenAI parameter. reasoning_format and clear_thinking are Cerebras-specific parameters.
- OpenAI client libraries: Pass Cerebras-specific parameters through
extra_body. - Cerebras SDKs: Pass Cerebras-specific parameters as top-level arguments. The SDKs also accept
extra_bodyfor untyped extensions.
Use an OpenAI client
Use an OpenAI client
Pass Cerebras-specific parameters through
extra_body when using an OpenAI client:Use a Cerebras SDK
Use a Cerebras SDK
Pass Cerebras-specific parameters as top-level arguments when using a Cerebras SDK:

