# AI Endpoint Cost Guard: Pre-Launch Spend Audit

> Audits every server route that calls a paid AI model for runaway cost and abuse before launch. 45 checks on guard order, quotas, shared atomic counters, limiter failure, client address keys, token caps, streaming, retries and webhooks, each PASS, FAIL or NOT TESTABLE with file:line evidence.

AI Endpoint Cost Guard: Pre-Launch Spend Audit is a free AI agent skill on Agensi by Matthew Koeberg, in LLM Ops. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [Matthew Koeberg](https://www.agensi.io/creators/matthew-koeberg)
- Category: [LLM Ops](https://www.agensi.io/skills/llm-ops)
- Version: 1.0.0
- Last updated: 2026-12-04
- Security: scan passed (2026-12-04); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/ai-endpoint-cost-guard-pre-launch-spend-audit
- Tags: llm-ops, security, api, ai-security, rate-limiting, cost-control, api-security, code-audit

## 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: "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: "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: "Our model bill tripled last week. Audit the summarise and chat routes for what let it happen."

## 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.

## Known limitations

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.

## Technical details

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 this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the AI Endpoint Cost Guard: Pre-Launch Spend Audit skill from Agensi" and describe your task.
3. Your agent loads the skill from Agensi when it needs it. Nothing is downloaded.

## Frequently asked questions

### What identifies this skill as being better than a standard code review?

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.

### What do I need to provide for the audit to work?

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.

### What does the final report actually look like?

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.

### Are there any things this audit cannot check for me?

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.

### How should I ask my agent to start using this skill?

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.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
