Free agent skill
Where is your LLM spend going? Audit the code before the bill.
A free skill for your own AI agent that reads your repo the way an engineer doing a cost review would. It finds every call to an LLM, embedding or speech API, the model each one uses, how large the prompts get, and whether anything limits, caches, batches or measures the spend. It scores cost control out of 100 and ranks the savings opportunities by effort, impact and confidence. It never guesses your prices: give it your volumes and your own price per million tokens and it shows the arithmetic, with every assumption written next to the range. The 30-point checklist is public below, so you can use it with or without the skill.
v0.1.0 · updated 2026-11-13 · MIT license · runs in your own agent, nothing is sent to NeuralSaaS
What you get
A cost-control score with the arithmetic
A number out of 100 and a verdict from "Uncontrolled spend" to "Well controlled". It measures how well spend is limited and measured, not how low the bill is. The formula is public.
Every LLM call, found
A table of call sites with file and line, the model named, maximum output, caching and timeout, so you can see where the tokens go.
Savings ranked, not promised
Up to eight opportunities, each with effort (S, M or L), impact, confidence, the trade-off and how to measure it. No headline percentages.
Your arithmetic, if you share your numbers
Give it monthly volumes and your current price per million tokens and it shows cost per feature and a savings range per lever, with each assumption beside it. Without numbers you get the ranking only.
Sample output
Review of HelpLoop, a fictional support-chatbot SaaS with placeholder model names, built to be weak. Excerpt: the score and three of the five top gaps.
Score
15/100
8 / 54 · Verdict: Uncontrolled spend
1. No limits on a public endpoint: missing
Found: app/api/chat/route.ts:12: the public chat widget has no per-workspace or per-conversation limiter, and no spend limit or alert exists anywhere in code or docs.
Fix: Add a per-workspace and per-conversation rate limit, cap attachment size, and set an app-level daily spend counter plus a provider-side budget alert.
2. Agent loop with no cap: missing
Found: lib/agent.ts:12 is while (true) around a model call, and line 21 appends every full tool result to the context.
Fix: Set a step limit and a per-run token budget, stop on repeated identical tool calls, trim tool output to the fields the next step needs, and hand off to a person at the limit.
3. Retrieval sends far more than needed: missing
Found: route.ts:21 retrieves 20 chunks of 2,000 characters on every message, roughly 10,000 tokens as an estimate, with no relevance threshold.
Fix: Lower the number of chunks, add a relevance threshold, and skip retrieval for greetings. Test on real questions first so answer quality does not drop.
The 30-point LLM cost control checklist
This is the full rubric the skill uses. You can run it by hand, with or without an AI agent. Critical checks count three times a minor one.
Visibility and limits
Spend alerts or caps
criticalIs there a budget alert or hard cap on LLM spend, either in the app (a counter that stops or degrades calls at a limit) or documented as set with the provider, so a bug or abuse cannot run up an unbounded bill?
Good looks like: An app-level daily or monthly limit that is checked before each call, plus an alert at a fraction of the budget; the README or runbook says which provider-side limits are set.
Red flags: No limit anywhere in code or docs; the only protection is 'we check the dashboard sometimes'; a key shared with other projects so one cap covers everything.
Per-user usage limits on LLM endpoints
criticalDoes every endpoint that triggers an LLM call require sign-in (or another identity) and enforce a per-user or per-IP limit on how often and how much it can be used?
Good looks like: A rate limiter or quota keyed to the user (or API key) in front of each LLM-backed route, with a plan-based allowance where the product has plans.
Red flags: Public endpoints that call a model with no limit; limits only in the interface; a free tier with no usage ceiling; one shared limit for all users.
Usage tracked per feature and per user
majorDoes the code record token usage (input, output, cached) and model per call, tagged with the feature and the user or tenant, so cost can be traced to the thing that causes it?
Good looks like: Usage fields from each response are logged or sent to an observability tool with a feature name and a user or account id; a per-feature total can be read without guessing.
Red flags: Responses' usage fields are discarded; only the provider's account-level total exists; no feature or user tag; logs that store prompts but not token counts.
User-controlled input size is bounded
majorIs the size of anything a user can send into a prompt (message length, pasted text, uploaded file, number of attachments) limited before it reaches the model?
Good looks like: Explicit maximum characters or tokens per message and per file, rejected or truncated with a clear message, with limits chosen on purpose.
Red flags: A whole uploaded file or pasted blob sent as-is; only a client-side limit; no limit on the number of files; limits so high they do not bind.
LLM calls go through one place
majorDo all LLM, embedding and speech calls go through one wrapper or client module that sets the model, the maximum output, the timeout, the retry policy and the usage logging, so a cost change is made once?
Good looks like: One module (or a gateway) owns model names, limits and logging; feature code calls it by task name; model names live in configuration, not scattered strings.
Red flags: The same SDK call copy-pasted across many files; model names hard-coded in several places; some calls bypass the wrapper; two different SDKs for the same provider.
Prompt and context size
System prompt kept lean
minorIs the system prompt limited to what the task needs, without repeated instructions, long policy dumps or unused sections that are resent on every call?
Good looks like: A prompt that is short enough to read in a minute, with long reference material fetched only when relevant.
Red flags: A multi-page prompt sent on every turn; the same rule stated several times; prompts that grew by appending fixes; every feature sharing one giant prompt.
Conversation history is managed
majorIs the history sent with each turn bounded (a window, a summary, or dropping old tool output), so cost per turn does not grow without limit as a conversation lengthens?
Good looks like: A maximum number of turns or tokens of history, with older turns summarised or dropped on purpose.
Red flags: The full message array resent forever; history stored and replayed from the database with no cap; tool results kept in history for the whole session.
Only the needed context is sent
majorDoes the code send the relevant part of a document or record, rather than the whole document, whole table row set or whole customer record, on every call?
Good looks like: Selection, retrieval or field-level trimming before the prompt is built; only the fields the task uses are included.
Red flags: Entire documents or knowledge bases pasted into the prompt; a full record serialised with JSON.stringify; the same large reference text on every call when a small part would do.
Tool definitions and examples are sized
minorAre tool or function definitions and few-shot examples limited to those the call needs, instead of sending every tool and ten examples on every request?
Good looks like: Only relevant tools are attached per task; a few well-chosen examples; schemas are compact.
Red flags: A large tool catalogue sent on every call; long examples repeated in every prompt; verbose schemas with long descriptions that the model does not need.
Model choice and routing
Model matches the task
majorIs the model chosen per task, so simple jobs (classification, extraction, routing, short rewrites, moderation) use a smaller or cheaper model, and the largest model is kept for work that needs it?
Good looks like: Different tasks name different models, chosen with a quick comparison on real examples; the reason is noted in code or docs.
Red flags: One large model used for every call, including yes/no classification; the model picked once from a tutorial; no evidence anyone compared options.
No LLM for what plain code can do
majorAre tasks that plain code, a regular expression, a lookup or a rule can do exactly (parsing a date, formatting, exact-match routing, checking a field) done without an LLM call?
Good looks like: Deterministic steps are code; the model is used where language understanding is needed.
Red flags: A model call to format JSON, extract an email address, check whether a string is empty, or choose between two fixed menu options.
Routing or fallback for mixed difficulty
minorWhere requests vary a lot in difficulty, does the code route easy ones to a cheaper model (or escalate only hard ones), and is any fallback model chosen on purpose rather than silently switching to a pricier one?
Good looks like: A simple router or cascade with an evaluation set to check quality; fallbacks documented; escalation rate observed.
Red flags: Every request goes to the top model 'to be safe'; a fallback that silently uses a more expensive model; routing added with no way to check quality.
Caching
Provider prompt caching is used where a prefix repeats
majorWhere a large block of text is identical across many calls (system prompt, tool definitions, reference documents), does the code use the provider's prompt caching, with the static part first and the changing part last? Rate na if no large repeated prefix exists.
Good looks like: Cache markers or provider-supported automatic caching on the static prefix; the volatile content (time, user name, retrieved text) placed after it; cached-token counts logged.
Red flags: A large static prefix on every call with no caching; a timestamp or user id at the top of the prompt that changes the prefix every time; caching enabled but never checked.
Repeated identical requests are cached
majorWhere the same question or input recurs (common support questions, repeated summaries, the same document re-processed), does the app store and reuse the result, with a sensible expiry? Rate na if requests are essentially never repeated.
Good looks like: A cache keyed on a normalised input, model and prompt version, with expiry and a way to bypass; invalidation when the prompt or data changes.
Red flags: The same document summarised again on every page view; no cache for an FAQ-style feature; a cache with no key versioning that serves stale answers after a prompt change.
No duplicate calls in one request path
majorDoes a single user action trigger each LLM call once, with no repeated calls from effect hooks, retries layered on retries, parallel duplicate requests, or a 'check' call that repeats the main call?
Good looks like: One call per intent; in-flight requests are de-duplicated; effects and handlers are guarded against double firing.
Red flags: A React effect that calls the model on every render; a server route and a client helper both calling for the same text; a call made only to decide whether to make another call that could have been one call.
Output control
Maximum output length is set
majorDoes every call set a maximum output length that fits the task, so a runaway or verbose reply cannot grow without bound?
Good looks like: An explicit max-output setting per task, set above the longest legitimate answer; truncation is handled.
Red flags: No max set anywhere (provider default applies); one very high max reused for every call; a short-answer feature with the same limit as a long-report feature.
Output is asked for in the shortest useful form
minorDoes the prompt or schema ask for only the fields and length the code uses (structured output with the needed keys, short answers, and a bounded reasoning or thinking budget where the provider offers one)?
Good looks like: Structured responses with only the used fields; instructions that set a length; reasoning effort or budget set per task rather than left at the highest.
Red flags: Long explanations requested then discarded by the code; reasoning set to the highest level for simple tasks; the model asked to repeat the input back.
Timeouts and cancellation
majorDo calls have a timeout, and is generation cancelled when the user disconnects or navigates away, so you do not pay for replies nobody reads?
Good looks like: A request timeout set in the client; abort signals passed through for streaming; a bound on total time for multi-step runs.
Red flags: No timeout (waits on the SDK default for minutes); streaming continues after the client has gone; a hung call holds a worker and is retried.
Batching and async
Applies when: The app has work that does not need an immediate answer: nightly summaries, backfills, bulk classification, evaluations, report generation. If there is none, rate both checks na.
Latency-tolerant work uses a batch or off-peak path
majorIs bulk or non-urgent work sent through the provider's batch interface or an off-peak queue, instead of being made as many live calls?
Good looks like: Backfills and nightly jobs submit batches and collect results later; the user-facing path stays live.
Red flags: A nightly job that loops over thousands of items with live calls; a backfill run through the same endpoint as user traffic; no distinction between urgent and non-urgent work.
Small items are grouped where it is safe to
minorWhere many small items share the same instructions (classifying a list, embedding many texts), are they sent together in one call, within the model's accuracy limits, instead of one call each?
Good looks like: Embedding inputs sent as arrays; short classification items grouped with the shared instructions sent once.
Red flags: One call per row with the full instructions repeated each time; embeddings requested one text at a time in a loop.
Loops, retries and agents
Agent and tool loops are capped
criticalDoes every agent or tool-use loop have a maximum number of steps, a limit on tool calls, and a token or cost budget per run, with a defined stop when the limit is hit? Rate na if there is no loop.
Good looks like: A step limit and a per-run budget enforced in code; an explicit failure path when the limit is reached; repeated identical tool calls detected.
Red flags: while (true) around a model call; recursion with no depth limit; 'keep going until done' with no ceiling; an agent allowed to retry a failing tool indefinitely.
Retries are capped and selective
majorAre retries limited in number, spaced with backoff, applied only to errors worth retrying (rate limits, timeouts, server errors), and not stacked across layers (SDK, wrapper, queue)?
Good looks like: A small retry limit in one layer; no retry on validation or content errors; a failed run does not silently replay the whole conversation.
Red flags: Unlimited retries; retrying a call that fails because the prompt is too long; three layers each retrying three times; a job queue that re-runs a whole expensive job on any error.
Tool results are trimmed before they go back to the model
majorAre search results, database rows, web pages and file contents returned by tools cut to what the next step needs, rather than appended in full to the context?
Good looks like: Tool outputs are summarised or truncated to a limit; large payloads are stored and referenced by id.
Red flags: Whole pages or tables returned to the model; raw API responses appended as-is; tool outputs kept for the rest of the session.
Scheduled and event-triggered calls are bounded
majorDo cron jobs, webhooks, queue consumers and database triggers that call a model have a cap on volume, de-duplication of repeated events, and protection against loops (an LLM write that triggers another LLM call)?
Good looks like: Idempotency keys or a processed marker; a per-run limit; a guard against events caused by the job's own output.
Red flags: A webhook that calls a model on every duplicate delivery; a job that reprocesses everything each run; an update trigger that fires on the field the model just wrote.
Retrieval efficiency
Applies when: The repo uses embeddings, a vector store or retrieval-augmented generation (RAG). If not, rate every check in this group na.
Embeddings are not recomputed for unchanged content
majorDoes the code store embeddings and skip texts whose content has not changed (for example by hashing the text), and cache repeated query embeddings where that helps?
Good looks like: A content hash or version stored with each vector; only new or changed chunks are embedded; the embedding model is recorded.
Red flags: Every deploy or upload re-embeds everything; the same query embedded on each request; no record of which model or text version produced a vector.
Chunk size and number of chunks are chosen on purpose
majorAre chunk size, overlap and the number of chunks sent to the model (top-k) set deliberately and checked against answer quality, rather than defaults or 'send plenty to be safe'?
Good looks like: A top-k and chunk size noted with the reason, tested on real questions; a total context budget for retrieved text.
Red flags: A large top-k copied from a tutorial; chunks of several pages; duplicates and near-duplicates sent together; no budget for retrieved text.
Re-indexing is incremental
minorDoes updating a document re-process only that document, rather than rebuilding the whole index on a schedule or on every change?
Good looks like: Per-document updates and deletes; full rebuilds only when the embedding model or chunking changes.
Red flags: A nightly full re-embed of an unchanged corpus; deleting and recreating the index to update one file.
Retrieval and generation are skipped or trimmed when not needed
minorDoes the code skip retrieval for messages that do not need it (greetings, follow-ups that need no new facts), apply a relevance threshold, and avoid calling the generator when nothing relevant was found?
Good looks like: A relevance threshold; a cheap check or rule for small talk; a canned or handoff response when retrieval returns nothing useful.
Red flags: Retrieval and a large model call for every message including 'thanks'; low-relevance chunks always included; a full generation call to say 'I do not know'.
Dev and test hygiene
Tests, CI and local runs do not hit paid production models
majorDo automated tests, CI, scripts and local development use mocks, recorded responses or a small model with a spending limit, rather than live calls to the production model on every run?
Good looks like: Unit tests mock the client; any live evaluation is a separate, opt-in job with a sample size limit; CI does not call the model on every commit.
Red flags: Tests that call the real API; a CI step that runs a full evaluation on every push; an experiment script that loops over the whole dataset with the top model.
Separate keys or projects for development and production
minorAre development, staging and production using separate provider keys or projects, so spend can be attributed and capped per environment? This often cannot be confirmed from files: rate na if so.
Good looks like: Per-environment keys named in the configuration template, each with its own limit.
Red flags: One key everywhere; a developer's personal key used in production; staging traffic mixed into the production bill.
How the score works
Each applicable check is rated met (1), partial (0.5) or missing (0). Critical checks weigh 3, major 2, minor 1. The score is the weighted share of the applicable checks, out of 100.
If any critical check is rated partial, the verdict cannot be better than 'Mostly controlled: a few gaps to close'. If any critical check is rated missing, it cannot be better than 'Loose: the bill can surprise you'. The score measures how well spend is controlled and visible, not how low the bill is. A check that cannot be assessed from the files is rated na and listed under 'Not checked'; never rate a check met on faith.
| Score | Verdict |
|---|---|
| 85 to 100 | Well controlled |
| 70 to 84 | Mostly controlled: a few gaps to close |
| 50 to 69 | Loose: the bill can surprise you |
| 0 to 49 | Uncontrolled spend |
Get the skill
Free and open source. Enter your email to get the install commands and the paste-in prompt for chat tools without skill support. The GitHub repository is going public shortly; we will email you the link.
Questions
Does it change or run my code?
No. It reads files and searches them. It does not run your app, install packages, run tests, call any provider or edit a file.
Does it know what my model costs?
No, on purpose. Prices and discounts change, so the skill never states one from memory. If you give it your volumes and your current price per million tokens, it does the arithmetic with your numbers. It points you to your provider's own pricing page for the figures.
Will it show my secrets in its report?
No. When it finds a key it reports the type, the file and line, the first four characters and the length, never the full value, and tells you to rotate it if it is committed or shipped to the browser.
Does my code or usage data leave my machine?
NeuralSaaS never receives it. The skill makes no calls of its own. Your agent sends the code it reads to whichever model you use, under that provider's terms. If you give it a usage export, it is used for totals by model and feature and is not quoted in the report. Check your provider's terms for a confidential repo.
Which stacks and providers does it cover?
It searches for the common SDKs and endpoints: OpenAI, Anthropic, Google, Bedrock, Azure, Mistral, Cohere, LangChain, LlamaIndex, the Vercel AI SDK and similar, in JavaScript, TypeScript and Python. Other languages work for the general checks, but it is least precise on code it has no search pattern for.
Will following the savings list definitely cut my bill?
No. It is a static read of your code. It cannot see your traffic, cache hit rates or what drives the invoice, so every range depends on assumptions that you should measure. It never gives a headline percentage, and some levers, such as routing to a cheaper model, can lower quality unless you test them.
I do not use a coding agent. Can I still use it?
Yes. There is a paste-in prompt version. It asks you to paste the files that call a model, never secrets or customers' prompts, reviews only what you pasted, and says what it could not cover. The 30 checks are also listed on this page for a manual review.
Is it free?
Yes, and open source under the MIT license.
Want a person to look at the bill with you?
The skill reads the code. It cannot see your traffic, your provider dashboard or your negotiated prices. If you would like a founder to go through the findings with you and talk about what is worth changing first, talk to us. We will not promise a saving. See how a discovery call works or talk to us.