LLM Cost Diff — Catch Cost Regressions Before You Deploy

    by LINH RATHHENRY

    1

    Compare two LLM runs, see cost per task change in one number, and get the biggest driver named in the first line of the report.

    $19

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned

    Works with the AI Agents you already use

    LLM Cost Diff — Catch Cost Regressions Before You Deploy

    Example session with this skill installed

    Compare before.jsonl and after.jsonl using the local pricing.json and tell me why the costs went up in the latest run.

    • Read your context and instructions
    • Compiled the llm cost diff

    I have analyzed the trace files before.jsonl (340 tasks) and after.jsonl (340 tasks). The analysis isolates cost changes per completed task to ensure the comparison is not skewed by volume.

    LLM Cost Diff Report

    Cost per completed task changed by +42.8% ($0.0142 -> $0.0203).
    Biggest driver: Output Tokens — average output tokens per task rose from 410 to 890 following the prompt change.

    Cost Summary

    MetricBeforeAfterChange
    Total Cost$4.82$6.90+43.1%
    Cost / Completed Task$0.0142$0.0203+42.8%
    Success Rate98.2%97.9%-0.3%
    Retry Share2.1%12.4%+10.3%

    Top Contributors by Model (After Run)

    ModelTotal Cost% of Total
    gpt-4o$5.8584.8%
    gpt-4o-mini$1.0515.2%

    Analysis

    The primary increase is driven by a significant jump in output verbosity. While the success rate remained stable, the new prompt instructions resulted in 2.1x more output tokens. Additionally, the

    Retry Share increased to 12.4%, suggesting that the new logic is causing more frequent tool-call failures or timeouts that require a second attempt.

    Next steps

    1. Review the max_tokens parameter and verbosity instructions in the new prompt to trim unnecessary output.
    2. Inspect the logs for tasks with retries > 0 to identify if a specific tool is failing under the new model instructions.
    3. Update pricing.json if you are using tiered volume discounting not reflected in the default rates.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Your prompt change looked harmless. Three weeks later the API bill says otherwise. LLM Cost Diff is a local tool + agent skill that compares two recorded runs of the same workload — before and after a prompt, model, or code change — and tells you exactly what the change did to your cost: total cost and cost per completed task, before vs after, with % change; the single biggest driver, named in one sentence at the top of the report (retries, output tokens, input tokens, or call volume); estimated retry cost and retry share — the silent bill-killer; top cost contributors by task and by model, so you fix the right thing. It runs entirely on the buyer's machine: no account, no hosted dashboard, nothing phones home. Traces are simple JSONL files — one aggregated line per task. If your logs are per-request (the shape most tools export), the included importer aggregates them into per-task traces in one command. Prices live in an editable pricing.json, so it works with any provider — and with local models you price yourself. Includes a synthetic sample (before/after traces + generated report) so you can see the exact output before wiring up your own traces: a realistic regression where cost per completed task jumps +85.2% and the report correctly fingers retries, not the longer prompt. What's inside: llm_cost_diff/ CLI tool (Python 3.12, standard library only) including the per-request log importer; SKILL.md agent skill (when to run it, how to read the report, pre-deploy cost checklist); pricing.json editable model prices; sample_data/ synthetic before/after traces; sample reports; tests/ pytest suite proving the cost math; README and LICENSE. Who it's for: indie devs and small teams shipping LLM features who change prompts or models and want a cost check in the loop — the way they already have a test check.

    Does not support real-time billing APIs. Requires manual pricing updates. Task IDs must be stable between before/after traces for accurate diffing. Trace files must follow strict JSONL schema.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 8 days ago

    Software
    Python

    Permissions

    Terminal / Shell
    Read Files
    Write Files
    Network Access
    Environment Variables
    Listed10 days ago
    Updated8 days ago

    What's inside

    Creator

    LINH RATHHENRY

    LINH RATHHENRY

    7 skills on Agensi

    Frequently Asked Questions

    This skill compares LLM trace files from different runs to calculate precise cost-per-task changes, helping you identify if an API spend increase is due to token verbosity, model pricing, or inefficient retry logic.

    The skill is framework-agnostic and works with any Python-based environment; as long as your agent logs input/output tokens, model names, and task IDs to JSONL, this tool can analyze the data.

    No, this is a local analysis tool designed for pre-deployment audits and post-incident reviews, meaning it does not require access to your live production environment or provider API keys.

    You will receive the Python-based analysis tool, a schema for trace preparation, a customizable pricing configuration file, and templates for generating Markdown or HTML cost reports.

    Since providers frequently update their rates, the skill includes a `pricing.json` file that you can manually update to ensure your cost diffs reflect the most current market prices.

    For the most accurate results, you should ensure that the Task IDs remain stable between your 'before' and 'after' trace files so the skill can correctly map and compare the cost of specific operations.

    New in LLM Ops

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for LLM Ops.