← ClaudeAtlas

llm-cost-disciplinelisted

Sonnet default (Opus needs comment), prompt caching for >1024-token prompts, batch API for non-interactive, max_tokens declared, bounded retries, no full prompts in logs. Use on LLM API calls.
voidcorp-core/void-harness · ★ 0 · AI & Automation · score 76
Install: claude install-skill voidcorp-core/void-harness
# llm-cost-discipline — voidcorp craftsman edition LLM costs scale with usage. A 1k-token system prompt re-billed on every call is 90% waste with caching. Opus everywhere is 5× Sonnet for marginal gains. Unbounded retries on a refusal burn tokens. This skill makes cost a first-class design concern at every LLM call site. **Attribution**: see `.source`. Composed with the `claude-api` skill (SDK mechanics). Foundation: Anthropic prompt caching docs + batch API + model card pricing. --- ## Model selection — Sonnet default | Model | When | |---|---| | **Sonnet 4.6** | DEFAULT. Everyday agentic work, code generation, chat, multi-step reasoning. Cost-effective and capable. | | **Haiku 4.5** | High-volume classification, extraction, retrieval-grade Q&A. ~3× cheaper than Sonnet. | | **Opus 4.7** | Only when justified at the call site with a comment. High-stakes reasoning, hard QA, complex code generation where Sonnet is insufficient. ~5× Sonnet cost. | ```typescript // allowed await anthropic.messages.create({ model: 'claude-sonnet-4-6', max_tokens: 1024, ... }); // allowed (with justification) // using Opus because legal-document drafting needs the reasoning depth await anthropic.messages.create({ model: 'claude-opus-4-7', max_tokens: 4096, ... }); // banned (Opus without comment) await anthropic.messages.create({ model: 'claude-opus-4-7', max_tokens: 1024, ... }); ``` The companion hook `llm-cost-precommit` warns on `model: 'opus'` without `// using Opus