groq-multi-env-setup
Configure Groq across dev, staging, and production with environment-specific model selection, rate limits, and API keys. Trigger with phrases like "groq environments", "groq staging", "groq dev prod", "groq environment setup", "groq multi-env", "groq config by env".
Best use case
groq-multi-env-setup is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Configure Groq across dev, staging, and production with environment-specific model selection, rate limits, and API keys. Trigger with phrases like "groq environments", "groq staging", "groq dev prod", "groq environment setup", "groq multi-env", "groq config by env".
Teams using groq-multi-env-setup should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/groq-multi-env-setup/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How groq-multi-env-setup Compares
| Feature / Agent | groq-multi-env-setup | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Configure Groq across dev, staging, and production with environment-specific model selection, rate limits, and API keys. Trigger with phrases like "groq environments", "groq staging", "groq dev prod", "groq environment setup", "groq multi-env", "groq config by env".
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
AI Agents for Coding
Browse AI agent skills for coding, debugging, testing, refactoring, code review, and developer workflows across Claude, Cursor, and Codex.
Best AI Skills for Claude
Explore the best AI skills for Claude and Claude Code across coding, research, workflow automation, documentation, and agent operations.
ChatGPT vs Claude for Agent Skills
Compare ChatGPT and Claude for AI agent skills across coding, writing, research, and reusable workflow execution.
SKILL.md Source
# 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.
## 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
### Step 1: Configuration Module
```typescript
// config/groq.ts
import Groq from "groq-sdk";
interface GroqEnvConfig {
apiKey: string;
model: string;
maxTokens: number;
temperature: number;
maxRetries: number;
timeout: number;
logRequests: boolean;
}
const configs: Record<string, GroqEnvConfig> = {
development: {
apiKey: process.env.GROQ_API_KEY || "",
model: "llama-3.1-8b-instant", // Cheapest, fastest for iteration
maxTokens: 512,
temperature: 0.7,
maxRetries: 1,
timeout: 15_000,
logRequests: true, // Verbose in dev
},
staging: {
apiKey: process.env.GROQ_API_KEY_STAGING || process.env.GROQ_API_KEY || "",
model: "llama-3.3-70b-versatile", // Match production model
maxTokens: 2048,
temperature: 0.3,
maxRetries: 3,
timeout: 30_000,
logRequests: false,
},
production: {
apiKey: process.env.GROQ_API_KEY_PROD || process.env.GROQ_API_KEY || "",
model: "llama-3.3-70b-versatile", // Quality model
maxTokens: 2048,
temperature: 0.3,
maxRetries: 5, // More retries in prod
timeout: 30_000,
logRequests: false,
},
};
function getEnv(): string {
return process.env.NODE_ENV || "development";
}
export function getGroqConfig(): GroqEnvConfig {
const env = getEnv();
const config = configs[env] || configs.development;
if (!config.apiKey) {
throw new Error(
`GROQ_API_KEY not set for ${env}. ` +
(env === "development"
? "Copy .env.example to .env.local and add your key from console.groq.com/keys"
: `Set GROQ_API_KEY_${env.toUpperCase()} in your secret manager`)
);
}
return config;
}
let _client: Groq | null = null;
export function getGroqClient(): Groq {
if (!_client) {
const config = getGroqConfig();
_client = new Groq({
apiKey: config.apiKey,
maxRetries: config.maxRetries,
timeout: config.timeout,
});
}
return _client;
}
```
### Step 2: Environment-Aware Service
```typescript
// services/groq-service.ts
import { getGroqClient, getGroqConfig } from "../config/groq";
export async function complete(
messages: any[],
options?: { model?: string; maxTokens?: number }
): Promise<string> {
const groq = getGroqClient();
const config = getGroqConfig();
const model = options?.model || config.model;
const maxTokens = options?.maxTokens || config.maxTokens;
if (config.logRequests) {
console.log(`[groq:${model}] ${messages.length} messages, max_tokens=${maxTokens}`);
}
try {
const completion = await groq.chat.completions.create({
model,
messages,
max_tokens: maxTokens,
temperature: config.temperature,
});
if (config.logRequests) {
const u = completion.usage!;
console.log(`[groq:${model}] ${u.prompt_tokens}+${u.completion_tokens} tokens, ${((u as any).total_time * 1000).toFixed(0)}ms`);
}
return completion.choices[0].message.content || "";
} catch (err: any) {
if (err.status === 429) {
const retryAfter = err.headers?.["retry-after"] || "?";
console.error(`[groq:${model}] Rate limited. Retry after ${retryAfter}s`);
}
throw err;
}
}
```
### Step 3: Secret Management by Platform
```bash
set -euo pipefail
# === Development ===
# .env.local (git-ignored)
cat > .env.example << 'EOF'
# Get your API key at https://console.groq.com/keys
GROQ_API_KEY=gsk_your_dev_key_here
EOF
# === Staging (GitHub Actions) ===
gh secret set GROQ_API_KEY_STAGING --body "gsk_staging_key"
# === Production (Cloud Platforms) ===
# AWS Secrets Manager
aws secretsmanager create-secret \
--name groq/prod/api-key \
--secret-string "gsk_prod_key"
# GCP Secret Manager
echo -n "gsk_prod_key" | gcloud secrets create groq-api-key-prod --data-file=-
# HashiCorp Vault
vault kv put secret/groq/prod api_key="gsk_prod_key"
```
### Step 4: Docker Compose Multi-Env
```yaml
# docker-compose.yml
services:
app-dev:
build: .
environment:
- NODE_ENV=development
- GROQ_API_KEY=${GROQ_API_KEY}
profiles: ["dev"]
app-staging:
build: .
environment:
- NODE_ENV=staging
- GROQ_API_KEY=${GROQ_API_KEY_STAGING}
profiles: ["staging"]
app-prod:
build: .
environment:
- NODE_ENV=production
secrets:
- groq_api_key
profiles: ["prod"]
secrets:
groq_api_key:
external: true
```
### Step 5: Verify Environment Config
```typescript
// scripts/verify-groq-env.ts
import { getGroqConfig, getGroqClient } from "../config/groq";
async function verify() {
const config = getGroqConfig();
console.log(`Environment: ${process.env.NODE_ENV || "development"}`);
console.log(`Model: ${config.model}`);
console.log(`Max retries: ${config.maxRetries}`);
console.log(`API key prefix: ${config.apiKey.slice(0, 8)}...`);
const groq = getGroqClient();
const start = performance.now();
const result = await groq.chat.completions.create({
model: config.model,
messages: [{ role: "user", content: "Reply: OK" }],
max_tokens: 5,
temperature: 0,
});
console.log(`Connection: OK (${Math.round(performance.now() - start)}ms)`);
console.log(`Model response: ${result.choices[0].message.content}`);
}
verify().catch((err) => {
console.error(`FAILED: ${err.message}`);
process.exit(1);
});
```
### Step 6: Rate Limit Awareness by Environment
```bash
set -euo pipefail
# Check current rate limits for your key
curl -si https://api.groq.com/openai/v1/chat/completions \
-H "Authorization: Bearer $GROQ_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"llama-3.1-8b-instant","messages":[{"role":"user","content":"ping"}],"max_tokens":1}' \
2>/dev/null | grep -iE "^x-ratelimit"
```
## Error Handling
| Issue | Cause | Solution |
|-------|-------|----------|
| `GROQ_API_KEY not set` | Missing env var | Check .env.local (dev) or secret manager (prod) |
| Wrong model in env | Config mismatch | Verify with `verify-groq-env.ts` script |
| Rate limited in dev | Free tier limits | Use `llama-3.1-8b-instant` with low max_tokens |
| Staging/prod key in dev | Key leak risk | Use separate Groq organizations per environment |
## Resources
- [Groq Console](https://console.groq.com)
- [Groq API Keys](https://console.groq.com/keys)
- [Groq Rate Limits](https://console.groq.com/docs/rate-limits)
- [Groq Spend Limits](https://console.groq.com/docs/spend-limits)
## Next Steps
For deployment configuration, see `groq-deploy-integration`.Related Skills
windsurf-multi-env-setup
Configure Windsurf IDE and Cascade AI across team members and project environments. Use when onboarding teams to Windsurf, setting up per-project Cascade configuration, or managing Windsurf settings across development, staging, and production contexts. Trigger with phrases like "windsurf team setup", "windsurf environments", "windsurf multi-project", "windsurf team config", "cascade rules per env".
webflow-multi-env-setup
Configure Webflow across development, staging, and production environments with per-environment API tokens, site IDs, and secret management via Vault/AWS/GCP. Trigger with phrases like "webflow environments", "webflow staging", "webflow dev prod", "webflow environment setup", "webflow config by env".
vercel-multi-env-setup
Configure Vercel across development, preview, and production environments with scoped secrets. Use when setting up per-environment configuration, managing environment-specific variables, or implementing environment isolation on Vercel. Trigger with phrases like "vercel environments", "vercel staging", "vercel dev prod", "vercel environment setup", "vercel env scoping".
veeva-multi-env-setup
Veeva Vault multi env setup for enterprise operations. Use when implementing advanced Veeva Vault patterns. Trigger: "veeva multi env setup".
vastai-multi-env-setup
Configure Vast.ai GPU cloud across dev, staging, and production environments. Use when isolating GPU pools per team, managing API key separation by env, or implementing spending controls per deployment tier. Trigger with phrases like "vastai environments", "vastai staging", "vastai dev prod", "vastai multi-env".
supabase-multi-env-setup
Configure Supabase across development, staging, and production with separate projects, environment-specific secrets, and safe migration promotion. Use when setting up multi-environment deployments, isolating dev from prod data, configuring per-environment Supabase projects, or promoting migrations through environments. Trigger: "supabase environments", "supabase staging", "supabase dev prod", "supabase multi-project", "supabase env config", "database branching".
speak-multi-env-setup
Configure Speak across dev, staging, and production with separate API keys and mock modes. Use when implementing multi env setup, or managing Speak language learning platform operations. Trigger with phrases like "speak multi env setup", "speak multi env setup".
snowflake-multi-env-setup
Configure Snowflake across dev, staging, and production with account-level isolation, zero-copy clones, and environment-specific RBAC. Trigger with phrases like "snowflake environments", "snowflake staging", "snowflake dev prod", "snowflake clone", "snowflake environment setup".
windsurf-workspace-setup
Initialize Windsurf workspace with project-specific AI rules. Activate when users mention "create windsurfrules", "setup workspace", "configure project ai", "initialize windsurf workspace", or "migrate to windsurf". Handles workspace configuration and team standardization. Use when working with windsurf workspace setup functionality. Trigger with phrases like "windsurf workspace setup", "windsurf setup", "windsurf".
windsurf-multi-file-editing
Manage multi-file edits with Cascade coordination. Activate when users mention "multi-file edit", "edit multiple files", "cross-file changes", "refactor across files", or "batch modifications". Handles coordinated multi-file operations. Use when working with windsurf multi file editing functionality. Trigger with phrases like "windsurf multi file editing", "windsurf editing", "windsurf".
shopify-multi-env-setup
Configure Shopify apps across development, staging, and production environments with separate stores, API credentials, and app instances. Trigger with phrases like "shopify environments", "shopify staging", "shopify dev vs prod", "shopify multi-store", "shopify environment setup".
salesforce-multi-env-setup
Configure Salesforce across Developer, Sandbox, and Production environments with proper org management. Use when setting up multi-environment deployments, configuring per-environment credentials, or implementing sandbox-to-production promotion flows. Trigger with phrases like "salesforce environments", "salesforce sandbox", "salesforce dev prod", "salesforce org management", "salesforce sandbox types".