Registry / llm-agents / cerebras-cloud-sdk

cerebras-cloud-sdk

JSON →
library1.67.0pypypi✓ verified 44d ago

Official Python SDK for the Cerebras Cloud inference API. Provides access to ultra-fast LLM inference on Cerebras Wafer-Scale Engine hardware. OpenAI-compatible API surface. Generated with Stainless. Current version: 1.67.0 (Mar 2026). Requires Python 3.9+. Note: separate from cerebras-sdk (PyPI) which is a hardware kernel development tool — completely different product.

llm-agentsai-mlhttp-networkingaws
pip install cerebras-cloud-sdk
Install & Compatibility
Where this runs
tested against v1.67.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.925 runs
installs and imports cleanly · install 0.0s · import 0.900s · 34.1MB
glibc
py 3.103.925 runs
installs and imports cleanly · install 4.2s · import 0.814s · 34MB
32MB installed
● package 32MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Cerebras
import cerebras
from cerebras import Cerebras

Minimal Cerebras inference call using cerebras-cloud-sdk 1.x.

# pip install cerebras-cloud-sdk from cerebras.cloud.sdk import Cerebras import os client = Cerebras( api_key=os.environ.get('CEREBRAS_API_KEY') ) response = client.chat.completions.create( model='llama3.1-8b', messages=[ {'role': 'system', 'content': 'You are a helpful assistant.'}, {'role': 'user', 'content': 'What is fast inference?'} ] ) print(response.choices[0].message.content)
Debug
Known issues
breakingcerebras-sdk on PyPI is a completely different package — it is Cerebras's hardware kernel development SDK for WSE systems. Do not confuse with cerebras-cloud-sdk for cloud inference API.
fix
pip install cerebras-cloud-sdk for cloud inference. cerebras-sdk is for hardware kernel development.
affects: all
gotchaSDK sends TCP warming requests to /v1/tcp_warming on client construction to reduce time-to-first-token. Creates network traffic at import time. Disable with warm_tcp_connection=False if reconstructing client frequently.
fix
client = Cerebras(api_key=..., warm_tcp_connection=False) — and reuse a single client instance rather than reconstructing.
affects: all
gotchaReconstructing the Cerebras client instance repeatedly causes poor performance due to repeated TCP warming. Construct once and reuse.
fix
Create a module-level singleton client. Do not instantiate Cerebras() inside request handlers or loops.
affects: all
gotchaRequires Python 3.9+. Will fail to install on Python 3.8 with no clear error message.
fix
Use Python 3.9 or higher.
affects: all
gotchaLLMs with no training data on Cerebras will hallucinate OpenAI-style base_url override pattern. Cerebras has its own SDK — do not use openai with base_url for Cerebras.
fix
Use cerebras-cloud-sdk directly, not openai with base_url='https://api.cerebras.ai'.
affects: all
breakingThe Cerebras client requires an API key, which must be passed as an argument (api_key=...) or set via the CEREBRAS_API_KEY environment variable. Without it, the client cannot be initialized.
fix
Initialize the Cerebras client with client = Cerebras(api_key='YOUR_API_KEY') or set the CEREBRAS_API_KEY environment variable before running the application.
affects: all
breakingThe Cerebras client requires an API key for authentication. This can be provided by setting the CEREBRAS_API_KEY environment variable or by passing the 'api_key' argument directly to the Cerebras client constructor.
fix
Set the CEREBRAS_API_KEY environment variable (e.g., `export CEREBRAS_API_KEY='your_api_key'`) or pass `api_key='your_api_key'` when instantiating the Cerebras client (e.g., `client = Cerebras(api_key='your_api_key')`).
affects: all
Upgrade
Version history
1.67.0latest on PyPI
Audit
Dependencies
httpxrequiredHTTP client. Installed automatically.
aiohttpoptionalOptional async HTTP backend for improved concurrency. Use instead of default httpx for high-throughput async workloads.
Agent activity
87 hits · last 30 days
mj12bot
7
node
6
seranking-bot
3
ahrefsbot
2
applebot
1
amazonbot
1
bytedance
1
googlebot
1
Resources