groq-hello-world
Provides a minimal TypeScript example to verify Groq API setup and performance.
Install
mkdir -p .claude/skills/groq-hello-world && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/6851" && unzip -o skill.zip -d .claude/skills/groq-hello-world && rm skill.zipInstalls to .claude/skills/groq-hello-world
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Create a minimal working Groq chat completion example. Use when starting a new Groq integration, testing your setup after installing the SDK, or learning the basic Groq API request/response pattern before building something larger. Trigger with phrases like "groq hello world", "groq example", "groq quick start", "simple groq code".Key capabilities
- →Generate chat completion requests using Groq SDK
- →Validate environment configuration for Groq API
- →Demonstrate basic request and response patterns
- →Print assistant reply text and total token count
How it works
The skill utilizes the Groq SDK to send a chat completion request to the LPU inference API. It logs the message content and token usage from the returned object.
Inputs & outputs
When to use groq-hello-world
- →Test Groq API installation
- →Verify GROQ_API_KEY environment variable
- →Build a basic LPU inference request
- →Quick start a Groq integration
About this skill
Groq Hello World
Overview
Build a minimal chat completion with Groq's LPU inference API. Groq uses an OpenAI-compatible endpoint, so the API shape is familiar -- but responses arrive 10-50x faster than GPU-based providers. This skill gets you from an installed SDK to a working, verified request; deeper variants (streaming, Python, model selection) live in references/.
Prerequisites
groq-sdkinstalled (npm install groq-sdk)GROQ_API_KEYenvironment variable set- Completed
groq-install-authsetup
Instructions
Use Write to create the example file, then run it to confirm your key and SDK work. Start with the single basic request below; reach for the reference variants only once this succeeds.
Step 1: Basic Chat Completion (TypeScript)
import Groq from "groq-sdk";
const groq = new Groq();
async function main() {
const completion = await groq.chat.completions.create({
model: "llama-3.3-70b-versatile",
messages: [
{ role: "system", content: "You are a helpful assistant." },
{ role: "user", content: "What is Groq's LPU and why is it fast?" },
],
});
console.log(completion.choices[0].message.content);
console.log(`Tokens: ${completion.usage?.total_tokens}`);
}
main().catch(console.error);
Step 2: Go deeper (references)
Once Step 1 returns text, extend it with the moved-out variants:
- Streaming tokens as they generate, plus the Python equivalent and a model-selection cheat sheet — references/examples.md.
- Full model catalog (IDs, params, context, speed) and the complete response interface — references/models-and-response.md.
Output
A successful run prints the assistant's reply text followed by the total token count, e.g.:
Groq's LPU (Language Processing Unit) is a deterministic, single-core
inference chip... [assistant response continues]
Tokens: 142
The underlying API returns an OpenAI-compatible ChatCompletion object: the text is at choices[0].message.content, and usage carries token counts plus four Groq-specific timing fields (queue_time, prompt_time, completion_time, total_time). Full response shape: references/models-and-response.md.
Error Handling
| Error | Cause | Solution |
|---|---|---|
401 Invalid API Key | Key not set or invalid | Check GROQ_API_KEY env var |
model_not_found | Typo in model ID or deprecated model | Check model list at console.groq.com/docs/models |
429 Rate limit | Free tier: 30 RPM on large models | Wait for retry-after header value |
context_length_exceeded | Prompt + max_tokens > model context | Reduce prompt size or set lower max_tokens |
Examples
- Minimal request — the TypeScript block in Step 1 above is the canonical hello-world; run it as-is after setting
GROQ_API_KEY. - Streaming a response — see references/examples.md for the
stream: trueloop that writes tokens to stdout as they arrive. - Python equivalent — the same request in Python: references/examples.md.
- Choosing a model per task (speed vs. quality vs. vision) — references/examples.md.
Resources
- Groq Text Generation Docs
- Groq Models Reference
- Groq API Reference
- Next: proceed to
groq-local-dev-loopfor development workflow setup.
When not to use it
- →When requiring streaming responses
- →When performing model selection based on specific task needs
Prerequisites
Limitations
- →Requires manual extension for streaming functionality
- →Limited to basic request patterns
How it compares
This workflow provides a verified, minimal TypeScript implementation to confirm SDK and API key functionality before building complex integrations.
Compared to similar skills
groq-hello-world side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| groq-hello-world (this skill) | 1 | 26d | No flags | Beginner |
| twinmind-local-dev-loop | 1 | 26d | Caution | Beginner |
| write-test | 1 | 5mo | Review | Advanced |
| deepgram-hello-world | 1 | 26d | Review | Beginner |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by jeremylongshore
View all by jeremylongshore →You might also like
twinmind-local-dev-loop
jeremylongshore
Set up local development workflow with TwinMind API integration. Use when building applications that integrate TwinMind transcription, testing API calls locally, or developing meeting automation tools. Trigger with phrases like "twinmind dev setup", "twinmind local development", "twinmind API testing", "build with twinmind".
write-test
useautumn
Write integration tests for the Autumn billing system. Use when creating tests, writing test scenarios for billing/subscription features, track/check endpoints, or when the user asks about testing, test cases, or QA.
deepgram-hello-world
jeremylongshore
Create a minimal working Deepgram transcription example. Use when starting a new Deepgram integration, testing your setup, or learning basic Deepgram API patterns. Trigger with phrases like "deepgram hello world", "deepgram example", "deepgram quick start", "simple transcription", "transcribe audio".
speak-hello-world
jeremylongshore
Create a minimal working Speak language learning example. Use when starting a new Speak integration, testing your setup, or learning basic Speak API patterns for language tutoring. Trigger with phrases like "speak hello world", "speak example", "speak quick start", "simple speak lesson".
exa-local-dev-loop
jeremylongshore
Configure Exa local development with hot reload and testing. Use when setting up a development environment, configuring test workflows, or establishing a fast iteration cycle with Exa. Trigger with phrases like "exa dev setup", "exa local development", "exa dev environment", "develop with exa".
instantly-local-dev-loop
jeremylongshore
Configure Instantly local development with hot reload and testing. Use when setting up a development environment, configuring test workflows, or establishing a fast iteration cycle with Instantly. Trigger with phrases like "instantly dev setup", "instantly local development", "instantly dev environment", "develop with instantly".