| name | groq-webhooks-events |
| description | Build event-driven architectures with Groq streaming, batch processing, and async patterns.
Use when setting up real-time SSE endpoints, batch processing pipelines,
or event-driven LLM processing with Groq.
Trigger with phrases like "groq streaming", "groq events",
"groq SSE", "groq batch", "groq async", "groq event-driven".
|
| allowed-tools | Read, Write, Edit, Bash(curl:*) |
| version | 1.11.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","groq","webhooks"] |
| compatibility | Designed for Claude Code, also compatible with Codex and OpenClaw |
Groq Events & Async Patterns
Overview
Build event-driven architectures around Groq's inference API. Groq does not provide native webhooks, but its sub-second latency enables unique patterns: real-time SSE streaming, batch processing with callbacks, queue-based pipelines, and event processors that use Groq as an LLM classification/extraction engine.
This skill uses Read, Write, and Edit to scaffold and update these handlers in your codebase, and curl to exercise the resulting endpoints. Step 1 (the SSE endpoint) is inline below; the batch, webhook-processor, health-monitor, and Python async patterns live in references/implementation.md.
Prerequisites
groq-sdk (Node) or groq (Python) installed, GROQ_API_KEY set
- Queue system for batch patterns (BullMQ, Redis, SQS)
- Understanding of Server-Sent Events (SSE) for streaming
Authentication
Groq authenticates with a single API key. Export GROQ_API_KEY in the environment
and the SDK reads it automatically — never hard-code the key or embed it in a request
body. The key is a bearer credential; treat it like any secret (env var or secrets
manager, never committed). No per-request auth headers are needed when the SDK is
constructed with new Groq() / AsyncGroq().
Instructions
Write each handler as a file in your project (Read/Write/Edit), then drive it
with curl to confirm behavior.
Step 1: SSE Streaming Endpoint
Stream tokens to the browser as they are generated. Set the text/event-stream
headers, disable proxy buffering with X-Accel-Buffering: no, and write one
data: frame per token, ending with a done event.
import Groq from "groq-sdk";
import express from "express";
const groq = new Groq();
const app = ();
app.(express.());
app.(, (req, res) => {
{ messages, model = } = req.;
res.(, {
: ,
: ,
: ,
: ,
});
{
stream = groq...({
model,
messages,
: ,
: ,
});
( chunk stream) {
content = chunk.[]?.?.;
(content) {
res.();
}
}
res.();
} (: ) {
res.();
}
res.();
});