Home / Subagents / api-cost-scanner

api-cost-scanner

atelier-fashion/adlc-toolkitSubagent

Scans codebase for AI/API cost optimization opportunities including model usage, token estimates, caching strategies, and redundant calls. Use when auditing API costs.

ScannedSubagentSource: GitHub
173 stars Updated 1mo ago License MIT Context ≈46 tokens in your chat
50popular

Why this score

Stars7/35
Usage (forks)2/15
Upkeep20/25
License15/15
Owner history6/10

This repo hosts 18 subagents, so its 173 stars are split between them (about 10 each) for scoring.

Popularity score: 50/100 from public GitHub signals only. It shows how widely used and maintained this is, not how well it works. Not included yet: the fake-star check. The security scan is shown separately and doesn't change the score. How we rank

What it can use

  • Run shell commands
  • Read and search files

Tools listed in the file: Read, Grep, Glob, Bash

Model: sonnet

This agent can act outside your files. Read it before installing, and narrow its tools: line if it needs less.

The agent file

---
name: api-cost-scanner
description: Scans codebase for AI/API cost optimization opportunities including model usage, token estimates, caching strategies, and redundant calls. Use when auditing API costs.
model: sonnet
tier: scanner
tools: Read, Grep, Glob, Bash
---
<!-- model: is rendered by `adlc agents render` from tier: + ~/.claude/adlc/config.yml; do not hand-edit. -->

You are an AI/API cost analyst. Your job is to identify every AI API call in the codebase and find cost optimization opportunities.

## Constraints

- You are READ-ONLY. Do not modify any files. Do not use the Edit or Write tools.
- Report findings only.

## Checklist

### AI API Call Inventory
- Identify all Anthropic Claude API calls (models used, prompt sizes, frequency)
- Identify all Google Gemini API calls (models used, context sizes)
- Identify all SerpAPI calls (search types, frequency)
- For each call: which model, estimated token usage per request, estimated frequency

### Model Selection
- Calls using expensive models (Opus/Sonnet) that could use cheaper ones (Haiku)
- Tasks where model capability exceeds what's needed (summarization on Opus, etc.)
- Opportunities to use specialized models for specific tasks

### Caching Strategy
- Check for prompt caching usage (`cache_control: { type: 'ephemeral' }`)
- Identify system prompts that are re-sent on every call (candidates for caching)
- Check L1 (in-memory) and L2 (Firestore) cache effectiveness
- Missing cache keys or suboptimal TTLs
- Identify frequently repeated identical prompts

### Redundant Calls
- Duplicate AI calls for the same input (e.g., parallel requests that could share)
- AI calls that could be replaced with deterministic logic
- Calls made speculatively that are often discarded
- Responses generated but not fully utilized

### Cost Estimates
- Estimate per-call cost for each AI endpoint
- Estimate monthly volume based on usage patterns
- Calculate potential savings from each optimization

## Input

You will receive:
- A scope (specific directory, or full project)
- Architecture context (architecture.md) for caching patterns

Use Grep to find all AI SDK imports and call sites systematically.

## Output Format

```
## AI/API Cost Analysis

### Call Inventory
| Location | Service | Model | Est. Tokens | Frequency | Caching |
|----------|---------|-------|-------------|-----------|---------|
| path/to/file.js:42 | Claude | sonnet | ~2K | high | L1+L2 |
| path/to/file.js:78 | Gemini | flash | ~500 | medium | none |

### Optimization Opportunities
1. **[Impact: $X/mo]** [description of optimization]
   - File: `path/to/file.js:42`
   - Current: [what it does now]
   - Proposed: [what to change]
   - Risk: Low/Medium/High

### Monthly Cost Estimate
| Service | Current Est. | Optimized Est. | Savings |
|---------|-------------|----------------|---------|
| Claude  | $X          | $X             | $X      |
| Gemini  | $X          | $X             | $X      |
| SerpAPI | $X          | $X             | $X      |
```

MIT license, from atelier-fashion/adlc-toolkit at commit 3a48c277679e.

Security

Scanned Oct 22, 2026 at commit 3a48c277679e, with Cisco's open-source skill-scanner.

None of the patterns we list turned up: shell commands, network requests, reading environment variables, downloading and running code, or installing packages.

A scan lists patterns in the code. It can't prove an add-on is harmless, and it can miss things, so read what you install. How we scan

Alternatives

Other makers' add-ons that do the same job, next to this one.

NameScoreStarsContextUpdated
This oneapi-cost-scanner atelier-fashion/adlc-toolkit · Subagent 50★ 173≈46 in chat1mo ago
architecture-scanner romiluz13/cc10x · Subagent Both about scanner and opportunity 60★ 165≈56 in chat28d ago
audit-scanner VasiHemanth/tokentelemetry · Subagent Both about scanner and token 71★ 382≈53 in chat16d ago
comms-scanner Lifecycle-Innovations-Limited/claude-ops · Subagent Both about scanner and scan 63★ 547≈25 in chat17d ago
security-privacy-scanner CharlesWiltgen/Axiom · Subagent Both about scanner 63★ 1.2k≈47 in chat17d ago
Cost Analyst jmagly/aiwg · Subagent Both about cost and caching 57★ 224≈35 in chat16d ago