llm-cost-optimization

Diagnose LLM spending and apply context, prompt, and model optimizations with a quality gate.

10|2|Updated Mar 12, 2026
One-click install
npx skills add https://github.com/viktorbezdek/skillstack --skill llm-cost-optimization-viktorbezdek
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: llm-cost-optimization
Source: https://github.com/viktorbezdek/skillstack/tree/main/skillstack-workflows/skills/llm-cost-optimization
Command: npx skills add https://github.com/viktorbezdek/skillstack --skill llm-cost-optimization-viktorbezdek

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This workflow identifies and eliminates hidden LLM spending drivers while ensuring optimizations never degrade model output quality, preventing false savings that harm users or unit economics.

Core Features & Use Cases

  • Diagnosis with finops-for-ai: Audits for zombie features, agentic loops, context-length threshold issues, data egress, and negative unit economics using cloud-finops references.
  • Context reduction & compression: Applies context-optimization and context-compression techniques to reduce tokens per call while measuring impact on latency and cost.
  • Prompt and model rightsizing: Shortens prompts, routes to appropriate model tiers, and enforces max_tokens and batching to minimize waste.
  • Mandatory quality gate: Uses agent-evaluation as a non-negotiable gate to run before/after rubricled tests and roll back regressions.
  • Prioritization and guardrails: Produces a ranked backlog, monitoring dashboards, anomaly alerts, and spending caps to prevent regressions.
  • Use Cases: Investigating a sudden invoice spike, preparing cost containment for a feature launch, or stopping runaway agentic loops that multiply token usage.

Quick Start

Ask the agent to diagnose your LLM spend, apply context and prompt optimizations, validate every change with agent-evaluation, and produce a prioritized plan with monitoring and guardrails.

Frequently Asked Questions about llm-cost-optimization

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I reduce LLM operational costs without degrading output quality?

Reduce LLM operational costs by applying context-optimization, prompt compression, and model rightsizing while enforcing an agent-evaluation quality gate to roll back any regressions that degrade output.

What causes sudden LLM invoice spikes in production agents?

Sudden LLM invoice spikes are frequently caused by runaway agentic loops, zombie features, and context-length threshold issues, which can be diagnosed using finops-for-ai anti-pattern diagnostics.

How do I right-size prompts and models for multi-turn RAG systems?

Right-size prompts and models by shortening prompts, routing to appropriate model tiers, and enforcing max_tokens and batching to minimize token waste in multi-turn RAG systems.

Does this workflow support stopping runaway agentic loops that multiply token usage?

Yes, the workflow stops runaway agentic loops by diagnosing them with finops-for-ai, applying context compression, and deploying spending caps and anomaly alerts to prevent regressions.

What is the best way to prevent false LLM cost savings that harm unit economics?

Prevent false LLM cost savings by running a mandatory agent-evaluation quality gate with before-and-after rubric tests to ensure optimizations never negatively impact unit economics or users.

When do I need context compression for LLM features?

You need context compression for LLM features when reducing tokens per call to lower spend and latency, provided a quality gate validates that the compression does not degrade output.