Works with the AI Agents you already use
LLM App Cost, Guardrail & Rate-Limit Auditor
Plug unbounded max_tokens, infinite agent loops, missing timeouts/rate limits, and system-prompt injection across OpenAI, Anthropic, Gemini, LangChain, and Vercel AI SDK apps in Python and TypeScript.
$9
LLM App Cost, Guardrail & Rate-Limit Auditor
Example session with this skill installed
Audit our Next.js (route.ts) and FastAPI (agent.py) OpenAI/Anthropic support bot before launch. Flag runaway token-cost traps, prompt injection, and missing timeouts/rate limits before editing any files.
- Read your context and instructions
- Compiled the llm app cost
LLM App Cost, Guardrail & Rate-Limit Audit
LLM Ops Readiness Score: 0 / 100 (Grade F) · Runaway-Cost Risk Tier: CRITICAL
Detected SDKs: openai, anthropic, ai (Vercel AI SDK) · Findings: 3 Critical · 3 High · 2 Medium
| Rule | Severity | Location | Trap Detected | Guardrail Fix |
|---|---|---|---|---|
LLM-COST-001 | Critical | agent.py:19 | client.responses.create(...) missing max_output_tokens cap | Set explicit max_output_tokens=800 |
LLM-COST-002 | Critical | agent.py:14 | while True: tool loop has no max_steps or dollar budget cap | Bound loop to for step in range(MAX_STEPS) + token budget check |
LLM-SEC-001 | Critical | route.ts:22 | Untrusted ${userQuery} interpolated directly into system prompt | Keep system static; pass user input strictly in role: "user" |
LLM-COST-003 | High | route.ts:9 | POST /api/chat has no per-user rate limit or daily token quota | Add sliding-window rate limiter + per-user token cap |
LLM-REL-001 | High | agent.py:19 | Missing request timeout & retry backoff | Pass timeout=25.0 and bounded exponential backoff |
Hardened Python Agent Loop (Preview)
MAX_STEPS = 6
MAX_TOTAL_TOKENS = 12_000
total_tokens = 0
for step in range(MAX_STEPS):
resp = client.chat.completions.create(
model=MODEL_ID, max_tokens=800, timeout=25.0,
messages=[{"role": "system", "content": STATIC_SYSTEM_PROMPT}, *history],
)
total_tokens += resp.usage.total_tokens
if total_tokens > MAX_TOTAL_TOKENS:
raise BudgetExceededError("Session token budget reached")
Next Steps (Approval Required)
Reply
"Apply LLM cost & guardrail patches" to add token caps, bounded loops, rate-limit middleware, and usage telemetry (Grade F →
Grade A / 100/100).
Connects securely to your tools. The creator never sees your data.
About this skill
Ship Production AI Apps Without Runaway Token Bills or Prompt Injection
Shipping an OpenAI, Anthropic, Gemini, Vercel AI SDK, or LangChain app to real users? One unbounded while True agent loop or missing max_tokens + rate limit can burn thousands of dollars overnight. LLM App Cost, Guardrail & Rate-Limit Auditor pairs a strictly read-only Python static analyzer (scripts/audit_llm_app.py) with production LLM FinOps and guardrail playbooks for Python and TypeScript.
What It Catches (8 LLM Ops & Security Rules)
LLM-COST-001(Critical): LLM calls missing explicit output caps (max_tokens,max_output_tokens,maxTokens,max_completion_tokens).LLM-COST-002(Critical): Agent/tool execution loops (while True,while (true),AgentExecutor, recursive runners) missingmax_steps/maxSteps/max_iterationsor budget caps.LLM-COST-003(High): Public LLM API routes (@app.post,export async function POST,router.post) missing per-user rate limiting or token quota checks.LLM-REL-001&002(High/Medium): Missing explicit requesttimeout/ retry backoff (hung upstream worker exhaustion) and hardcoded model strings without fallback handling.LLM-SEC-001(Critical): Direct untrusted user-input interpolation insidesystemprompts /systemInstruction(high-risk prompt injection).LLM-SEC-002(High): Unvalidated LLM output passed straight into dangerous sinks (eval,exec, SQL interpolation,dangerouslySetInnerHTML, shell commands) without Zod/Pydantic validation.LLM-OBS-001(Medium): Missing token usage, cost, and latency telemetry (usage,prompt_tokens,input_tokens,usageMetadata).
How to Use
Ask your AI agent before launching any LLM-powered feature or agent workflow:
- "Audit our Python & TypeScript LLM code for runaway token costs, missing rate limits, and prompt injection."
- "Harden our AI support agent loop with
max_tokens,max_steps, timeouts, and per-user rate limiting."
Or invoke the read-only analyzer directly:
python3 scripts/audit_llm_app.py --path src/ --format markdown
What's Inside (15 Files)
SKILL.md— Deterministic 5-step LLM Ops & FinOps audit with0–100score &A–Fgradescripts/audit_llm_app.py— Pure Python 3 stdlib analyzer for Python & JS/TS across 6 major LLM SDKs (--fail-onCI gate)references/— LLM FinOps & rate-limiting playbook, prompt-injection & Zod/Pydantic output guardrails, and rule catalogtemplates/&examples/— Audit report template, copy-paste Python/TS budget middleware, and worked AI support-bot audittests/— Risky & hardened Python/TS LLM fixtures + runnable unit tests
Security & Privacy Guarantee
- 100% read-only & offline — never calls live LLM APIs, never opens
.env*or API key files, zero network calls.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for LLM Ops.
Static source-code analysis of Python and JavaScript/TypeScript files; does not run live prompt-injection red-team probes or inspect provider billing dashboards.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 2 days ago
- Software
Python 3.9+ (stdlib only)
Node.js
Permissions
Bundled analyzer is 100% offline and read-only; never calls LLM APIs and never opens .env files. Write Files is only used after explicit user approval to apply guardrail patches.