| name | groq-multi-env-setup |
| description | Use when you need Groq to behave differently across dev, staging, and
production — cheap fast models and verbose logs in dev, the production model
and hardened retries everywhere else, with per-environment API keys.
Configure environment-specific model selection, rate limits, and secrets.
Trigger with phrases like "groq environments", "groq staging", "groq dev prod",
"groq environment setup", "groq multi-env", "groq config by env".
|
| allowed-tools | Read, Write, Edit, Bash(aws:*), Bash(gcloud:*), Bash(vault:*) |
| version | 1.11.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","groq","deployment","api","llm"] |
| compatibility | Designed for Claude Code, also compatible with Codex and OpenClaw |
Groq Multi-Environment Setup
Overview
Configure Groq API access across development, staging, and production with the right model, rate limit strategy, and secret management per environment. Key insight: use llama-3.1-8b-instant in development (cheapest, fastest), match production model in staging, and harden production with retries and fallbacks.
Prerequisites
- A Groq account with API keys from console.groq.com/keys — ideally a separate key (or organization) per environment.
- Node project with the
groq-sdk package installed (npm install groq-sdk).
NODE_ENV set per environment (development / staging / production).
- A secret store for staging/production keys: GitHub Actions secrets, AWS Secrets Manager, GCP Secret Manager, or HashiCorp Vault.
Environment Strategy
| Environment | API Key Source | Default Model | Retry | Logging |
|---|
| Development | .env.local | llama-3.1-8b-instant | 1 | Verbose |
| Staging | CI/CD secrets | llama-3.3-70b-versatile | 3 | Standard |
| Production | Secret manager | llama-3.3-70b-versatile | 5 | Structured |
Instructions
The full, copy-paste implementation lives in the reference files — this section
is the map. Read the implementation walkthrough
for the code module, service wrapper, and verify script, and
secrets & deployment for per-platform
key management, Docker Compose profiles, and rate-limit inspection.
-
Build the config module (config/groq.ts). One configs record keyed by
environment resolves model, token budget, retries, timeout, and logging, then
validates that a key is present with an environment-specific error message.
The essential skeleton:
const configs: Record<, > = {
: { : , : , : , },
: { : , : , : , },
: { : , : , : , },
};
(): {
configs[process.. || ] || configs.;
}