llm-cost-optimization

Optimizes LLM token spend on Azure through caching, routing, compression, and deployment pricing strategies.

1|Updated Aug 10, 2026
One-click install
npx skills add https://github.com/TheViziusGroup/vibe-engineering-skills --skill llm-cost-optimization-theviziusgroup
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: llm-cost-optimization
Source: https://github.com/TheViziusGroup/vibe-engineering-skills/tree/main/plugins/ai-and-data/skills/llm-cost-optimization
Command: npx skills add https://github.com/TheViziusGroup/vibe-engineering-skills --skill llm-cost-optimization-theviziusgroup

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? LLM API bills grow unpredictably because teams lack guidance on token economics, caching, model routing, and Azure deployment pricing, leading to overspending on frontier models for routine tasks. ## Core Features & Use Cases - Cost Levers & Pricing Models: Covers prompt caching (Azure, Anthropic, Google), Batch API discounts, PTU vs PAYG break-even analysis, and PTU spillover configuration. - Prompt & Context Compression: Documents LLMLingua, LongLLMLingua, RECOMP, Selective Context, token-lean serialization formats (TOON, YAML vs JSON/XML), and output verbosity control techniques like Chain-of-Draft. - Architecture Patterns: Provides APIM AI gateway policies, semantic caching with Redis, model routing via RouteLLM, fine-tuning distillation, and a staged implementation roadmap with expected savings per recipe. - Use Case: A team spending heavily on Azure OpenAI RAG workloads applies the stable-prefix caching rule, routes routine queries to mini-class models, and moves nightly jobs to the Batch API to cut spend by 50% or more. ## Quick Start Analyze my Azure OpenAI workload and recommend concrete steps to reduce token costs without hurting quality.

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 Azure OpenAI token costs in production?

Start with the three highest-ROI levers: route routine traffic to cheaper models, restructure prompts for a stable cached prefix, and use Batch API or PTU reservations where workloads fit. Instrument per-request token usage first so savings are measurable.

How does prompt caching work on Azure OpenAI?

Azure caching is automatic with roughly 50% off input tokens once the first 1,024 tokens form an identical prefix, accruing hits every 128 tokens after. Place stable content first and dynamic content last, since any byte drift before the cache boundary invalidates the prefix.

When should I choose PTU over pay-as-you-go pricing?

PTU generally wins above roughly 50% sustained utilization and 150-200M tokens per month on GPT-4o-class models. Deploy first, gather 30-60 days of telemetry, then buy reservations since they guarantee discount, not capacity.

LLMLingua vs extractive compression for long context?

Research shows extractive compression, which selects whole sentences, often outperforms token-pruning methods and enables up to 10x compression with minimal accuracy loss. Use perplexity-based pruning like LLMLingua mainly for query-aware long-context RAG scenarios.

Why is my Azure prompt cache hit rate near zero?

The most common cause is dynamic content placed before static content, such as a timestamp in the system prompt, which invalidates the cached prefix. Verify hits via the cached_tokens field in the API usage object.

Do Microsoft Azure credits cover third-party marketplace models?

No. Microsoft for Startups credits cover only models sold directly by Azure, such as Azure OpenAI. Third-party Marketplace models like Anthropic Claude or Meta Llama are billed separately, so filter the catalog by Direct from Azure.