api-cost-gate
Skill17 starsChanged 2 months agoMITView on GitHub
Pre-flight cost approval gate for any paid AI API call (image / 3D / audio / video / text generation services). Forces explicit 4-point disclosure (call type / cost estimate / purpose / use) before invocation. Use before any Suno/ElevenLabs/Midjourney/OpenAI/Tripo/etc. paid call. Use when user says 'check cost first', 'cost gate', 'approve API call'.
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 4 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 30
If args missing, ask the user what call they intend to make.
- Distinctive: line 69
Do not make the API call until the user responds with explicit approval.
- Very specific: line 75
Treat ambiguous responses (silence, unrelated message, maybe) as not approved — do not call.
- Very specific: line 77
If the invocation arguments was originated *by the user themselves* with full intent (e.g.
- Distinctive: line 83
After approval, append to a project-level cost log:
- Distinctive: line 127
Add your service to the table when adopted.
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Purpose
Solo developers and small teams using paid AI APIs (Suno, ElevenLabs, Midjourney, OpenAI, Tripo, etc.) face two failure modes:
- Surprise bills — automated retries, runaway loops, accidentally-expensive calls (e.g. 10-minute music generation when 30 seconds was intended).
- Wasted spend — calls made before the use is clear, producing assets that get discarded.
This skill enforces a pre-flight 4-point disclosure before any paid call. The agent cannot invoke the API until the user has reviewed and approved:
- Call type — exact endpoint / mode / model.
- Cost estimate — credits / characters / dollars (with current balance if known).
- Purpose — what we're producing and why.
- Use plan — where the output will live, how it will be evaluated, what triggers acceptance.
Auto-mode does not override this gate. Even when the agent is running autonomously, paid API calls require explicit user OK each time.
Phase 1: Identify the call
From the invocation arguments:
$1= service name (e.g.suno,elevenlabs,midjourney,openai)$2= brief description (e.g.combat-bgm-30s,npc-dialogue-line,concept-art-key-visual)
If args missing, ask the user what call they intend to make.
Phase 2: Compose the 4-point disclosure
Produce a short, unambiguous block:
=== Paid API Call — Approval Required ===
1. Call type:
<service> <endpoint> — <model> <mode>
Example: Suno /api/v1/generate — V5, custom mode, instrumental
2. Cost estimate:
~<N> <unit> (current balance: <M>)
Example: ~12 credits (current balance: 486)
3. Purpose:
<what + why, 1-2 sentences>
Example: Voice-of-Peace BGM bed for chapter 1 radio segment.
First sample to lock chapter 1 musical tone.
4. Use plan:
<where it lives + how it's evaluated + acceptance criteria>
Example: Lands in Tools/SunoAPI/output/ as workshop. If A/B-compared
against existing anchor (or pilot-anchored if first), promote
to Documents/AudioDesign/Anchors/ with prompt.txt.
→ Approve? (Y / N / modify)The 4-point block is engine-agnostic / service-agnostic. The pattern works for any paid API.
Phase 3: Wait for explicit user approval
Do not make the API call until the user responds with explicit approval. Acceptable approvals:
Y/OK/진행/approved/go— proceed.N/cancel/stop— abort.modify <change>— adjust the call per change, re-show the 4-point block, wait again.
Treat ambiguous responses (silence, unrelated message, maybe) as not approved — do not call.
If the invocation arguments was originated by the user themselves with full intent (e.g. they typed $api-cost-gate suno combat-bgm-30s and immediately follow with Y in the same message), the gate is satisfied — but only if all 4 points are still presented and acknowledged.
Phase 4: Log the approval (optional but recommended)
After approval, append to a project-level cost log:
Documents/api-cost-log.md| Date | Service | Call | Cost | Result |
|------------|-------------|-----------------------|--------|-----------------------------------------|
| 2026-05-03 | Suno | combat-bgm-30s V5 | 12 cr | Tools/SunoAPI/output/<id>/ — pending |This makes monthly billing reconcilable and surfaces calls that produced no kept output — a useful signal for prompt iteration efficiency.
Phase 5: Hand off to the actual call
Once approved, invoke the API call via whatever mechanism the project uses (CLI script, MCP tool, HTTP). Treat the call's output handling as a separate concern — this skill is only the gate, not the entire workflow.
When NOT to use this skill
- Free / local calls — local LLM, sandboxed model, no-cost endpoint. Gate adds friction with no benefit.
- Pre-approved batch operations — if the user explicitly approved "generate 10 variations" as a single batch, individual variation calls don't need re-gating; document the batch approval scope and proceed.
- Read-only / metadata calls — fetching credit balance, listing voices, getting account info. These are typically free even on paid services.
- The cost is genuinely trivial and bounded (e.g. <$0.01 with hard ceiling) and the user has standing approval. Document the standing approval explicitly.
Generalises across services
Confirmed services where this gate has prevented surprise spend or wasted output:
| Service | Unit | Notes |
| Suno (music) | credits | 1 call ≈ 10-20 credits, 2 variants per call |
| ElevenLabs (TTS / SFX / music) | characters | TTS ≈ 1 char / char, SFX ≈ 100 char/sec, Music ≈ 1000 char/sec |
| Midjourney / Stable Diffusion (image) | seconds / generations | varies by tier |
| Tripo (3D) | credits | varies by mesh complexity |
| OpenAI / Anthropic (text) | tokens | input + output, varies by model |
| remove.bg (background removal) | credits | size=preview ≈ 0.25 cr, size=full ≈ 1 cr per image — a 4× spread, so preview is the default. Gate is wired into $remove-bg; scripts/removebg.py estimate produces point 2 without charging. |
Add your service to the table when adopted. The 4-point disclosure works identically for all of them.
Where a service has a dedicated skill, use it. $remove-bg already embeds
this gate (Phases 2-3) and backs the estimate with a real balance lookup, so
invoking $api-cost-gate separately just duplicates the block. This skill is
for services that have no wrapper yet.
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 1
- dawn840705/claude-code-studios★ 197% same
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository92 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- adoptSkill
- architecture-decisionSkill
- architecture-reviewSkill
- art-bibleSkill
- asset-auditSkill
- asset-specSkill
- balance-checkSkill
- brainstormSkill
- bug-reportSkill
- bug-triageSkill
- changelogSkill
- code-reviewSkill
- consistency-checkSkill
- content-auditSkill
- create-architectureSkill
- create-control-manifestSkill
- create-epicsSkill
- create-prdSkill
- create-storiesSkill
- day-one-patchSkill
- design-reviewSkill
- design-systemSkill
- dev-storySkill
- doc-relinkSkill
- estimateSkill
- gate-checkSkill
- governance-bible-initSkill
- helpSkill
- hotfixSkill
- humanize-koreanSkill
- humanize-redoSkill
- humanizeSkill
- launch-checklistSkill
- legacy-purgeSkill
- lesson-logSkill
- lesson-reviewSkill
- localizeSkill
- map-systemsSkill
- milestone-reviewSkill
- onboardSkill
- patch-notesSkill
- perf-profileSkill
- playtest-reportSkill
- product-conceptSkill
- project-stage-detectSkill
- propagate-design-changeSkill
- prototypeSkill
- qa-planSkill
- quick-designSkill
- regression-suiteSkill
- release-checklistSkill
- remove-bgSkill
- retrospectiveSkill
- reverse-documentSkill
- review-all-gddsSkill
- scope-checkSkill
- security-auditSkill
- self-loopSkill
- The first 60 shown.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

