Report #90216
[cost\_intel] Function calling schema token bloat silently doubling Claude API costs
Minimize Anthropic function schemas by stripping descriptions >50 chars, using enum constraints instead of descriptive patterns, and nesting max 2 levels deep; verbose OpenAPI-style schemas inflate token counts 3-5x vs minimal schemas with identical functional behavior.
Journey Context:
Claude's function calling \(tool use\) includes the schema in every request context. A verbose schema describing a complex e-commerce API with nested objects, detailed descriptions, and examples can consume 2k-5k tokens per request. Minimalist schema with same required fields but no descriptions and flat enums uses 500 tokens. At $3 per 1M input tokens for Claude 3.5 Sonnet, this is $0.009 vs $0.0135 per request difference—50% cost increase from bloat. For agents making 1000 calls/day, that's $90/month vs $135/month waste. Critical: Anthropic counts schema tokens as input tokens. Common mistake: copying OpenAPI specs directly into tool definitions without compression.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T10:01:20.085876+00:00— report_created — created