The mistake
Calls with no output cap or request timeout, one request per item fired all at once, a conversation history that is never trimmed, a large system prompt sent uncached on every call, a top-tier model doing a classification job, embeddings recomputed on every request, and retired model names.
Why it is dangerous
Without an output cap the model may write until its maximum output length, and you pay for every token: a prompt bug or a loop turns one request into the most expensive request the model can produce. The OpenAI and Anthropic SDKs default to a 10-minute request timeout with 2 retries. One request per item multiplies cost by the size of the list, and firing them all at once hits rate limits, so retries re-send work that was already billed. Retired model ids fail in production.
How to fix it
Set an explicit output cap (max_completion_tokens / max_tokens, max_output_tokens, maxOutputTokens) and a timeout that matches how long the caller can wait. Bound concurrency, use the providers' batch APIs for offline jobs, trim history, mark large static prompts for caching (Anthropic cache_control), and keep per-request values out of the start of long prompts. Each finding shows the exact code for the SDK it was found in.
What this checker looks for
This page runs llm-cost-lint, which reads
Python and JavaScript/TypeScript using OpenAI, Anthropic, Google GenAI, Vercel AI SDK, LangChain or LiteLLM. The rules most relevant to this page:
| Rule | What it finds |
|---|---|
LCL001 | No output token cap |
LCL003 | No request timeout configured |
LCL004 | LLM call per item in a loop |
LCL006 | Large static prompt sent without prompt caching (Anthropic) |
LCL007 | Dynamic value near the start of a large prompt |
LCL008 | Top-tier model used for a simple or repeated task |
LCL010 | Conversation history grows without a limit |
LCL011 | Retired or deprecated model name |
Every finding has a rule id, a severity, file:line, the offending line (secrets masked),
why it matters and how to fix it. Run llm-cost-lint rules for the full list.