# Spring Boot LLM Cost Audit

> Point your agent at a Spring Boot project and get a scored, evidence-based LLM cost audit: cache-breaking timestamps, unbounded chat history, frontier models doing three-way classification, per-item loop calls, missing output limits — each with file, line, the fix, and the tokens it saves.

Spring Boot LLM Cost Audit is a paid AI agent skill on Agensi by william Harris, in Code Quality & Review. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $9 (one-time purchase)
- Creator: [william Harris](https://www.agensi.io/creators/william-harris)
- Category: [Code Quality & Review](https://www.agensi.io/skills/code-quality-review)
- Version: 1.0
- Last updated: 2026-12-03
- Security: scan passed (2026-12-03); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/spring-boot-llm-cost-audit
- Tags: code-review, llm-ops, spring-boot, java, cost-optimization, spring-ai, llm-cost, token-optimization

## What it does

- Scans Spring AI / LangChain4j code for nine LLM waste patterns (L1–L9) with a bundled read-only scanner
- Scores LLM cost efficiency 0–100 with HIGH-to-INFO findings, each with file, line, and tokens saved
- Estimates savings token-first at your verified provider rate — CNY supported, DeepSeek/Qwen/Doubao first-class
- Writes concrete diff fixes: static system prompt, sliding-window history, batched requests, small-model routin
- Adds usage logging so you can prove the savings after deploy
- Re-scans after fixes and shows the score before → after

## Who it's for

- **Founders with high API bills:** Stop wasting money on tokens by finding and fixing inefficient code in your AI features. Try: "Our OpenAI bill is way too high. Can you audit our project and tell us how to cut costs?"
- **Java and Spring Boot developers:** Identify exactly which lines of code are causing token waste and get the fixes to lower costs. Try: "Run a cost audit on this Spring Boot project and show me the token waste report."
- **Tech leads reviewing new features:** Ensure your AI release won't break the bank by checking prompt efficiency before you go live. Try: "Review our LLM usage before we release this update to make sure it is cost-effective."
- **Teams running Spring AI customer-facing chatbots:** The exact lines where their bot burns tokens, with fixes and a monthly savings estimate Try: "Our support bot's token bill keeps climbing — audit it and fix the waste"

## About this skill

### Spring Boot LLM Cost Audit

**Find the tokens your Spring AI app wastes — priced in your own currency.**

Point your agent at a Spring Boot project and get a scored, evidence-based LLM cost audit: cache-breaking timestamps, unbounded chat history, frontier models doing three-way classification, per-item loop calls, missing output limits — each with file, line, the fix, and the tokens it saves.

#### Nine waste patterns (L1–L9)

A bundled read-only scanner checks your Spring AI / LangChain4j code for the nine ways Java LLM apps silently burn tokens:

- **Cache-breaking prompts** — timestamps, session IDs, or user names injected into the system prompt, defeating provider prompt caching
- **Unbounded chat history** — the full conversation resent on every turn, growing without limit
- **Oversized models** — frontier models doing three-way classification a small model handles at a fraction of the price
- **Per-item loop calls** — one API call per item instead of a single batched request
- **Missing output limits** — `maxTokens` unset, so rambling responses bill at full length
- …and four more patterns, each reported with file, line, the fix, and the tokens it saves

#### Honest savings, in your currency

Findings are rated HIGH-to-INFO with a 0–100 cost-efficiency score. Savings estimates are **token-first** and priced at your verified provider rate — **CNY supported**, with DeepSeek, Qwen, and Doubao as first-class providers alongside OpenAI, Anthropic, and Gemini. No made-up percentages: every estimate shows its traffic assumptions so you can sanity-check it.

#### Fixes, not just findings

Every finding ships with a concrete diff:

- Static system prompt (timestamps and IDs moved out) to restore prompt caching
- Sliding-window chat history
- Batched requests instead of per-item loops
- Small-model routing for classification, behind an eval gate
- Output limits (`maxTokens`) on every call
- Usage logging so the savings are measurable after deploy

After the fixes, the skill **re-scans and shows the score before → after** before delivering.

#### Proof

Rehearsal: a sample project with nine planted waste patterns scores **30/100** with all nine caught (11 findings); the fixed version scores **100/100** with zero false positives.

#### What's inside

- **SKILL.md** — the audit workflow your agent follows
- **scripts/llm_audit.py** — the read-only scanner (Python stdlib, nothing to install)
- **Reference material** — waste-pattern checklist, pricing & estimation guide, worked examples, rehearsal notes
- **Sample projects** — the waste-planted and fixed rehearsal apps

## Requires

- Python 3.8+

## Known limitations

It only scans Java and Spring Boot projects. It cannot accurately estimate money savings unless you provide your specific provider pricing.

## Technical details

Works on Spring Boot projects using Spring AI or LangChain4j with OpenAI, Anthropic, Gemini, DeepSeek, Qwen, Doubao, or other providers. The bundled scanner (scripts/llm_audit.py) uses only the Python 3 standard library and is strictly read-only: it never modifies files and makes no network calls. It checks nine waste patterns (L1–L9) — cache-breaking prompt content, unbounded conversation history, oversized models for simple tasks, per-item loop calls, missing output limits, and more — across Java sources and YAML/properties config. Savings estimates are computed token-first from your traffic assumptions and priced at the provider rate you verify (CNY supported). Fixes are proposed as reviewable diffs and verified by re-scan. Requires Python 3.8+; no API keys are needed for the audit itself.

## 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 Spring Boot LLM Cost Audit skill from Agensi" and describe your task.
3. Buy it on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### Which LLM providers are supported?

OpenAI, Anthropic, and Gemini, plus DeepSeek, Qwen, and Doubao as first-class providers. Savings are priced at the provider rate you verify, and CNY pricing is fully supported — so a DeepSeek bill in yuan is estimated in yuan, not converted from dollars.

### How are the savings estimated?

Token-first, never percentage-first. Each finding estimates the tokens it wastes under traffic assumptions you can see and adjust (conversations per day, average turns, model prices), then converts to money at your verified provider rate. The fixes include usage logging so you can verify the estimate against your next bill.

### Will the audit change my code?

The bundled scanner is strictly read-only and never modifies files. Fixes are proposed as reviewable diffs for you to approve, and after applying them the skill re-scans your project to prove the score improved (for example 30/100 → 100/100) before delivering.

### Does it need my API keys or send my code anywhere?

No. The audit is a local, static scan of your Java sources and config files. It makes no network calls and needs no API keys — your code never leaves your machine, and the scanner only reads files.

### Spring AI or LangChain4j — which frameworks work?

Both. The scanner covers Spring AI (ChatClient, advisors, chat memory) and LangChain4j (AiServices, chat memory, model builders), plus raw provider SDK calls in Java and model settings in YAML/properties config.

---

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.
