Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Optimizes Groq API inference costs via model routing, token limits, batching, caching, and usage monitoring.
55% 86%+32 ptsof test cases passed
Passed 19 of 22 test cases with the skill, and 12 of 22 without it.
We need to structure our daily spend reporting function that aggregates tracked token usage. What exact key names must be present in the returned summary object?
Includes totalCost property in report object
3 of 3 safety checks passed
This reference holds the complete, copy-pasteable code for each of the six cost-tuning levers. The parent SKILL.md summarizes the workflow; drill in here for the full implementation of each step.
Route each use case to the cheapest model that still meets its quality bar. Classification on the 8B model costs ~$0.05/M input vs ~$0.59/M on 70B — a 12x per-request saving at high volume.
import Groq from "groq-sdk";
const groq = new Groq();
// Route to cheapest model that meets quality requirements
interface ModelConfig {
model: string;
inputCostPer1M: number;
outputCostPer1M: number;
}
const ROUTING: Record<string, ModelConfig> = {
classification: { model: "llama-3.1-8b-instant", inputCostPer1M: 0.05, outputCostPer1M: 0.08 },
extraction: { model: "llama-3.1-8b-instant", inputCostPer1M: 0.05, outputCostPer1M: 0.08 },
summarization: { model: "llama-3.1-8b-instant", inputCostPer1M: 0.05, outputCostPer1M: 0.08 },
reasoning: { model: "llama-3.3-70b-versatile", inputCostPer1M: 0.59, outputCostPer1M: 0.79 },
codeReview: { model: "llama-3.3-70b-versatile", inputCostPer1M: 0.59, outputCostPer1M: 0.79 },
chat: { model: "llama-3.3-70b-versatile", inputCostPer1M: 0.59, outputCostPer1M: 0.79 },
vision: { model: "meta-llama/llama-4-scout-17b-16e-instruct", inputCostPer1M: 0.11, outputCostPer1M: 0.34 },
};
function getModel(useCase: string): string {
return ROUTING[useCase]?.model || "llama-3.1-8b-instant";
}
// Classification on 8B: $0.05/M vs 70B: $0.59/M = 12x savings
Next to this one in the catalogue, plus more from the same author.