cerebras
Expert guidance for Cerebras Inference, the ultra-fast LLM inference service powered by the world's largest chip (Wafer-Scale Engine). Helps developers integrate Cerebras' API for applications requiring the fastest possible token generation — real-time chat, code completion, and interactive AI experiences.
What this skill does
# Cerebras — Wafer-Scale LLM Inference
## Overview
Cerebras Inference, the ultra-fast LLM inference service powered by the world's largest chip (Wafer-Scale Engine). Helps developers integrate Cerebras' API for applications requiring the fastest possible token generation — real-time chat, code completion, and interactive AI experiences.
## Instructions
### Chat Completions
```typescript
// src/llm/cerebras.ts — Cerebras API (OpenAI-compatible)
import OpenAI from "openai";
const cerebras = new OpenAI({
apiKey: process.env.CEREBRAS_API_KEY!,
baseURL: "https://api.cerebras.ai/v1",
});
// Basic completion — up to 2000+ tokens/second
async function chat(prompt: string) {
const response = await cerebras.chat.completions.create({
model: "llama3.3-70b", // Llama 3.3 70B on Cerebras hardware
messages: [
{ role: "system", content: "You are a helpful coding assistant." },
{ role: "user", content: prompt },
],
temperature: 0.7,
max_tokens: 1024,
top_p: 1,
});
// Response includes usage with Cerebras-specific speed metrics
console.log(`Tokens/sec: ${response.usage?.completion_tokens! / (response.usage as any).completion_time}`);
return response.choices[0].message.content;
}
// Streaming — first token in <200ms
async function streamChat(prompt: string, onChunk: (text: string) => void) {
const stream = await cerebras.chat.completions.create({
model: "llama3.3-70b",
messages: [{ role: "user", content: prompt }],
stream: true,
});
let full = "";
for await (const chunk of stream) {
const text = chunk.choices[0]?.delta?.content ?? "";
full += text;
onChunk(text);
}
return full;
}
// JSON mode
async function structuredOutput(prompt: string) {
const response = await cerebras.chat.completions.create({
model: "llama3.3-70b",
messages: [{ role: "user", content: prompt }],
response_format: { type: "json_object" },
temperature: 0,
});
return JSON.parse(response.choices[0].message.content!);
}
```
### Tool Use / Function Calling
```typescript
async function chatWithTools(prompt: string) {
const response = await cerebras.chat.completions.create({
model: "llama3.3-70b",
messages: [{ role: "user", content: prompt }],
tools: [
{
type: "function",
function: {
name: "get_stock_price",
description: "Get the current stock price for a ticker symbol",
parameters: {
type: "object",
properties: {
ticker: { type: "string", description: "Stock ticker (e.g., AAPL)" },
},
required: ["ticker"],
},
},
},
],
tool_choice: "auto",
});
const msg = response.choices[0].message;
if (msg.tool_calls) {
// Execute the tool and send results back
const toolResults = await Promise.all(
msg.tool_calls.map(async (call) => {
const args = JSON.parse(call.function.arguments);
const result = await executeFunction(call.function.name, args);
return {
role: "tool" as const,
tool_call_id: call.id,
content: JSON.stringify(result),
};
})
);
// Get final response with tool results
const final = await cerebras.chat.completions.create({
model: "llama3.3-70b",
messages: [
{ role: "user", content: prompt },
msg,
...toolResults,
],
});
return final.choices[0].message.content;
}
return msg.content;
}
```
### Python Integration
```python
# src/cerebras_client.py — Cerebras with Python
from openai import OpenAI
client = OpenAI(
api_key=os.environ["CEREBRAS_API_KEY"],
base_url="https://api.cerebras.ai/v1",
)
# Chat completion
response = client.chat.completions.create(
model="llama3.3-70b",
messages=[{"role": "user", "content": "Write a Python quicksort implementation"}],
temperature=0.3,
max_tokens=500,
)
print(response.choices[0].message.content)
# Streaming
stream = client.chat.completions.create(
model="llama3.3-70b",
messages=[{"role": "user", "content": "Explain transformers in 5 sentences"}],
stream=True,
)
for chunk in stream:
print(chunk.choices[0].delta.content or "", end="", flush=True)
```
### Available Models
```markdown
## Cerebras Models
- **llama3.3-70b** — Llama 3.3 70B, best quality, ~2000 tok/s output
- **llama3.1-8b** — Llama 3.1 8B, fastest option, ~2500+ tok/s output
- **llama3.1-70b** — Llama 3.1 70B, large context (128K tokens)
## Speed Comparison (approximate)
- Cerebras: 2000+ tok/s (70B model)
- Groq: 300-400 tok/s (70B model)
- Cloud GPU (A100): 50-80 tok/s (70B model)
- Local (M3 Max): 20-40 tok/s (70B quantized)
```
## Installation
```bash
# Use any OpenAI-compatible SDK
npm install openai
pip install openai
# Set base_url to https://api.cerebras.ai/v1
```
## Examples
### Example 1: Setting up an evaluation pipeline for a RAG application
**User request:**
```
I have a RAG chatbot that answers questions from our docs. Set up Cerebras to evaluate answer quality.
```
The agent creates an evaluation suite with appropriate metrics (faithfulness, relevance, answer correctness), configures test datasets from real user questions, runs baseline evaluations, and sets up CI integration so evaluations run on every prompt or retrieval change.
### Example 2: Comparing model performance across prompts
**User request:**
```
We're testing GPT-4o vs Claude on our customer support prompts. Set up a comparison with Cerebras.
```
The agent creates a structured experiment with the existing prompt set, configures both model providers, defines scoring criteria specific to customer support (accuracy, tone, completeness), runs the comparison, and generates a summary report with statistical significance indicators.
## Guidelines
1. **Use for latency-critical applications** — Cerebras is the fastest inference available; ideal for real-time chat and autocomplete
2. **OpenAI SDK drop-in** — Change base URL from OpenAI to Cerebras; your code works unchanged
3. **8B for simple tasks** — Use llama3.1-8b for classification, extraction, and simple Q&A; save 70B for complex reasoning
4. **Stream everything** — First-token latency is <200ms; streaming gives users instant feedback
5. **JSON mode for structured output** — Use `response_format: { type: "json_object" }` for reliable parsing
6. **Batch simple requests** — For bulk processing, send multiple independent prompts in parallel
7. **Monitor rate limits** — Free tier has request limits; check headers for remaining quota
8. **Fallback strategy** — Have a fallback to Groq or OpenAI; Cerebras can have capacity constraints during high demand
Related in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.