Four Amazon Bedrock inference choices that affect cost
In one sentence
AWS explains four request-level inference choices—cache duration, service tier, reasoning effort, and maxTokens—that affect Amazon Bedrock costs without changing models or prompts.
Key points
- Four request-level choices—cache duration, service tier, reasoning effort, and maxTokens—directly impact inference billing.
- Explicit prompt caching offers varying TTLs like 5 minutes and 1 hour, requiring a trade-off between write and read rates based on request frequency.
- For multi-tenant applications, prepending a tenant-specific SHA-256 hash to the cacheable prefix helps isolate cache entries.
- For latency-tolerant background jobs, using the Flex service tier on supported models can optimize costs, though unsupported models will return a ValidationException.
In depth
An AI-written overview of the original article, not the article itself.
According to an AWS Machine Learning Blog post, Amazon Bedrock inference bills can continue to climb even after tuning prompts and application logic. The article details how four request-level settings—cache duration, service tier, reasoning effort, and maxTokens—can alter costs without changing the underlying model.
Cache Duration and Service Tiers
For explicit prompt caching, a longer duration is not automatically cheaper. The post notes that for Claude Sonnet 5 and Opus 5, a 5-minute cache write costs 1.25 times the input rate, a 1-hour write costs 2 times, and a cache read costs 0.1 times. When requests arrive more than 5 minutes apart, the 1-hour cache becomes cheaper from the second request within the hour. However, changing system prompts or tool definitions invalidates the cache, and multi-tenant apps should prepend a tenant-specific SHA-256 hash.
For latency-tolerant workloads like background jobs, users can select the Flex service tier instead of the default Standard tier. In a 400-request test on Amazon Nova 2 Lite, Flex cost half as much as Standard with negligible median latency difference. Support is model-specific, however, as models like Claude Sonnet 5 do not support Flex.
Reasoning Effort and Output Limits
Reasoning tokens bill as output tokens. Claude Sonnet 5 and Opus 5 default to high adaptive thinking effort. In an Opus 5 tool-calling agent test, all effort levels passed, but median output tokens jumped 169% from 936 at low effort to 2,521 at high effort. Code generation tests showed little difference. The post recommends testing lower effort levels for routine tasks while tracking pass rates.
The maxTokens parameter sets an output ceiling to curb runaway prompts and preserve concurrency. Testing on Sonnet 5 showed that lowering maxTokens from 2,048 to 155 saved 1,893 output tokens on a verbose prompt. The author advises calibrating maxTokens using P95 or P99 output distributions per task, while relying on Amazon Bedrock Guardrails for safety controls.
This summary was generated by AI from the original article and may contain errors; the original is authoritative. Copyright belongs to the original author.