Agent skill

Groq Reference Architecture

by jeremylongshore in jeremylongshore/tons-of-skills-marketplace

Implement Groq reference architecture with model routing, streaming pipelines, and fallbacks.

MITAuto-check passedAI & LLM Engineering

Install Groq Reference Architecture

skills CLI
$ npx skills add jeremylongshore/tons-of-skills-marketplace --skill groq-reference-architecture -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install jeremylongshore/tons-of-skills-marketplace groq-reference-architecture --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/jeremylongshore/tons-of-skills-marketplace.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/.curated/groq-reference-architecture .claude/skills/groq-reference-architecture && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
groq-reference-architecture
GitHub stars
2.8k
Token cost
~1.7k tokens
SKILL.md length
649 words
Files
4 (incl. references)
Skills in repo
3,342
Repo updated
First seen
Licence
MIT

At a glance

Implement Groq reference architecture with model routing, streaming pipelines, and fallbacks.

  • Works in 5 steps: Model Registry (models.ts) — declare a… → Model Router (router.ts) —… → Middleware (middleware.ts) —… → …
  • Designing new Groq integrations
  • SKILL.md covers Overview, Prerequisites, Instructions and Integration Patterns, plus 5 more sections
  • Calls npm; needs GROQ_API_KEY

What it does

Groq Reference Architecture is an agent skill from jeremylongshore/tons-of-skills-marketplace. Implement Groq reference architecture with model routing, streaming pipelines, and fallbacks. Use when designing new Groq integrations, reviewing project structure, or establishing architecture standards for Groq applications. Trigger with phrases like "groq architecture", "groq best practices", "groq project structure", "how to organize groq", "groq design".

Its SKILL.md is about 1.7k tokens, which your agent loads only when the skill is triggered. The skill folder holds 4 other files, including reference files (for example `references/architecture.md`, `references/examples.md` and `references/implementation.md`). Compatibility notes: Designed for Claude Code

It sits in AI & LLM Engineering, covering Model routing and gateways. The repository describes itself as: Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com. The licence is MIT.

When your agent uses it

  • Designing new Groq integrations
  • Reviewing project structure
  • Establishing architecture standards for Groq applications
  • With phrases like groq architecture

Example prompts

  • “groq architecture”
  • “groq best practices”
  • “groq project structure”
  • “/groq-reference-architecture”

Requirements

  • Node.js
  • A credential in GROQ_API_KEY
  • Compatibility (from SKILL.md): Designed for Claude Code
  • Pre-approved tools (allowed-tools): Read, Grep

Workflow steps

5 steps, taken from the first numbered list in SKILL.md.

  1. Model Registry (models.ts) — declare a ModelSpec for each model with
  2. Model Router (router.ts) — selectModel(req) maps requirements
  3. Middleware (middleware.ts) — completionWithMiddleware() wraps each call
  4. Fallback Chain (fallback.ts) — completionWithFallback() tries the
  5. Streaming Pipeline (streaming.ts) — streamCompletion() is an async

What it can do on your machine

Read from SKILL.md and the folder at commit cfae287. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Grep

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • npm

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • console.groq.com
    • groq.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • GROQ_API_KEY

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Designed for Claude Code

    From compatibility in the SKILL.md frontmatter.

Context cost

Groq Reference Architecture loads about 1.7k tokens when it runs, and up to ~4.9k if it reads all its reference files. Until then it costs about 97 tokens; SKILL.md has 649 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~97
When it runs · the whole SKILL.md, loaded when a task matches
~1.7k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~4.9k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from jeremylongshore/tons-of-skills-marketplace at commit cfae287, republished under its MIT licence (© jeremylongshore). 649 words, ~1,719 tokens.

Download SKILL.mdSave it as .claude/skills/groq-reference-architecture/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.
name
groq-reference-architecture
description
Implement Groq reference architecture with model routing, streaming pipelines, and fallbacks. Use when designing new Groq integrations, reviewing project structure, or establishing architecture standards for Groq applications. Trigger with phrases like "groq architecture", "groq best practices", "groq project structure", "how to organize groq", "groq design".
allowed-tools
Read, Grep
compatibility
Designed for Claude Code
version
1.11.0
license
MIT
author
Jeremy Longshore <jeremy@intentsolutions.io>
tags
saas, groq, groq-reference

Groq Reference Architecture

Overview

Production architecture for applications built on Groq's LPU inference API. It covers four concerns that every serious Groq integration needs: routing requests to the right model by latency/capability/cost, a middleware band (cache, metrics, retry), a multi-provider fallback chain, and a streaming pipeline. The service layer built here is reusable across a chat UI, an API backend, a batch processor, or an agent.

The full layer diagram and how the pieces interact lives in references/architecture.md; the complete, copy-ready TypeScript for every layer is in references/implementation.md.

Prerequisites

  • Groq API key — create one at console.groq.com and export it as GROQ_API_KEY. The Groq SDK reads it from the environment; the client is constructed as new Groq({ apiKey: process.env.GROQ_API_KEY }). Never hardcode the key.
  • Runtime: Node.js 18+ (for performance.now() and native fetch).
  • Packages: groq-sdk and lru-cache (npm install groq-sdk lru-cache).
  • Optional backup provider: an OpenAI-compatible key if you extend the fallback chain beyond Groq's own models.

Instructions

Build the service layer in five ordered steps. Each step is one file under src/groq/. The router depends on the registry; the middleware and fallback depend on the client; the streaming pipeline stands alone. Full source for every step (verbatim) is in references/implementation.md.

  1. Model Registry (models.ts) — declare a ModelSpec for each model with its tier, context window, speed, cost, and capabilities. Skeleton:

    typescript
    export const MODELS: Record<string, ModelSpec> = {
      "llama-3.1-8b-instant":     { tier: "speed",   /* fast, cheap */ },
      "llama-3.3-70b-versatile":  { tier: "quality", /* tools + JSON */ },
      "meta-llama/llama-4-scout-17b-16e-instruct": { tier: "vision" },
      "whisper-large-v3-turbo":   { tier: "audio" },
    };
  2. Model Router (router.ts) — selectModel(req) maps requirements (maxLatencyMs, needsVision, needsTools, costSensitive) to the cheapest model that satisfies them. Callers pass requirements, never hardcoded ids.

  3. Middleware (middleware.ts) — completionWithMiddleware() wraps each call with an LRU cache (deterministic requests only, temperature === 0), latency + token metrics, and a pluggable metrics sink.

  4. Fallback Chain (fallback.ts) — completionWithFallback() tries the primary model, drops to a model in a different rate-limit pool on 429/5xx, then returns a graceful-degradation payload instead of throwing.

  5. Streaming Pipeline (streaming.ts) — streamCompletion() is an async generator yielding { type: "token" | "done" | "error" } for real-time SSE UIs.

When applying this to an existing repo, Read the current src/ layout and Grep for direct groq.chat.completions.create calls to find code that should route through the middleware and fallback wrappers instead.

Integration Patterns

PatternWhen to UseGroq Feature
Direct completionSimple request/responsechat.completions.create
Streaming SSEReal-time chat UIstream: true
Tool callingAgent with function executiontools parameter
JSON extractionStructured data from textresponse_format: json_object
Batch processingHigh-volume document processingQueue + rate limiting
Audio transcriptionVoice inputaudio.transcriptions.create
Vision analysisImage understandingLlama 4 Scout/Maverick
Show full SKILL.md (250 more words)Show less

Output

Applying this skill produces a src/groq/ service layer with six files (client.ts, models.ts, router.ts, middleware.ts, fallback.ts, streaming.ts) plus the service and API layers that consume it. At runtime you get:

  • Routed completions — selectModel() returns a ModelSpec; callers never hardcode a model id, so cost/latency policy lives in one place.
  • Cached deterministic responses — repeated temperature: 0 calls return from the LRU cache instead of re-billing the API.
  • Resilient calls — completionWithFallback() returns a valid completion shape even when Groq is rate-limited, never surfacing a raw 429 to the user.
  • Streamed tokens — streamCompletion() yields { type, content } events for SSE, with a terminal done or error event.
  • Metrics — every call emits { model, latencyMs, tokens, cached } to your metrics sink (Prometheus, Datadog, or console.log by default).

Error Handling

IssueCauseSolution
429 on primary modelRPM/TPM exceededFall back to different model
High latencyWrong model tierRoute to 8b-instant for latency-critical paths
Context overflowInput > 128K tokensTruncate or chunk input
Vision errorsWrong model for imagesUse Llama 4 Scout full model path
GROQ_API_KEY undefinedEnv var not exportedExport the key before starting the process

Examples

A latency-critical chat turn routes to the speed tier and returns one completion:

typescript
const model = selectModel({ maxLatencyMs: 80, costSensitive: true });
// → llama-3.1-8b-instant
const res = await completionWithMiddleware(groq, model.id, messages);

Streaming a UI consumes the async generator token-by-token:

typescript
for await (const event of streamCompletion(groq, messages)) {
  if (event.type === "token") process.stdout.write(event.content!);
}

Four fully worked examples — latency-critical, quality-with-fallback, streaming, and vision routing — are in references/examples.md.

Resources

Next Steps

For multi-environment deployment, see the groq-multi-env-setup skill, which extends this service layer with per-environment configuration and secrets handling.

© jeremylongshore, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 3 other files (references) in skills/.curated/groq-reference-architecture of jeremylongshore/tons-of-skills-marketplace.

  • SKILL.md
  • references/architecture.md
  • references/examples.md
  • references/implementation.md

Open the folder on GitHubat commit cfae287

Compare with similar skills

Groq Reference Architecture next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Groq Reference Architecture compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Groq Reference Architecture this skilljeremylongshore/tons-of-skills-marketplace2.8k—~1.7kAutomated safety check: PassMIT
Shogun Bloom Configyohey-w/multi-agent-shogun1.4k—~3.1kAutomated safety check: PassMIT
Codemie Analyticscodemie-ai/codemie-code294—~7.5kAutomated safety check: PassApache-2.0
Model Routernidhi-singh02/agent-router112—~1.2kAutomated safety check: PassMIT
Codex Model Routing Teamzjp1997720/codex-model-routing-team158—~736Automated safety check: PassMIT
Add Modelget-convex/convex-evals130—~1.5kAutomated safety check: NotesApache-2.0

Similar skills

  • Shogun Bloom Config

    yohey-w/multi-agent-shogun

    Interactive wizard: guided questions with multiple-choice options about subscriptions, then outputs a ready-to-paste capabilitytiers YAML + fixed agent model assignments.

    1.4k GitHub stars~3.1k tokensUpdated 2 mo ago
    AI & LLM EngineeringAuto-check passed
  • Codemie Analytics

    codemie-ai/codemie-code

    CodeMie Analytics expert — use this skill whenever the user asks about CodeMie usage data, AI adoption metrics, user leaderboards, CLI insights, spending, LiteLLM costs, token usage, or wants to…

    294 GitHub stars~7.5k tokensUpdated 2 days ago
    AI & LLM EngineeringAuto-check passed
  • Model Router

    nidhi-singh02/agent-router

    A skill your agent uses when the user asks to pick a model, subscription, or reasoning effort, or to run router status, usage refresh, or resume a router session.

    112 GitHub stars~1.2k tokensUpdated 14 days ago
    AI & LLM EngineeringAuto-check passed
  • Codex Model Routing Team

    zjp1997720/codex-model-routing-team

    在 Codex App 中为复杂、可并行的知识工作或编程任务自动创建多个可指定模型与推理强度的后台任务,由主 Agent 负责规划、分工、集成和验收。用于多来源调研、多章节内容、复杂 Skill/PPT、跨模块开发、独立验证或 2 个以上互不依赖工作流;也用于用户明确要求模型路由、后台 Worker、Agents Team…

    158 GitHub stars~736 tokensUpdated 2 mo ago
    AI & LLM EngineeringAuto-check passed
  • Add Model

    get-convex/convex-evals

    Add a new model to the convex-evals coding leaderboard, and optionally the decision benchmark, through a PR, then dispatch its baseline runs.

    130 GitHub stars~1.5k tokensUpdated yesterday
    AI & LLM EngineeringAuto-check: notes
  • OmniRoute CLI Evals

    diegosouzapw/OmniRoute

    Creates and runs LLM evaluation suites from the omniroute CLI, follows live runs, shows scorecards, compares models and ties eval runs into CI.

    75k GitHub stars~1.3k tokensUpdated today
    AI & LLM EngineeringAuto-check passed

More from jeremylongshore/tons-of-skills-marketplace

All 3,342 skills in this repo
  • Performing Security Code Review

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to conduct a security-focused code review using the security-agent plugin.

    2.8k GitHub starsUsed in 2 repos~1.3k tokens
    Auto-check: notes
  • Adapting Transfer Learning Models

    jeremylongshore/tons-of-skills-marketplace

    Build this skill automates the adaptation of pre-trained machine learning models using transfer learning techniques.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Agent Context Loader

    jeremylongshore/tons-of-skills-marketplace

    Execute proactive auto-loading: automatically detects and loads agents.md files.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Aggregating Performance Metrics

    jeremylongshore/tons-of-skills-marketplace

    Aggregate and centralize performance metrics from applications, systems, databases, caches, and services.

    2.8k GitHub stars~1.2k tokensUpdated today
    Auto-check passed
  • Analyzing Capacity Planning

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to analyze capacity requirements and plan for future growth.

    2.8k GitHub stars~947 tokensUpdated today
    Auto-check passed
  • Analyzing Database Indexes

    jeremylongshore/tons-of-skills-marketplace

    Process use when you need to work with database indexing. An agent skill from jeremylongshore/tons-of-skills-marketplace.

    2.8k GitHub stars~2k tokensUpdated today
    Auto-check passed

Questions about Groq Reference Architecture

What does Groq Reference Architecture do?

Implement Groq reference architecture with model routing, streaming pipelines, and fallbacks. Groq Reference Architecture is an agent skill from jeremylongshore/tons-of-skills-marketplace. Implement Groq reference architecture with model routing, streaming pipelines, and fallbacks.

When should I use Groq Reference Architecture?

Groq Reference Architecture fits situations like: designing new Groq integrations; reviewing project structure; establishing architecture standards for Groq applications; with phrases like groq architecture.

How do I install Groq Reference Architecture in Claude Code?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill groq-reference-architecture -a claude-code`. Or copy the skill folder (skills/.curated/groq-reference-architecture in jeremylongshore/tons-of-skills-marketplace) into .claude/skills/groq-reference-architecture in your project. Claude Code loads it when a task matches its description.

How do I install Groq Reference Architecture in Codex?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill groq-reference-architecture -a codex`. Or copy the skill folder (skills/.curated/groq-reference-architecture in jeremylongshore/tons-of-skills-marketplace) into .agents/skills/groq-reference-architecture in your project. Codex loads it when a task matches its description.

Can I use Groq Reference Architecture in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill groq-reference-architecture -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/groq-reference-architecture, .gemini/skills/groq-reference-architecture, .github/skills/groq-reference-architecture and .opencode/skills/groq-reference-architecture in your project.

What does Groq Reference Architecture need to run?

Going by SKILL.md and its folder, Groq Reference Architecture needs the command-line tools its instructions call (npm) and credentials named GROQ_API_KEY. Our summary lists: Node.js; A credential in GROQ_API_KEY. Its frontmatter pre-approves these tools: Read, Grep. Compatibility (from SKILL.md): Designed for Claude Code.

Does Groq Reference Architecture access the network?

SKILL.md names 2 domains. As links in the text: console.groq.com and groq.com. This is read from the text; nothing was executed.

Is Groq Reference Architecture safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Groq Reference Architecture use?

Groq Reference Architecture is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Groq Reference Architecture use?

About 1.7k tokens (SKILL.md is roughly 6.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 3.2k tokens, read only when the agent opens those files.

What are the alternatives to Groq Reference Architecture?

Skills that share tags, products or a category with Groq Reference Architecture: Shogun Bloom Config (yohey-w/multi-agent-shogun, 1.4k stars), Codemie Analytics (codemie-ai/codemie-code, 294 stars), Model Router (nidhi-singh02/agent-router, 112 stars) and Codex Model Routing Team (zjp1997720/codex-model-routing-team, 158 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Groq Reference Architecture?

jeremylongshore (a GitHub user) maintains it in jeremylongshore/tons-of-skills-marketplace, which has 2,827 GitHub stars. The repository holds 3,342 skills in this directory. The repository was last updated on October 10, 2026.

Source: jeremylongshore/tons-of-skills-marketplace on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.