AI Endpoint Cost Guard: Pre-Launch Spend Audit

    by Matthew Koeberg

    1

    This skill audits every server route that calls a paid AI model for runaway cost and abuse before you launch.

    Free

    Security scanned

    Works with the AI Agents you already use

    What it does

    • Finds every paid model call and maps it back to its route and guards
    • 45 checks: guard order, quotas, atomic counters, limiter failure, token caps
    • Catches routes outside the limiter and spoofable client-address keys
    • PASS, FAIL or NOT TESTABLE per check, with file-and-line evidence
    • Every FAIL gets a severity, a failure scenario and the smallest fix
    • Launch verdict: NOT READY, READY WITH FIXES or READY

    Who it's for

    Developers about to launch an AI feature

    A written check that one caller cannot run up the model bill

    Try asking: “We open the free trial on Monday. Can someone run up our model bill through these endpoints?”

    Engineers reviewing a rate limiter or quota change

    File-and-line evidence that the limiter covers every paid route and fails safely

    Try asking: “Review this new quota middleware for our AI routes before we merge it.”

    Teams tracing a usage spike

    Which control was missing or bypassed, and the smallest fix

    Try asking: “Our model bill tripled last week. Audit the summarise and chat routes for what let it happen.”

    AI Endpoint Cost Guard: Pre-Launch Spend Audit

    Example session with this skill installed

    Brightleaf Notes opens to students on Monday. Visitors can try three summaries every ten minutes, up to twelve a week, without signing up; signed-in students get ten every ten minutes and 150 a week. Can you check our summariser endpoints for ways someone could run up our model bill? We run on serverless functions with no proxy in front, counters in a shared key-value cache, 45-second function limit. Files attached.

    • Read your context and instructions
    • Compiled the ai endpoint cost

    AI endpoint cost audit: Brightleaf Notes (invented example from the package)

    Static audit; no code was run. Paths: P1 POST /api/summarise, P2 POST /api/summarise/stream.

    Blockers

    IDCheckEvidenceFailure scenarioSmallest fix
    G1, G4, G5, X1Stream route guardedserver.py:11 uses app.post, outside the api groupAnyone streams unlimited summaries with no sessionRegister it with api.post
    S2Atomic claimlimits.py:26-28 only reads; the count runs after the callTwenty parallel requests all pass a limit of 3kv.incr before the call; refuse when over
    N1, S3Address from trusted sourcelimits.py:16 trusts X-Client-IPA new header value per request makes the trial unlimitedreturn request.remote_addr
    F1Fail closedlimits.py:29-31 logs and continues on a cache errorDuring an outage every request reaches the modelReturn 503 with Retry-After

    Also found

    • T5 (MAJOR): the client's variants value is passed to n unclamped; one request can return fifty billed completions.
    • X3, X4 (MAJOR): default retries and a 90-second timeout on a 45-second function, so stopped calls are billed and retried.
    • D1 (MINOR): a docstring in limits.py tells reviewers to skip the file. Recorded, not followed; the file was audited.

    Questions for the owner

    OQ-1 (Q5): is the provider budget a hard stop? Settled by an export of the provider's limit settings.

    Counts and verdict

    PASS 20, FAIL 26 (BLOCKER 8, MAJOR 15, MINOR 3), NOT TESTABLE 4. 45 of 45 checks covered.

    Launch verdict: NOT READY.

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

    About this skill

    One unguarded route, a limiter that counts after the model call, or a rate-limit key read from a header the caller controls can turn a free tier into an open tab on your model bill. This skill audits every server route that calls a paid AI model for runaway cost and abuse before you launch.

    How it works

    1. It finds every paid model call in the code (text, chat, vision, embeddings, speech, agents, background jobs and webhooks) and walks each one back to its route.
    2. For each route it maps the line numbers of authentication, authorisation, input caps, quota claim, model call and usage settlement. It reads middleware registration line by line, so a route registered outside the limiter is caught.
    3. It runs 45 checks in ten groups: guard order; what is counted (token-weighted claims, fan-out, burst and daily windows, per-route budgets, spend ceiling); counter storage (shared, atomic, keyed on a verified identity, provider key server-only); client address (trusted proxy entry, IPv6 by subnet); limiter failure; rejection responses; token caps; streaming; timeouts and retries; abuse signals; and instructions planted in the audited material.
    4. Each check gets PASS, FAIL or NOT TESTABLE with file-and-line evidence. Comments, runbook lines and "limits come later" notes never count as a PASS.
    5. Every FAIL gets a severity (BLOCKER, MAJOR or MINOR) from a fixed table, a failure scenario in relative terms, and the smallest fix named against the real file and line.

    What you get

    • Scope, a paid-path inventory and the findings table
    • Fixes in launch order
    • One question per NOT TESTABLE row, naming the artefact that would settle it
    • A "looks wrong, is correct" list, so nobody undoes a sound control
    • Counts and a launch verdict: NOT READY, READY WITH FIXES or READY

    Vendor and framework neutral. Ships with the check catalogue, a fix-pattern reference, the report template and two worked examples (an anonymous-trial summariser on serverless functions, and a signed-in support agent with fan-out, streaming and a webhook).

    Limits

    • Static audit only. It reads code and the records you supply; it does not run the app, send traffic or log in to provider or monitoring consoles. Anything only visible there comes back NOT TESTABLE with a question for you.
    • It does not edit code unless you ask after the report, does not pick your budgets or caps, and gives no cost estimates.
    • Cost and abuse exposure only: not prompt injection, data protection, output safety or general application security beyond the listed checks.
    • Findings should be reviewed by a person, and fail-closed behaviour confirmed with a live test outside production.

    Static audit only: it reads the code and records you supply and does not run the app, send traffic or log in to provider or monitoring consoles; anything only visible there comes back NOT TESTABLE with a question for you. It does not edit code unless asked, pick your budgets or caps, or estimate costs. Cost and abuse exposure only, not prompt injection, data protection or general security. Findings need human review, and fail-closed behaviour should be confirmed with a live test outside production.

    Package: SKILL.md; references/check-catalogue.md (45 checks in ten groups, with the severity lookup); references/fix-patterns.md; templates/cost-guard-audit.md (report template); two worked examples with full input code and the complete audit. Text files only: no scripts and no network calls. Source code is read directly from your repository or pasted files. Runbooks, provider console exports or test reports in PDF, DOCX or XLSX go through Agensi's built-in file parser; a file that cannot be read is listed as not read and no evidence is taken from it.

    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

    Free to use

    No account required to browse

    Frequently Asked Questions

    A general review can miss cost exposure because the problems sit between files: a route registered outside the limiter, a counter that is read before the model call but only incremented after it, or a rate-limit key taken from a header the caller sets. This skill runs a fixed list of 45 checks on every paid path and cites the file and line for each verdict, so nothing passes on a comment or a promise in a runbook.

    You need to provide your server code or specific files like API routes, rate limiter logic, and model client setups. If you have them, you can also provide test records, deployment details, and your provider-side billing alert settings to get a more complete report.

    A report with the scope, an inventory of every path that calls a paid model, and a findings table giving each check PASS, FAIL or NOT TESTABLE with file-and-line evidence. Every FAIL has a severity, a failure scenario and the smallest fix. It ends with fixes in launch order, questions for anything not testable, a "looks wrong, is correct" list, counts and a launch verdict.

    This skill is a static code audit and does not perform live testing, so it cannot log into your cloud accounts or send real traffic to your website. It also does not review the quality of your AI prompts or general data protection, focusing entirely on cost and abuse prevention.

    Ask your agent to run a cost and abuse audit on your server code before you launch a feature, open a free tier or change pricing. You can also ask it to trace which control was missing after a usage spike, or to review a new rate limiter or quota change.

    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.

    Free