Configure Groq local development with hot reload and testing.
Use when setting up a development environment, configuring test workflows,
or establishing a fast iteration cycle with Groq.
Trigger with phrases like "groq dev setup", "groq local development",
"groq dev environment", "develop with groq".
Set up a fast, reproducible local development workflow for Groq. Groq's sub-second response times make it uniquely suited for tight dev loops -- you get LLM responses fast enough to iterate without context-switching.
Prerequisites
groq-sdk installed
GROQ_API_KEY set (free tier is fine for development)
Node.js 18+ with tsx for TypeScript execution
vitest for testing
Instructions
Step 1: Project Structure
my-groq-project/
├── src/
│ ├── groq/
│ │ ├── client.ts # Singleton Groq client
│ │ ├── models.ts # Model constants and selection
│ │ └── completions.ts # Completion wrappers
│ └── index.ts
├── tests/
│ ├── groq.test.ts # Unit tests with mocks
│ └── groq.integration.ts # Live API tests (CI-only)
├── .env.local # Local secrets (git-ignored)
├── .env.example # Template for team
└── package.json
# .env.example
# Get your key at https://console.groq.com/keys
GROQ_API_KEY=gsk_your_key_here
# Optional: override default dev model
GROQ_MODEL=llama-3.1-8b-instant
Dev Tips
Use llama-3.1-8b-instant during development (lowest quota usage, fastest)
Set temperature: 0 for deterministic outputs during debugging
Set max_tokens conservatively to avoid burning through free tier
Groq free tier: 30 RPM for 70B models, 30 RPM for 8B -- plan your dev loops accordingly