Automated summary
Provides guidance and code examples for integrating Groq's low-latency LLM inference API, including chat, streaming, structured JSON output, and tool calling in TypeScript.
Strengths
- Demonstrates an OpenAI-compatible TypeScript client for basic chat and streaming UI use cases.
- Includes practical examples for JSON mode and function calling.
- Focuses on latency-sensitive applications such as chatbots, code completion, and streaming responses.
Limitations
- Centered on TypeScript and the groq-sdk; offers little guidance for Python or other languages.
- Does not cover error handling, rate limits, retries, or cost management in depth.
- The tool-calling example is cut off in the provided document, so not every snippet is complete.
Use it when adding a fast Groq integration to a TypeScript app that needs low-latency or streaming LLM responses.
Avoid it for non-Groq providers, Python-first projects, or self-hosted inference setups outside the skill's scope.
Security analysis
SafeThe skill is purely documentation and TypeScript code examples for integrating the Groq API (chat completions, streaming, JSON mode, tool calling, Whisper transcription). It reads the API key from process.env.GROQ_API_KEY and makes ordinary SDK calls; there is no shell execution, filesystem destruction, network exfiltration, obfuscated payload, or safety-disabling instruction. Execution risk is minimal.
No concerns found
How this analysis is madeExamples
Using the Groq skill, write a TypeScript function that streams a Groq chat completion to a React component with llama-3.3-70b-versatile and calls onChunk for each token.Create a Groq TypeScript helper using JSON mode to extract people, organizations, locations, and dates from text, with temperature 0.Show how to call Groq's chat completions API with two tools, get_weather and search_web, and handle the returned tool calls.name: groq description: Expert guidance for Groq, the LLM inference platform that provides the fastest token generation speeds available, powered by custom LPU (Language Processing Unit) hardware. Helps developers integrate Groq's API for real-time AI applications where latency matters — chatbots, code completion, and streaming responses. license: Apache-2.0 compatibility: No special requirements metadata: author: terminal-skills version: 1.0.0 category: data-ai tags:
- llm
- inference
- api
- fast-inference
- chat
Groq — Ultra-Fast LLM Inference
Overview
Groq, the LLM inference platform that provides the fastest token generation speeds available, powered by custom LPU (Language Processing Unit) hardware. Helps developers integrate Groq's API for real-time AI applications where latency matters — chatbots, code completion, and streaming responses.
Instructions
Basic Chat Completion
// src/llm/groq-client.ts — Groq API (OpenAI-compatible)
import Groq from "groq-sdk";
const groq = new Groq({
apiKey: process.env.GROQ_API_KEY!,
});
// Basic completion — fastest LLM inference available
async function chat(prompt: string): Promise<string> {
const completion = await groq.chat.completions.create({
model: "llama-3.3-70b-versatile", // Fast and capable
messages: [
{
role: "system",
content: "You are a helpful assistant. Be concise and direct.",
},
{ role: "user", content: prompt },
],
temperature: 0.7,
max_tokens: 1024,
});
return completion.choices[0].message.content ?? "";
}
// Streaming for real-time UI
async function streamChat(
prompt: string,
onChunk: (text: string) => void
): Promise<string> {
const stream = await groq.chat.completions.create({
model: "llama-3.3-70b-versatile",
messages: [{ role: "user", content: prompt }],
stream: true,
});
let fullResponse = "";
for await (const chunk of stream) {
const text = chunk.choices[0]?.delta?.content ?? "";
fullResponse += text;
onChunk(text);
}
return fullResponse;
}
Structured Output (JSON Mode)
// src/llm/structured.ts — Get structured JSON responses from Groq
async function extractEntities(text: string) {
const completion = await groq.chat.completions.create({
model: "llama-3.3-70b-versatile",
messages: [
{
role: "system",
content: `Extract entities from the text. Return JSON with this structure:
{ "people": [string], "organizations": [string], "locations": [string], "dates": [string] }`,
},
{ role: "user", content: text },
],
response_format: { type: "json_object" },
temperature: 0, // Deterministic for extraction
});
return JSON.parse(completion.choices[0].message.content!);
}
// Tool use / Function calling
async function chatWithTools(prompt: string, tools: any[]) {
const completion = await groq.chat.completions.create({
model: "llama-3.3-70b-versatile",
messages: [{ role: "user", content: prompt }],
tools: [
{
type: "function",
function: {
name: "get_weather",
description: "Get the current weather for a city",
parameters: {
type: "object",
properties: {
city: { type: "string", description: "City name" },
unit: { type: "string", enum: ["celsius", "fahrenheit"] },
},
required: ["city"],
},
},
},
{
type: "function",
function: {
name: "search_web",
description: "Search the web for information",
parameters: {
type: "object",
properties: {
query: { type: "string", description: "Search query" },
},
required: ["query"],
},
},
},
],
tool_choice: "auto",
});
const toolCalls = completion.choices[0].message.tool_calls;
if (toolCalls) {
for (const call of toolCalls) {
console.log(`Tool: ${call.function.name}, Args: ${call.function.arguments}`);
}
}
return completion;
}
Audio Transcription (Whisper)
// src/audio/transcribe.ts — Fast audio transcription via Groq
import fs from "fs";
async function transcribeAudio(filePath: string) {
const transcription = await groq.audio.transcriptions.create({
file: fs.createReadStream(filePath),
model: "whisper-large-v3-turbo", // Fastest Whisper model
language: "en", // Optional: specify language
response_format: "verbose_json", // Includes timestamps
temperature: 0,
});
return {
text: transcription.text,
segments: transcription.segments?.map((s: any) => ({
start: s.start,
end: s.end,
text: s.text,
})),
duration: transcription.duration,
};
}
// Translate audio to English
async function translateAudio(filePath: string) {
const translation = await groq.audio.translations.create({
file: fs.createReadStream(filePath),
model: "whisper-large-v3-turbo",
response_format: "text",
});
return translation;
}
Model Selection
// Available Groq models (as of early 2026)
const MODELS = {
// Llama 3.3 — best balance of speed and quality
"llama-3.3-70b-versatile": {
contextWindow: 128_000,
bestFor: "general-purpose, reasoning, coding",
speed: "~350 tok/s",
},
// Llama 3.1 — larger context, slightly slower
"llama-3.1-8b-instant": {
contextWindow: 128_000,
bestFor: "simple tasks, classification, extraction",
speed: "~750 tok/s",
},
// Mixtral — great for multilingual
"mixtral-8x7b-32768": {
contextWindow: 32_768,
bestFor: "multilingual, creative writing",
speed: "~500 tok/s",
},
// Gemma 2 — compact and efficient
"gemma2-9b-it": {
contextWindow: 8_192,
bestFor: "lightweight tasks, edge deployment comparison",
speed: "~600 tok/s",
},
};
// Choose model based on task
function selectModel(task: "chat" | "extract" | "code" | "fast"): string {
switch (task) {
case "chat": return "llama-3.3-70b-versatile";
case "extract": return "llama-3.1-8b-instant"; // Fast, good enough for extraction
case "code": return "llama-3.3-70b-versatile";
case "fast": return "llama-3.1-8b-instant"; // Lowest latency
}
}
Python Integration
# src/groq_client.py — Groq with Python (OpenAI-compatible)
from groq import Groq
client = Groq(api_key=os.environ["GROQ_API_KEY"])
# Basic completion
response = client.chat.completions.create(
model="llama-3.3-70b-versatile",
messages=[{"role": "user", "content": "Explain quantum computing in 3 sentences"}],
temperature=0.7,
max_tokens=200,
)
print(response.choices[0].message.content)
# With OpenAI SDK (drop-in replacement)
from openai import OpenAI
client = OpenAI(
api_key=os.environ["GROQ_API_KEY"],
base_url="https://api.groq.com/openai/v1",
)
# Same API, Groq's speed
Installation
# TypeScript/JavaScript
npm install groq-sdk
# Python
pip install groq
# Or use with any OpenAI-compatible SDK
# Just set base_url to https://api.groq.com/openai/v1
Examples
Example 1: Integrating Groq into an existing application
User request:
Add Groq to my Next.js app for the AI chat feature. I want streaming responses.
The agent installs the SDK, creates an API route that initializes the Groq client, configures streaming, selects an appropriate model, and wires up the frontend to consume the stream. It handles error cases and sets up proper environment variable management for the API key.
Example 2: Optimizing structured output performance
User request:
My Groq calls are slow and expensive. Help me optimize the setup.
The agent reviews the current implementation, identifies issues (wrong model selection, missing caching, inefficient prompting, no batching), and applies optimizations specific to Groq's capabilities — adjusting model parameters, adding response caching, and implementing retry logic with exponential backoff.
Guidelines
- Use Groq for latency-sensitive tasks — Chatbots, autocomplete, real-time analysis; Groq's speed is 5-10x faster than cloud GPU providers
- llama-3.1-8b for simple tasks — Don't use the 70B model for classification or extraction; 8B is faster and cheaper
- JSON mode for structured output — Use
response_format: { type: "json_object" }for reliable structured responses - Stream everything user-facing — With Groq's speed, streaming feels instant; still use it for perceived responsiveness
- Whisper for audio — Groq's Whisper is the fastest transcription API available; process audio files in seconds
- Rate limits vary by model — Check your rate limits in the Groq dashboard; 8B models have higher request limits
- OpenAI SDK compatibility — Switch from OpenAI to Groq by changing the base URL; no code changes needed
- Fallback to other providers — Groq can have capacity constraints during peak; have a fallback to OpenAI or Anthropic
From the file to a first result
The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.
View the source and supporting filesThis download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.
1. Download the file
Download SKILL.mdFrom the root of a test project, save the file as .skill-downloads/groq-ultra-fast-llm-inference-mrzxuq9k/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.
Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.
mkdir -p '.skill-downloads/groq-ultra-fast-llm-inference-mrzxuq9k' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/groq-ultra-fast-llm-inference-mrzxuq9k/download' --output '.skill-downloads/groq-ultra-fast-llm-inference-mrzxuq9k/SKILL.md.part' && mv '.skill-downloads/groq-ultra-fast-llm-inference-mrzxuq9k/SKILL.md.part' '.skill-downloads/groq-ultra-fast-llm-inference-mrzxuq9k/SKILL.md'2. Check prerequisites
Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.
Environment declared by the author: No special requirements
Original excerpt: Installation
# TypeScript/JavaScript
npm install groq-sdk
# Python
pip install groq
# Or use with any OpenAI-compatible SDK
# Just set base_url to https://api.groq.com/openai/v1
The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.
3. Load the skill
After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.
Claude Code
test -f '.skill-downloads/groq-ultra-fast-llm-inference-mrzxuq9k/SKILL.md' && test -s '.skill-downloads/groq-ultra-fast-llm-inference-mrzxuq9k/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/groq' && cp -R '.skill-downloads/groq-ultra-fast-llm-inference-mrzxuq9k' '.claude/skills/groq'Cursor
test -f '.skill-downloads/groq-ultra-fast-llm-inference-mrzxuq9k/SKILL.md' && test -s '.skill-downloads/groq-ultra-fast-llm-inference-mrzxuq9k/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/groq' && cp -R '.skill-downloads/groq-ultra-fast-llm-inference-mrzxuq9k' '.cursor/skills/groq'Codex
test -f '.skill-downloads/groq-ultra-fast-llm-inference-mrzxuq9k/SKILL.md' && test -s '.skill-downloads/groq-ultra-fast-llm-inference-mrzxuq9k/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/groq' && cp -R '.skill-downloads/groq-ultra-fast-llm-inference-mrzxuq9k' '.agents/skills/groq'OpenSkills
OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.
Official OpenSkills installationopenskills install './.skill-downloads/groq-ultra-fast-llm-inference-mrzxuq9k'openskills read 'groq-ultra-fast-llm-inference-mrzxuq9k'Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.
For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.
openskills syncManual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.
4. Try a first task
Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:
Read .skill-downloads/groq-ultra-fast-llm-inference-mrzxuq9k/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.
Create Interactive Maps with kepler.gl
Data & AI
Create interactive map visualizations and export standalone HTML using the keplergl Python package. Use to plot geospatial data from DataFrames, GeoJSON, or CSV.
Agent-Driven Parameter Optimization
Data & AI
Guide for optimizing configurable systems with a measurable objective, using bounded trials and evidence-based recommendations.
ICP Visitor Outreach
Data & AI
Identify signed-up users matching the ideal customer profile but stalled, and draft personalized outreach to re-engage them.