| name | groq-core-workflow-a |
| description | Execute Groq's primary workflow: chat completions with tool use and JSON mode.
Use when implementing chat interfaces, function calling, structured output,
or building AI features with Groq's fast inference.
Trigger with phrases like "groq chat completion", "groq tool use",
"groq function calling", "groq JSON mode".
|
| allowed-tools | Read, Write, Edit, Bash(npm:*) |
| version | 1.11.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","groq","workflow"] |
| compatibility | Designed for Claude Code, also compatible with Codex and OpenClaw |
Groq Core Workflow A: Chat, Tools & Structured Output
Overview
Primary integration patterns for Groq: chat completions, tool/function calling, JSON mode, and structured outputs. Groq's LPU delivers sub-200ms time-to-first-token, making these patterns viable for real-time user-facing features. This skill walks through five workflow steps; the lean skeleton lives here, and the full copy-paste code lives in references/.
Prerequisites
- Install the SDK with
npm install groq-sdk.
- Set
GROQ_API_KEY in the environment (see Authentication below).
- Familiarity with the Groq model line-up and which model fits each task.
Authentication
Groq authenticates via an API key. Create one at console.groq.com/keys and
export it as GROQ_API_KEY; the SDK reads it automatically, so new Groq()
needs no explicit argument. Never hardcode the key — read it from the
environment (or a secrets manager) so it stays out of source control.
Model Selection for This Workflow
| Task | Recommended Model | Why |
|---|
| Chat with tools | llama-3.3-70b-versatile | Best tool-calling accuracy |
| JSON extraction | llama-3.1-8b-instant | Fast, accurate for structured tasks |
| Structured outputs | llama-3.3-70b-versatile | Supports strict: true schema compliance |
| Vision + chat | meta-llama/llama-4-scout-17b-16e-instruct | Multimodal input |
Instructions
Work through the five patterns in order. Read the target file, then Write or
Edit the integration code into your project.
- Chat completion — send
system + user messages to
groq.chat.completions.create and return choices[0].message.content plus
usage. Skeleton below; full example in
worked examples.
- Tool use / function calling — a three-phase loop: send the message with
tools + tool_choice: "auto", execute any returned , then send
the results back for the final answer. Full code in
.