Home / Add-ons / Prompt Cost Linter
Prompt Cost Linter — find the code that makes your AI bill expensive
Static analysis for seven LLM cost anti-patterns: full context resent every turn, missing prompt caching, flagship models on simple tasks, unbounded output, retry storms, batchable loops and needless re-embedding.
Who it is for
Engineering teams and agencies shipping LLM features who want a cost review in CI instead of a surprise invoice.
The problem it removes
- The bill grows and nobody knows which code path caused it.
- Every turn resends the whole conversation, silently doubling input tokens.
- A flagship model is doing classification because it was the default in the prototype.
What you get
- Seven rules with id, severity, confidence and file:line evidence
- Scans .py, .js, .ts, .php and .rb; skips tests, vendor and minified files
- JSON output for CI, text output for humans
- Exit gate: fail the build on high severity
- No code execution — the scanner only reads text
How to use it
1. Activate the add-on
Dashboard → Billing → Add-ons → Prompt Cost Linter.
2. POST your files
Send up to 50 files, 200 KB each and 1 MB total. Only source extensions are accepted.
3. Wire the gate into CI
Fail on high severity findings, or start in report-only mode until the backlog is clean.
curl -sS https://plugsky.com/api/addons/lint \
-H "Authorization: Bearer $PLUGSKY_SESSION" \
-H "Content-Type: application/json" \
-d '{"files":[{"path":"app.py","content":"..."}]}'
The seven rules
Each rule targets a pattern that reliably increases token spend and is visible in source text without executing anything. The severity is a starting point, not a verdict: a high-severity finding in code that never runs in production is still a finding, but it is not urgent.
| Rule | Severity | What it flags |
|---|---|---|
| CTX-001 | High | Unbounded conversation history — a message list that grows every turn and is resent in full |
| CACHE-001 | Medium | A long static system prompt that is not marked cacheable |
| MODEL-001 | Medium | A flagship model used for a narrow task such as classification or extraction |
| TOK-001 | Low | A missing or oversized output-token cap |
| RETRY-001 | High | A retry loop without backoff or a maximum attempt count |
| BATCH-001 | Medium | Synchronous completion calls inside a collection loop |
| EMB-001 | Medium | Re-embedding documents without checking whether the content changed |
The rules are heuristics and the output says so. Each finding carries a confidence value, and the savings figure is a band rather than a number, because a static scan cannot know your traffic. Presenting a heuristic as a measurement would be the dishonest version of this product.
How a scan runs
The hosted endpoint accepts a JSON body with a list of files. Limits are deliberate: up to 50 files, 200 KB per file, 1 MB total, and only source extensions. Tests, vendored dependencies, build output, minified files and backups are skipped, because a finding in node_modules is noise that trains people to ignore the report.
Nothing is executed. The scanner reads text, applies patterns and returns findings with a file, a line and a message. That design is what makes it safe to run against a repository you do not want to hand to a third party in executable form — though the source itself is still uploaded, which is a distinction worth understanding before you send it.
Reading severity and confidence
Severity answers "how much does this pattern usually cost if it is real". Confidence answers "how sure is the scanner that this is the pattern". They are separate because a confident low-severity finding and an uncertain high-severity finding need different responses.
- High severity, high confidence — fix before the next deploy.
- High severity, medium confidence — read the line; the pattern may be intentional.
- Medium severity — batch into a cleanup, unless the file is on a hot path.
- Low severity — documentation-level; fix when you touch the file.
The gate fails on high severity when you ask it to. Starting in report-only mode is the sane default for an existing codebase, because a first run on a mature repository can produce a backlog large enough to get the tool switched off.
Wiring it into CI
The JSON output is stable, and the CLI returns a non-zero exit when the gate fails. A CI step is therefore two lines: run the scanner, let the exit code decide. No parser, no custom assertion.
python -m prompt_linter --path . --fail-on high --json > lint.json
For a repository with an existing backlog, pin the gate to the files changed in the pull request rather than the whole tree. That keeps the check useful without requiring a cleanup before it can be enabled.
A worked example
A support assistant sends the full conversation on every turn. After twenty turns the prompt is 9,000 tokens, of which 8,400 are history the model has already seen. CTX-001 flags the unbounded list, and the finding is high severity with medium confidence — high because the pattern is expensive, medium because the scanner cannot know whether a trim happens elsewhere. The fix is a sliding window or a summary, and the saving is roughly the difference between 9,000 and 2,000 input tokens per call. No execution was needed to find it.
The band matters more than the exact figure. A scan can say the prompt is larger than it needs to be; only your traffic can say what that costs per month. Treat the band as a reason to look, not as a budget line.
What it does not do
- No code execution. It cannot tell you what a prompt actually costs at runtime, only that a pattern usually costs more than it needs to.
- No automatic fixes. Findings point at a line; the change is yours.
- No VS Code extension. There is a CLI and an HTTP endpoint. An editor integration is a plausible future product, not a current feature.
- No model-quality evaluation. A cheaper model that answers worse is not a saving, and this tool does not measure answer quality. Use an evaluation set for that.
Local CLI or hosted endpoint
The same engine runs both ways. The local CLI is free to run against your own checkout and is the right choice if you already have Python in CI. The hosted endpoint exists for pipelines where installing a Python package is awkward, and for teams that want the gate enforced somewhere other than the build agent.
The subscription price buys the hosted gate and its maintenance. It does not buy a different rule set — the rules are the same, which is the point.
Questions
Does it run my code?
No. The scanner reads source text and applies rules. Nothing is executed.
How accurate are the savings?
Each finding carries a heuristic band, labelled as heuristic and not measured. It points at waste; it does not promise a dollar figure.
What does it scan?
Python, JavaScript, TypeScript, PHP and Ruby. Tests, vendor directories, minified files and backups are skipped.
Can I use it in CI?
Yes. The JSON output is stable and the gate fails on high severity when you ask it to.
Is there a local CLI?
Yes, the same engine runs locally. The hosted endpoint saves you running Python in CI.
Sources
- OpenAI prompt caching guide — checked 21 November 2026
- OpenAI chat completions reference — checked 21 November 2026
- Plugsky pricing — checked 21 November 2026
Related add-ons
Spend Guard
A window from 1 to 365 days, grouped by model, by day and by status, so you can find the feature that is eating the budget before the invoice arrives.
Usage Export
Download every request your workspace makes — model, tokens, cost, status and latency — as a CSV with a fixed header. Built for finance reconciliation and warehouse loads.
Activate from the dashboard; Stripe handles the subscription and access is granted automatically.
Open billingCompare add-ons