Skip to content
Back to skills

Llm Cost And Latency

ASecurity

Finds where an app wastes LLM tokens and time, then cuts both with prompt caching, smaller models, batching and streaming.

  • 3 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added November 15, 2026
ai-agentsapi

Works with

  • api

Security analysis

A100/100

Scanned November 15, 2026

npx -y skills add workspace-templates/ai-agent-templates --skill llm-cost-and-latency --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Llm Cost And Latency?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Llm Cost And Latency
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/workspace-templates-llm-cost-and-latency/badge)](https://www.skillsdirectory.com/skills/workspace-templates-llm-cost-and-latency)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: llm-cost-and-latency
description: Finds where an app wastes LLM tokens and time, then cuts both with prompt caching, smaller models, batching and streaming.
---

# LLM cost and latency

Measure before changing anything. Optimizing the wrong call wastes a week.

## Steps

1. Find every model call site. For each, record the model, input tokens, output tokens, calls per day and whether a user is waiting. Use existing logs or add a temporary counter.
2. Rank call sites by daily cost and by user-facing latency. Work only on the top three.
3. Cache stable prefixes: put system prompt, tool definitions and reference documents first and user input last, then enable the provider's prompt caching. Check the cache hit field in responses to confirm it works.
4. Route by difficulty: classification, extraction and formatting usually run fine on a small model. Prove it on at least 50 real examples before switching.
5. Batch anything nobody is waiting for (nightly summaries, backfills) through the provider's batch API at a discount.
6. Cut tokens: trim retrieved context to what the question needs, drop chat history beyond a rolling window plus a summary, and set a tight max output.
7. For latency, stream tokens, run independent calls in parallel, and avoid chained calls that could be one.
8. Cache whole responses for identical inputs when answers do not need to be fresh.

## Rules

- Never switch models without a before and after quality check.
- Keep a kill switch to roll back.

## Report

A table of call sites with cost and latency before and after, the change made to each, and the quality check result.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.