Agent skill · software engineering · jeremylongshore

groq-sdk-patterns

Apply production-ready Groq SDK patterns for TypeScript and Python.

Why this skill is useful

Provides specific implementation patterns and error handling strategies for the Groq SDK that the AI wouldn't reliably generate on its own.

What it needs

Requires groq, groq-sdk installed locally. Requires groq account access. About 3k tokens when loaded. Last updated 2026-08-07. 2,604 stars on the source repository.

What this skill does

Groq SDK Patterns Overview Production patterns for the groq-sdk package. The Groq SDK mirrors the OpenAI SDK interface (chat.completions.create), so patterns feel familiar but must account for Groq-specific behavior: extreme speed (500+ tok/s), aggressive rate limits on free tier, and unique response metadata like queuetime and completiontime. The full, copy-paste-ready implementations live in references/ so this file stays a fast map of the workflow. Read the summary here, then drill into the language file you need. Prerequisites groq-sdk (TypeScript) or groq (Python) installed GROQAPIKEY set in the environment Understanding of async/await and error handling Familiarity with OpenAI SDK patterns (Groq is API-compatible) Instructions Build the integration in layers. Each step below is a one-line summary; the full typed implementation is in references/typescript-patterns.md (steps 1–5, 7) and references/python-patterns.md (step 6). 1. Typed client singleton — one shared Groq client with maxRetries and timeout, so the whole app reuses one connection pool and config. 2. Type-safe completion wrapper — return a typed result that surfaces Groq's unique timing fields (queuetime, completiontime, totaltime) and a computed tokensPerSec. 3. Streaming with typed events — an AsyncGenerator<string> that yields delta.content tokens. 4. Error handling with Groq error types — branch on Groq.APIError (429, 401, other) and Groq.APIConnectionError; rethrow the unknown. 5. Retry with exponential backoff — honor the retry-after header on 429s, else jittered backoff. 6. Python patterns — sync Groq(), AsyncGroq(), and streaming (see the Python reference). 7. Multi-tenant client factory — cache one client per tenant so API keys stay isolated. The essential skeleton — a shared singleton every other pattern builds on: Groq differs from OpenAI in a few details (package name, base URL, extra usage timing fields, error class names). …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills jeremylongshore/groq-sdk-patterns

View the source on GitHub

Browse the @skills marketplace