groq-sdk-patterns

Featured

Apply production-ready Groq SDK patterns for TypeScript and Python. Use when implementing Groq integrations, refactoring SDK usage, or establishing team coding standards for Groq. Trigger with phrases like "groq SDK patterns", "groq best practices", "groq code patterns", "idiomatic groq".

AI & Automation 2,266 stars 315 forks Updated today MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# 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 `queue_time` and `completion_time`. ## Prerequisites - `groq-sdk` installed - Understanding of async/await and error handling - Familiarity with OpenAI SDK patterns (Groq is API-compatible) ## Instructions ### Step 1: Typed Client Singleton ```typescript // src/groq/client.ts import Groq from "groq-sdk"; let _client: Groq | null = null; export function getGroq(): Groq { if (!_client) { _client = new Groq({ apiKey: process.env.GROQ_API_KEY, maxRetries: 3, timeout: 30_000, }); } return _client; } ``` ### Step 2: Type-Safe Completion Wrapper ```typescript import Groq from "groq-sdk"; import type { ChatCompletionMessageParam } from "groq-sdk/resources/chat/completions"; const groq = getGroq(); interface CompletionResult { content: string; model: string; tokens: { prompt: number; completion: number; total: number }; timing: { queueMs: number; totalMs: number; tokensPerSec: number }; } async function complete( messages: ChatCompletionMessageParam[], model = "llama-3.3-70b-versatile", options?: { maxTokens?: number; temperature?: number } ): Promise<CompletionResult> { const response = await groq.chat.compl...

Details

Author
jeremylongshore
Repository
jeremylongshore/claude-code-plugins-plus-skills
Created
7 months ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category

AI & Automation Featured

groq-hello-world

Create a minimal working Groq chat completion example. Use when starting a new Groq integration, testing your setup, or learning basic Groq API patterns. Trigger with phrases like "groq hello world", "groq example", "groq quick start", "simple groq code".

2,266 Updated today
jeremylongshore
AI & Automation Featured

grammarly-sdk-patterns

Apply production-ready Grammarly SDK patterns for TypeScript and Python. Use when implementing Grammarly integrations, refactoring SDK usage, or establishing team coding standards for Grammarly. Trigger with phrases like "grammarly SDK patterns", "grammarly best practices", "grammarly code patterns", "idiomatic grammarly".

2,266 Updated today
jeremylongshore
AI & Automation Featured

anth-sdk-patterns

Apply production-ready Anthropic SDK patterns for TypeScript and Python. Use when implementing Claude integrations, building reusable wrappers, or establishing team coding standards for the Messages API. Trigger with phrases like "anthropic SDK patterns", "claude best practices", "anthropic code patterns", "production claude code".

2,266 Updated today
jeremylongshore
AI & Automation Featured

intercom-sdk-patterns

Apply production-ready intercom-client SDK patterns for TypeScript. Use when implementing Intercom integrations, refactoring SDK usage, or establishing team coding standards for Intercom API calls. Trigger with phrases like "intercom SDK patterns", "intercom best practices", "intercom code patterns", "idiomatic intercom", "intercom typescript".

2,266 Updated today
jeremylongshore
AI & Automation Featured

shopify-sdk-patterns

Apply production-ready patterns for @shopify/shopify-api including typed GraphQL clients, session management, and retry logic. Use when implementing Shopify integrations, refactoring SDK usage, or establishing team coding standards for Shopify. Trigger with phrases like "shopify SDK patterns", "shopify best practices", "shopify code patterns", "idiomatic shopify", "shopify client wrapper".

2,266 Updated today
jeremylongshore