Bedrock Model Cost Optimizer
What this skill does
Translates a Bedrock model or generative-AI workload's inference posture
into a concrete cost-optimization recommendation with a dollar-denominated
savings estimate. The verdict is the highest-leverage action across seven
dimensions — model selection, prompt caching, batch inference, response
length control, fine-tuning vs few-shot, Guardrails and KB overhead, and
provisioned throughput — applied in priority order. Always pairs the
recommendation with exact CLI commands.
Quick navigation
| Section |
What it covers |
When to jump here |
| Quick start |
Five headline rules and the cost formula |
First read |
| Mindset |
Why model selection is the #1 lever |
Understanding the approach |
| Quick reference — verdict thresholds |
Decision matrix at a glance |
Classifying a workload |
| Pre-flight data gate |
CloudWatch Bedrock metrics, Cost Explorer |
Before any recommendation |
| Step 0 non-obvious behaviours |
Output token pricing, cache TTL, batch latency |
Edge cases |
| Step 1 Model selection |
Haiku vs Sonnet vs Opus, Nova family, routing |
The headline savings dimension |
| Step 2 Prompt caching |
Cache system prompts, reduce input cost 90% |
Repeated context workloads |
| Step 3 Batch inference |
50% discount for non-real-time workloads |
Document processing, dataset gen |
| Step 4 Response length control |
max_tokens, stop sequences, structured output |
Verbose model outputs |
| Step 5 Fine-tuning vs few-shot |
One-time cost vs per-call overhead |
High-volume specialised tasks |
| Step 6 Guardrails / KB overhead |
Per-token charges, vector store cost |
Compliance / RAG workloads |
| Step 7 Provisioned throughput |
On-demand vs committed discount |
Steady-state high volume |
| Step 8 Impact estimation |
The cost formula and worked math |
Every recommendation |
| Output format |
VERDICT block + worked examples |
Emitting the result |
| Anti-Patterns — NEVER |
Common misclassifications |
Self-check before emit |
| Pre-flight safety checks |
CONFIRM gate, canary test, rollback |
Before any apply CLI |
Quick start
Five headline rules and the cost formula moved verbatim to references/advanced-patterns.md.
Load on demand for the condensed first-read orientation before classifying a workload.
Mindset
Mindset principles moved verbatim to references/advanced-patterns.md.
Load on demand when explaining why model selection dominates the other dimensions.
Quick reference — verdict thresholds
| Observation (14-30 day window) |
Verdict |
Recommendation |
| Model is Opus or Sonnet AND workload is classification / extraction / simple Q&A / summarisation |
FURTHER_OPTIMIZATION_AVAILABLE (model) |
Step 1 — downgrade to Haiku or Nova Micro/Lite |
| Model is Opus AND workload requires reasoning but not frontier-level |
FURTHER_OPTIMIZATION_AVAILABLE (model) |
Step 1 — downgrade to Sonnet (5-7x cheaper than Opus) |
| System prompt or KB context > 1,000 tokens AND repeated across invocations AND prompt caching not enabled |
FURTHER_OPTIMIZATION_AVAILABLE (caching) |
Step 2 — enable prompt caching |
| Workload is non-real-time (document processing, dataset generation, bulk classification) AND using InvokeModel |
FURTHER_OPTIMIZATION_AVAILABLE (batch) |
Step 3 — migrate to Bedrock Batch API |
| Average output tokens > 1,000 AND max_tokens not set or set too high |
FURTHER_OPTIMIZATION_AVAILABLE (response length) |
Step 4 — set max_tokens, add stop sequences |
| Few-shot examples > 500 tokens per invocation AND invocation count > 100k/month |
FURTHER_OPTIMIZATION_AVAILABLE (fine-tune) |
Step 5 — fine-tune on a cheaper base model |
| Guardrails enabled AND processing > 1B tokens/month |
FURTHER_OPTIMIZATION_AVAILABLE (guardrail scope) |
Step 6 — narrow guardrail to output-only or reduce scope |
| On-demand spend > $10,000/month AND traffic is steady (CV < 0.3) |
FURTHER_OPTIMIZATION_AVAILABLE (throughput) |
Step 7 — evaluate provisioned throughput |
| All dimensions verified AND model is Haiku/Nova AND caching enabled where applicable AND no batch-eligible workload |
OPTIMIZED |
None — continue monitoring |
| InputTokenCount / OutputTokenCount metrics absent or window < 14 days |
NEED_MORE_INFO |
Pull 14-30 day CloudWatch data, re-evaluate |
Pre-flight: data gate (run before any optimization decision)
Optimization decisions are only as good as the underlying data. Pull
these metrics before any recommendation. Full CLI in
references/bedrock-pricing-and-token-metrics.md.
Pre-flight data-source command list moved verbatim to references/bedrock-pricing-and-token-metrics.md.
Load on demand when wiring live-account data collection before an optimization decision.
Data-quality short-circuits
Data-quality short-circuit table moved verbatim to references/error-handling.md.
Load on demand when CloudWatch or Cost Explorer data is missing, stale, zero, or contradictory.
Process — Optimization logic (apply in order)
Step 0: Non-obvious behaviours that change the recommendation
Step 0 expert-knowledge deep dive (output-token pricing, cache write premium and TTL, batch SLA, fine-tune cost, guardrail scope, KB vector cost, embedding choice, routing latency) moved verbatim to references/advanced-patterns.md.
Load on demand when a recommendation hinges on an operational gotcha.
Step 1: Model selection (the #1 lever)
Model selection is the primary cost lever because the price delta
between model tiers is massive — Haiku is ~60x cheaper than Opus per
token. Downgrading a model that is over-provisioned for the task is the
single highest-impact optimization.
Full per-1K token pricing hierarchy moved verbatim to references/bedrock-pricing-and-token-metrics.md.
Load on demand when computing per-model savings math.
Task-to-model routing matrix:
| Task complexity |
Example tasks |
Recommended model |
Cost vs Opus |
| Low |
Classification, entity extraction, simple Q&A, formatting, sentiment |
Haiku or Nova Micro/Lite |
~60x cheaper |
| Medium |
Summarisation, code review, multi-step reasoning (2-3 steps), translation |
Sonnet or Nova Pro |
~5-7x cheaper |
| High |
Complex code generation, deep analysis, creative writing, multi-step reasoning (5+ steps) |
Opus |
Baseline |
Decision gate for model downgrade:
| Current model |
Workload signal |
Target model |
Verdict |
| Opus |
Output < 200 tokens avg, task is extraction/classification |
Haiku |
FURTHER_OPTIMIZATION_AVAILABLE |
| Opus |
Task requires reasoning but not frontier-level |
Sonnet |
FURTHER_OPTIMIZATION_AVAILABLE |
| Sonnet |
Output < 200 tokens avg, task is simple Q&A |
Haiku |
FURTHER_OPTIMIZATION_AVAILABLE |
| Haiku |
Already on cheapest capable model |
— |
No model finding |
| Any |
Quality regression after downgrade (user reports, eval scores drop > 5%) |
Revert |
Do NOT downgrade |
Haiku-classifier routing pattern moved verbatim to references/advanced-patterns.md.
Load on demand when designing mixed-complexity model routing.
Step 2: Prompt caching (reduce input cost by 90%)
Prompt caching caches a prefix of the prompt (system prompt, knowledge
context, few-shot examples) so that repeated invocations with the same
prefix pay only ~10% of the normal input token rate for the cached
portion.
Eligibility checklist:
| Condition |
Cache eligible? |
| System prompt > 1,000 tokens AND repeated across invocations |
YES |
| Knowledge base context injected as static prefix |
YES |
| Few-shot examples embedded in prompt |
YES |
| Dynamic user query varies per invocation |
Prefix still cacheable; query goes after cache boundary |
| System prompt changes per user or per session |
NO (cache misses) |
| Invocation rate < 1 per 5 minutes |
NO (cache expires before reuse) |
Prompt-caching pricing math moved verbatim to references/bedrock-pricing-and-token-metrics.md.
Load on demand when estimating cache savings.
Prompt-caching enablement CLI (Python SDK cache_control + Prompt Management) moved verbatim to references/bedrock-pricing-and-token-metrics.md.
Load on demand when wiring cache_control into the invoke body.
Step 3: Batch inference (50% discount)
The Bedrock Batch API (CreateModelInvocationJob) processes large
datasets asynchronously at a 50% discount versus on-demand real-time
invocation.
Eligibility:
| Workload characteristic |
Batch eligible? |
| Non-real-time (no user waiting for response) |
YES |
| Document processing (summarise 10,000 PDFs) |
YES |
| Dataset generation (create training data) |
YES |
| Bulk classification / labelling |
YES |
| Model evaluation runs |
YES |
| Interactive chatbot |
NO |
| Real-time API endpoint |
NO |
| Streaming responses required |
NO |
Batch pricing comparison and create-model-invocation-job CLI moved verbatim to references/bedrock-pricing-and-token-metrics.md.
Load on demand when migrating a workload to batch.
Batch completion time: Typically minutes to hours depending on
dataset size. The job runs asynchronously and writes results to S3.
Step 4: Response length control
Output tokens cost 3-5x more than input tokens. Reducing output length
is a direct cost saving with no infrastructure change.
Levers:
| Lever |
How |
Typical saving |
max_tokens |
Set to the minimum acceptable response length |
20-60% on output cost |
| Stop sequences |
Define stop words that truncate generation early |
10-30% on output cost |
| Structured output (tool use) |
Force JSON/array format instead of prose |
30-70% on output cost |
| Prompt engineering ("Answer in 2 sentences") |
Instruct model to be concise |
20-50% on output cost |
Response-length worked math moved verbatim to references/worked-examples.md.
Load on demand when sizing a max_tokens / structured-output saving.
Step 5: Fine-tuning vs few-shot
Few-shot examples (embedding 3-10 examples in the prompt) improve
output quality but add input token cost on every invocation. Fine-
tuning absorbs those examples into the model weights, allowing a
cheaper base model to achieve the same quality.
Break-even formulas moved verbatim to references/bedrock-pricing-and-token-metrics.md.
Load on demand when deciding fine-tune vs few-shot.
Decision gate:
| Condition |
Recommendation |
| Few-shot tokens > 500/invocation AND invocations > 100k/month |
Fine-tune (break-even < 3 months typically) |
| Few-shot tokens < 200/invocation OR invocations < 10k/month |
Keep few-shot (fine-tune cost won't amortise) |
| Quality requirement is high AND base Haiku can't match Opus quality |
Fine-tune Haiku on Opus outputs (distillation) |
| Few-shot examples change frequently |
Keep few-shot (fine-tuning is too rigid) |
Step 6: Guardrails and Knowledge Base overhead
Guardrails cost model moved verbatim to references/bedrock-pricing-and-token-metrics.md.
Load on demand when scoping guardrail overhead.
Recommendation: Apply guardrails to output only unless input
filtering is a compliance requirement. Output-only halves the overhead.
Knowledge Base vector-store cost model moved verbatim to references/bedrock-pricing-and-token-metrics.md.
Load on demand when costing a low-volume RAG workload.
Step 7: Provisioned throughput vs on-demand
Provisioned throughput purchases guaranteed model capacity at a
discounted rate for a time commitment. Suitable for steady-state,
high-volume workloads.
Decision tree:
Is monthly on-demand spend > $10,000?
├── NO → Stay on-demand. Provisioned commitment is not worth the complexity.
└── YES → Is traffic steady (coefficient of variation < 0.3)?
├── NO → Stay on-demand. Provisioned underutilisation wastes spend.
└── YES → Is the model available for provisioned throughput?
├── NO → Stay on-demand.
└── YES → Evaluate provisioned throughput quote vs on-demand cost.
Provisioned throughput units: Model-specific. One model unit
provides a fixed number of tokens per minute. Contact AWS for pricing
or check aws bedrock list-foundation-models for supported models.
Step 8: Impact estimation
Compute the monthly savings for each recommendation:
current_monthly_cost =
(monthly_input_tokens / 1000 × model_input_rate_per_1k)
+ (monthly_output_tokens / 1000 × model_output_rate_per_1k)
+ guardrail_overhead
+ kb_overhead
projected_monthly_cost =
(projected_input_tokens / 1000 × new_model_input_rate_per_1k)
+ (projected_output_tokens / 1000 × new_model_output_rate_per_1k)
+ new_guardrail_overhead
+ new_kb_overhead
monthly_saving = current_monthly_cost - projected_monthly_cost
Always state assumptions: monthly token counts (input and output
separately), current and projected model, pricing region, caching
status, batch status, guardrail scope.
Step 9: Final verdict
- Any dimension recommends a change → FURTHER_OPTIMIZATION_AVAILABLE.
- All dimensions pass AND model is Haiku/Nova AND caching enabled where
applicable AND no batch-eligible workload → OPTIMIZED.
- Change applied and verified this session → OPTIMIZED (post-state).
- Data insufficient (InputTokenCount absent, window < 14 days) →
NEED_MORE_INFO.
Never emit FURTHER_OPTIMIZATION_AVAILABLE without first discharging
every NEED_MORE_INFO gate.
Output format
Output block template moved verbatim to references/worked-examples.md. The STRICT output contract below is the authoritative copy kept in SKILL.md.
Load on demand when rendering the raw output shape.
Full worked examples (model downgrade, prompt caching, batch migration,
already-optimal, NEED_MORE_INFO, and end-to-end walkthrough) are in
references/worked-examples.md.
STRICT output contract
The rules below are hard constraints. Violating any one produces a
misclassification or an arithmetic contradiction that breaks downstream
FinOps automation. Self-check EVERY emitted block before returning.
Required output structure
Every response MUST be a single block using these literal labels, in this
order. Do NOT substitute markdown headings, camelCase, or bold variants.
TARGET: <model-id or workload-name>
VERDICT: OPTIMIZED | FURTHER_OPTIMIZATION_AVAILABLE
REASON: <1-2 sentences naming the recommendation and the supporting data>
RECOMMENDATION:
Current: <model>, <input tokens/invocation>, <output tokens/invocation>, <invocations/month>
Proposed: <model>, <projected input tokens>, <projected output tokens>, <invocations/month>
Dimensions changed: <model | caching | batch | response_length | fine_tune | guardrails | throughput>
Dimensions checked: <list ALL seven, each ✓ (no finding) or → (finding)>
Confidence: <HIGH/MEDIUM/LOW> — <one-line rationale>
ESTIMATED_SAVINGS:
Current monthly: $<amount>
input tokens: <count> × $<rate>/1k = $<amount>
output tokens: <count> × $<rate>/1k = $<amount>
guardrails: $<amount>
KB: $<amount>
Projected monthly: $<amount>
Monthly saving: $<amount> ← MUST equal Current − Projected, 2 decimals
Annual saving: $<amount> ← MUST equal Monthly × 12
MIGRATION_STEPS:
1. <specific action with CLI command>
2. <verification step>
CONFIRM: <confirmation prompt text>
FORBIDDEN output patterns
NEVER emit VERDICT: FURTHER_OPTIMIZATION_AVAILABLE with
Monthly saving: $0.00. If every dimension nets zero cost delta,
the verdict MUST be OPTIMIZED.
NEVER show savings math that does not balance.
Current monthly − Projected monthly MUST equal Monthly saving,
rounded to 2 decimal places.
NEVER emit scratch lines ("WAIT — recompute", "Hmm, let me redo",
"corrected:") in the output. Finalize the math before emitting.
NEVER recommend a model downgrade without citing the task type and
output token evidence. The REASON MUST name the workload pattern
that makes the downgrade safe.
NEVER omit a dimension from the RECOMMENDATION block. The
Dimensions checked line MUST list all seven dimensions, each marked
✓ (no finding) or → (finding).
NEVER present a quality regression as a cost saving. If the
downgrade risks quality loss, surface the risk in REASON and set
Confidence to MEDIUM or LOW.
NEVER round intermediate formula steps differently from the final
figure. Compute at full precision, round only the displayed result.
Perfect example output — FURTHER_OPTIMIZATION_AVAILABLE with verified math
Every field below is internally consistent. Copy this shape exactly.
TARGET: anthropic.claude-3-opus-20240229-v1:0 (customer-support-bot)
VERDICT: FURTHER_OPTIMIZATION_AVAILABLE
REASON: Customer support chatbot using Opus for simple FAQ Q&A. Average
output is 180 tokens (extraction/lookup), well within Haiku's
capability. Downgrading to Haiku reduces per-token cost 60x on both
input and output. Additionally, the 2,000-token system prompt is
repeated on every invocation and prompt caching is not enabled,
adding a further 89% saving on the cached portion.
RECOMMENDATION:
Current: Opus, 2,500 input tokens/invocation, 180 output tokens/invocation, 200,000 invocations/month
Proposed: Haiku, 2,500 input tokens/invocation (500 cached), 180 output tokens/invocation, 200,000 invocations/month
Dimensions changed: model (Step 1) + caching (Step 2)
Dimensions checked: model → (Opus to Haiku) caching → (enable)
batch ✓ (interactive, not eligible) response_length ✓ (already concise)
fine_tune ✓ (invocations too low to justify) guardrails ✓ (none configured)
throughput ✓ (spend below $10k threshold)
Confidence: HIGH — FAQ Q&A is Haiku's sweet spot; output < 200 tokens
confirms no complex generation; system prompt is static and repeated.
ESTIMATED_SAVINGS:
Current monthly: $10,200.00
input tokens: 500,000,000 × $0.015/1k = $7,500.00
output tokens: 36,000,000 × $0.075/1k = $2,700.00
Projected monthly: $147.50
input tokens: 500,000,000 × $0.00025/1k = $125.00
output tokens: 36,000,000 × $0.00125/1k = $45.00
caching overhead: ~$22.50 (cache write premium + residual)
Monthly saving: $10,052.50
($10,200.00 − $147.50 = $10,052.50 ✓)
Annual saving: $120,630.00
MIGRATION_STEPS:
1. Test Haiku on 100 representative FAQ queries; compare to Opus baseline:
aws bedrock create-evaluation-job --model-identifiers ...
2. Enable prompt caching: add "cache_control": {"type": "ephemeral"}
to the system prompt block in the invoke call.
3. Deploy Haiku behind a feature flag; route 10% traffic for 7 days.
4. If quality holds, cut over 100% to Haiku.
CONFIRM: About to downgrade customer-support-bot from Opus to Haiku
and enable prompt caching. Monthly saving $10,052.50 (98.6%). Proceed? (yes/no)
Self-check before emit:
Verdict semantics
| Verdict |
When to emit |
FURTHER_OPTIMIZATION_AVAILABLE |
At least one dimension has a concrete, savings-bearing recommendation. |
OPTIMIZED |
All dimensions pass (model is Haiku/Nova, caching enabled where applicable, no batch-eligible workload, response length controlled, guardrails scoped). Also emitted when a change was applied and verified this session. |
NEED_MORE_INFO |
Data gate failed: InputTokenCount/OutputTokenCount absent, window < 14 days, or model identifier unknown. |
Zero-savings rule: If MONTHLY_SAVING == $0.00 for every dimension,
verdict MUST be OPTIMIZED, never FURTHER_OPTIMIZATION_AVAILABLE.
Anti-Patterns — NEVER (top 5)
NEVER recommend a model downgrade without verifying the task type.
Opus/Sonnet are required for complex reasoning, code generation, and
creative tasks. Always cite the task pattern that makes a downgrade safe.
NEVER recommend prompt caching for low-traffic workloads. If the
cache expires before reuse, the write premium (1.25x) makes caching
MORE expensive. Verify invocation rate > 1 per 5 minutes.
NEVER recommend batch inference for interactive workloads. Batch
SLA is minutes to hours. Migrating a chatbot to batch breaks UX.
NEVER recommend fine-tuning without computing break-even. If
invocation volume is low, the training cost never amortises.
NEVER enable provisioned throughput without verifying traffic
consistency. Underutilisation is wasted spend. Only for steady-state,
high-volume workloads (> $10,000/month on-demand).
Extended anti-patterns and error-handling tables in references/bedrock-pricing-and-token-metrics.md.
Pre-flight safety checks (run before any remediation CLI)
- MANDATORY CONFIRMATION GATE. Before any state-changing operation,
emit and await operator approval. Do NOT execute until confirmed.
- Canary test model downgrades. Route 10% traffic to the new model
for 7 days before full cutover.
- Prompt caching is application-layer. Changes to the invoke body
require a code deploy, not an AWS CLI call. Coordinate with the app team.
- Batch jobs write to S3. Ensure the output bucket exists and the
IAM role has write permissions before creating the job.
- Fine-tuning requires training data. Prepare 1,000-10,000 examples
in JSONL. Training takes hours; monitor via
aws bedrock get-model-customization-job.
- Guardrail changes affect all invocations. Test in staging first.
- Provisioned throughput is a commitment. Cost is incurred regardless
of usage once purchased.
- Embedding model changes require re-indexing. Switching from Titan
to Cohere changes vector dimensions; the entire KB must be re-indexed.
- Bulk-operation limit: Process at most 3 model changes per batch.
Sort by estimated savings; abort if any model shows quality regression.
Recent AWS features (2024-2026)
Recent AWS features 2024-2026 (prompt caching, batch API, guardrails, KB, Nova, model evaluation, provisioned throughput, Titan Embed v2) moved verbatim to references/advanced-patterns.md.
Load on demand when checking feature availability windows.
References
references/bedrock-pricing-and-token-metrics.md — pricing tables by
model family, token-to-cost formulas, CloudWatch Bedrock metric reference,
prompt caching CLI, batch API reference, Guardrails pricing, KB vector
store cost comparison, error-handling tables, fine-tuning decision tree,
regional pricing multipliers.
references/worked-examples.md — full worked examples (Opus-to-Haiku
downgrade with caching, prompt caching enable, batch migration, response
length control, already-optimal, NEED_MORE_INFO, end-to-end walkthrough).
References (load on demand)
- references/bedrock-pricing-and-token-metrics.md — pricing tables and token-metric CLI; now also holds the pre-flight data-source commands, model cost hierarchy, prompt-caching pricing math and CLI, batch pricing/CLI, fine-tune break-even analysis, and Guardrails/KB cost models moved from SKILL.md.
- references/worked-examples.md — full worked examples; now also holds the response-length-control math and the output block template moved from SKILL.md.
- references/error-handling.md — data-quality short-circuits (missing metrics, dormant model, short window, CE disagreement) moved from SKILL.md.
- references/advanced-patterns.md — quick-start headline rules, mindset, Step 0 non-obvious behaviours, Haiku routing pattern, and Recent AWS features 2024-2026 moved from SKILL.md.
Domain
AWS CloudOps / Bedrock GenAI Cost Optimization & FinOps.
AWS documentation
1---2name: bedrock-model-cost-optimizer3description: 'Optimises Amazon Bedrock inference cost across seven dimensions: model selection (Claude Haiku is ~60x cheaper per token than Opus; Nova Micro cheaper still; route simple queries to cheapest capable model), token usage analysis (output tokens cost 3-5x more than input), prompt caching (cache repeated system prompts to reduce input cost by up to 90%; TTL 5 min default, 1 hr max), batch inference (50% discount vs on-demand for non-latency-sensitive workloads), response length control (max_tokens, stop sequences, structured output), fine-tuning vs few-shot trade-off (fine-tune once then serve on cheaper base vs per-call in-context examples), and Guardrails / Knowledge Base overhead (Guardrails charges per processed token; KB adds vector store cost). Reads CloudWatch Bedrock metrics (InputTokenCount, OutputTokenCount, InvocationCount) and Cost Explorer. Emits OPTIMIZED or FURTHER_OPTIMIZATION_AVAILABLE. Use when reviewing Bedrock spend, planning model downgrades, evaluating prompt caching, or running a GenAI ...'4license: Apache-2.05compatibility: Agent runtime that reads SKILL.md (Claude Code, Cursor, Windsurf, Codex, Gemini). Offline classification works from pasted CloudWatch Bedrock metrics and Cost Explorer data. Live-account optimization uses aws bedrock list-foundation-models, aws bedrock get-foundation-model, aws cloudwatch get-metric-statistics (AWS/Bedrock namespace), aws ce get-cost-and-usage (Service=Bedrock), aws bedrock create-prompt, aws bedrock create-guardrail, aws bedrock create-model-invocation-job (batch), and aws...6metadata:7 source: https://skillmd.com/skills/jhkchan/bedrock-model-cost-optimizer8 domain: aws-cloudops9 complexity: medium10 requires_llm: 'true'11 phase: '3'12 supports_pipeline: 'true'13 entry_point: 'false'14 family: AI/ML15 task_type: optimize16 skill_class: capability17 lifecycle_status: active18 verdict_shape: OPTIMIZED | FURTHER_OPTIMIZATION_AVAILABLE19 when_to_use: Optimising Bedrock inference spend, triaging model selection (downgrading Opus to Haiku for simple queries), evaluating prompt caching eligibility for repeated system prompts, planning batch inference for non-real-time workloads, controlling response length via max_tokens and stop sequences, deciding fine-tune vs few-shot for a high-volume use case, estimating Guardrails or Knowledge Base cost overhead, or running a GenAI FinOps review on Bedrock spend.20 when_not_to_use: EC2 instance rightsizing for self-hosted models (use ec2-rightsizing-optimizer), Lambda function cost (use lambda-cost-optimizer), SageMaker endpoint cost (use sagemaker-cost-optimizer if available), or Bedrock model troubleshooting (invocation errors, throttling, content policy blocks — use the Bedrock troubleshooter). This skill focuses on cost-driven optimization decisions, not functional debugging of broken invocations.21 activation_triggers: optimise Bedrock cost, Bedrock model selection, Bedrock prompt caching, Bedrock batch inference, Bedrock token usage, Bedrock max_tokens optimization, Bedrock fine-tuning cost, Bedrock Guardrails overhead, Bedrock Knowledge Base cost, Bedrock provisioned throughput, Bedrock model routing, Bedrock embedding model, Bedrock CloudWatch metrics, Bedrock GenAI FinOps, Claude Haiku vs Sonnet vs Opus cost, Nova model pricing, reduce Bedrock bill, Bedrock monthly savings estimate22 invocation_schema: 'Input: either (a) a model identifier + live-account context with CloudWatch Bedrock metrics, (b) a Cost Explorer Bedrock spend breakdown, OR (c) a prompt/workflow description with token usage data (InputTokenCount, OutputTokenCount, InvocationCount over 14-30 days). Output: a deterministic TARGET/VERDICT/REASON/RECOMMENDATION/ ESTIMATED_SAVINGS/MIGRATION_STEPS block per model or workflow, where VERDICT is one of OPTIMIZED, FURTHER_OPTIMIZATION_AVAILABLE.'23 invocation_example: "ModelId: anthropic.claude-3-opus-20240229-v1:0\nRegion: us-east-1\nPricing: on-demand\nMetrics (last 30 days):\n - InputTokenCount total: 500,000,000 (avg 2,500/invocation)\n - OutputTokenCount total: 100,000,000 (avg 500/invocation)\n - InvocationCount: 200,000\n - InvocationLatency avg: 3,200 ms, p95: 5,800 ms\nWorkload: customer support chatbot. System prompt is 2,000 tokens\nof company policy + FAQ, repeated on every invocation.\nCost Explorer: $4,800/month on Bedrock.\nEmit the standard optimization block."24 version: 0.1.025 author: Jacky Chan — AWS Community Builder26 keywords: Bedrock, model selection, cost optimization, prompt caching, batch inference, token usage, Claude Haiku, Claude Sonnet, Claude Opus, Nova Micro, Nova Lite, Nova Pro, input tokens, output tokens, max_tokens, stop sequences, fine-tuning, few-shot, Guardrails, Knowledge Base, provisioned throughput, on-demand, model routing, embedding, Titan embeddings, Cohere embeddings, CloudWatch Bedrock metrics, GenAI FinOps27 tags: bedrock, ai-ml, cost-optimization, genai-finops, prompt-caching, batch-inference, model-selection28---2930# Bedrock Model Cost Optimizer3132## What this skill does3334Translates a Bedrock model or generative-AI workload's inference posture35into a concrete cost-optimization recommendation with a dollar-denominated36savings estimate. The verdict is the highest-leverage action across seven37dimensions — model selection, prompt caching, batch inference, response38length control, fine-tuning vs few-shot, Guardrails and KB overhead, and39provisioned throughput — applied in priority order. Always pairs the40recommendation with exact CLI commands.4142## Quick navigation4344| Section | What it covers | When to jump here |45|---|---|---|46| Quick start | Five headline rules and the cost formula | First read |47| Mindset | Why model selection is the #1 lever | Understanding the approach |48| Quick reference — verdict thresholds | Decision matrix at a glance | Classifying a workload |49| Pre-flight data gate | CloudWatch Bedrock metrics, Cost Explorer | Before any recommendation |50| Step 0 non-obvious behaviours | Output token pricing, cache TTL, batch latency | Edge cases |51| Step 1 Model selection | Haiku vs Sonnet vs Opus, Nova family, routing | The headline savings dimension |52| Step 2 Prompt caching | Cache system prompts, reduce input cost 90% | Repeated context workloads |53| Step 3 Batch inference | 50% discount for non-real-time workloads | Document processing, dataset gen |54| Step 4 Response length control | max_tokens, stop sequences, structured output | Verbose model outputs |55| Step 5 Fine-tuning vs few-shot | One-time cost vs per-call overhead | High-volume specialised tasks |56| Step 6 Guardrails / KB overhead | Per-token charges, vector store cost | Compliance / RAG workloads |57| Step 7 Provisioned throughput | On-demand vs committed discount | Steady-state high volume |58| Step 8 Impact estimation | The cost formula and worked math | Every recommendation |59| Output format | VERDICT block + worked examples | Emitting the result |60| Anti-Patterns — NEVER | Common misclassifications | Self-check before emit |61| Pre-flight safety checks | CONFIRM gate, canary test, rollback | Before any apply CLI |6263## Quick start6465Five headline rules and the cost formula moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md).66Load on demand for the condensed first-read orientation before classifying a workload.6768## Mindset6970Mindset principles moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md).71Load on demand when explaining why model selection dominates the other dimensions.7273## Quick reference — verdict thresholds7475| Observation (14-30 day window) | Verdict | Recommendation |76|---|---|---|77| Model is Opus or Sonnet AND workload is classification / extraction / simple Q&A / summarisation | **FURTHER_OPTIMIZATION_AVAILABLE** (model) | Step 1 — downgrade to Haiku or Nova Micro/Lite |78| Model is Opus AND workload requires reasoning but not frontier-level | **FURTHER_OPTIMIZATION_AVAILABLE** (model) | Step 1 — downgrade to Sonnet (5-7x cheaper than Opus) |79| System prompt or KB context > 1,000 tokens AND repeated across invocations AND prompt caching not enabled | **FURTHER_OPTIMIZATION_AVAILABLE** (caching) | Step 2 — enable prompt caching |80| Workload is non-real-time (document processing, dataset generation, bulk classification) AND using InvokeModel | **FURTHER_OPTIMIZATION_AVAILABLE** (batch) | Step 3 — migrate to Bedrock Batch API |81| Average output tokens > 1,000 AND max_tokens not set or set too high | **FURTHER_OPTIMIZATION_AVAILABLE** (response length) | Step 4 — set max_tokens, add stop sequences |82| Few-shot examples > 500 tokens per invocation AND invocation count > 100k/month | **FURTHER_OPTIMIZATION_AVAILABLE** (fine-tune) | Step 5 — fine-tune on a cheaper base model |83| Guardrails enabled AND processing > 1B tokens/month | **FURTHER_OPTIMIZATION_AVAILABLE** (guardrail scope) | Step 6 — narrow guardrail to output-only or reduce scope |84| On-demand spend > $10,000/month AND traffic is steady (CV < 0.3) | **FURTHER_OPTIMIZATION_AVAILABLE** (throughput) | Step 7 — evaluate provisioned throughput |85| All dimensions verified AND model is Haiku/Nova AND caching enabled where applicable AND no batch-eligible workload | **OPTIMIZED** | None — continue monitoring |86| InputTokenCount / OutputTokenCount metrics absent or window < 14 days | **NEED_MORE_INFO** | Pull 14-30 day CloudWatch data, re-evaluate |8788## Pre-flight: data gate (run before any optimization decision)8990Optimization decisions are only as good as the underlying data. Pull91these metrics before any recommendation. Full CLI in92`references/bedrock-pricing-and-token-metrics.md`.9394Pre-flight data-source command list moved verbatim to [references/bedrock-pricing-and-token-metrics.md](references/bedrock-pricing-and-token-metrics.md).95Load on demand when wiring live-account data collection before an optimization decision.9697### Data-quality short-circuits9899Data-quality short-circuit table moved verbatim to [references/error-handling.md](references/error-handling.md).100Load on demand when CloudWatch or Cost Explorer data is missing, stale, zero, or contradictory.101102## Process — Optimization logic (apply in order)103104### Step 0: Non-obvious behaviours that change the recommendation105106Step 0 expert-knowledge deep dive (output-token pricing, cache write premium and TTL, batch SLA, fine-tune cost, guardrail scope, KB vector cost, embedding choice, routing latency) moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md).107Load on demand when a recommendation hinges on an operational gotcha.108109### Step 1: Model selection (the #1 lever)110111Model selection is the primary cost lever because the price delta112between model tiers is massive — Haiku is ~60x cheaper than Opus per113token. Downgrading a model that is over-provisioned for the task is the114single highest-impact optimization.115116Full per-1K token pricing hierarchy moved verbatim to [references/bedrock-pricing-and-token-metrics.md](references/bedrock-pricing-and-token-metrics.md).117Load on demand when computing per-model savings math.118119**Task-to-model routing matrix:**120121| Task complexity | Example tasks | Recommended model | Cost vs Opus |122|---|---|---|---|123| Low | Classification, entity extraction, simple Q&A, formatting, sentiment | Haiku or Nova Micro/Lite | ~60x cheaper |124| Medium | Summarisation, code review, multi-step reasoning (2-3 steps), translation | Sonnet or Nova Pro | ~5-7x cheaper |125| High | Complex code generation, deep analysis, creative writing, multi-step reasoning (5+ steps) | Opus | Baseline |126127**Decision gate for model downgrade:**128129| Current model | Workload signal | Target model | Verdict |130|---|---|---|---|131| Opus | Output < 200 tokens avg, task is extraction/classification | Haiku | **FURTHER_OPTIMIZATION_AVAILABLE** |132| Opus | Task requires reasoning but not frontier-level | Sonnet | **FURTHER_OPTIMIZATION_AVAILABLE** |133| Sonnet | Output < 200 tokens avg, task is simple Q&A | Haiku | **FURTHER_OPTIMIZATION_AVAILABLE** |134| Haiku | Already on cheapest capable model | — | No model finding |135| Any | Quality regression after downgrade (user reports, eval scores drop > 5%) | Revert | Do NOT downgrade |136137Haiku-classifier routing pattern moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md).138Load on demand when designing mixed-complexity model routing.139140### Step 2: Prompt caching (reduce input cost by 90%)141142Prompt caching caches a prefix of the prompt (system prompt, knowledge143context, few-shot examples) so that repeated invocations with the same144prefix pay only ~10% of the normal input token rate for the cached145portion.146147**Eligibility checklist:**148149| Condition | Cache eligible? |150|---|---|151| System prompt > 1,000 tokens AND repeated across invocations | YES |152| Knowledge base context injected as static prefix | YES |153| Few-shot examples embedded in prompt | YES |154| Dynamic user query varies per invocation | Prefix still cacheable; query goes after cache boundary |155| System prompt changes per user or per session | NO (cache misses) |156| Invocation rate < 1 per 5 minutes | NO (cache expires before reuse) |157158Prompt-caching pricing math moved verbatim to [references/bedrock-pricing-and-token-metrics.md](references/bedrock-pricing-and-token-metrics.md).159Load on demand when estimating cache savings.160161Prompt-caching enablement CLI (Python SDK cache_control + Prompt Management) moved verbatim to [references/bedrock-pricing-and-token-metrics.md](references/bedrock-pricing-and-token-metrics.md).162Load on demand when wiring cache_control into the invoke body.163164### Step 3: Batch inference (50% discount)165166The Bedrock Batch API (`CreateModelInvocationJob`) processes large167datasets asynchronously at a 50% discount versus on-demand real-time168invocation.169170**Eligibility:**171172| Workload characteristic | Batch eligible? |173|---|---|174| Non-real-time (no user waiting for response) | YES |175| Document processing (summarise 10,000 PDFs) | YES |176| Dataset generation (create training data) | YES |177| Bulk classification / labelling | YES |178| Model evaluation runs | YES |179| Interactive chatbot | NO |180| Real-time API endpoint | NO |181| Streaming responses required | NO |182183Batch pricing comparison and create-model-invocation-job CLI moved verbatim to [references/bedrock-pricing-and-token-metrics.md](references/bedrock-pricing-and-token-metrics.md).184Load on demand when migrating a workload to batch.185186**Batch completion time:** Typically minutes to hours depending on187dataset size. The job runs asynchronously and writes results to S3.188189### Step 4: Response length control190191Output tokens cost 3-5x more than input tokens. Reducing output length192is a direct cost saving with no infrastructure change.193194**Levers:**195196| Lever | How | Typical saving |197|---|---|---|198| `max_tokens` | Set to the minimum acceptable response length | 20-60% on output cost |199| Stop sequences | Define stop words that truncate generation early | 10-30% on output cost |200| Structured output (tool use) | Force JSON/array format instead of prose | 30-70% on output cost |201| Prompt engineering ("Answer in 2 sentences") | Instruct model to be concise | 20-50% on output cost |202203Response-length worked math moved verbatim to [references/worked-examples.md](references/worked-examples.md).204Load on demand when sizing a max_tokens / structured-output saving.205206### Step 5: Fine-tuning vs few-shot207208Few-shot examples (embedding 3-10 examples in the prompt) improve209output quality but add input token cost on every invocation. Fine-210tuning absorbs those examples into the model weights, allowing a211cheaper base model to achieve the same quality.212213Break-even formulas moved verbatim to [references/bedrock-pricing-and-token-metrics.md](references/bedrock-pricing-and-token-metrics.md).214Load on demand when deciding fine-tune vs few-shot.215216**Decision gate:**217218| Condition | Recommendation |219|---|---|220| Few-shot tokens > 500/invocation AND invocations > 100k/month | Fine-tune (break-even < 3 months typically) |221| Few-shot tokens < 200/invocation OR invocations < 10k/month | Keep few-shot (fine-tune cost won't amortise) |222| Quality requirement is high AND base Haiku can't match Opus quality | Fine-tune Haiku on Opus outputs (distillation) |223| Few-shot examples change frequently | Keep few-shot (fine-tuning is too rigid) |224225### Step 6: Guardrails and Knowledge Base overhead226227Guardrails cost model moved verbatim to [references/bedrock-pricing-and-token-metrics.md](references/bedrock-pricing-and-token-metrics.md).228Load on demand when scoping guardrail overhead.229230**Recommendation:** Apply guardrails to output only unless input231filtering is a compliance requirement. Output-only halves the overhead.232233Knowledge Base vector-store cost model moved verbatim to [references/bedrock-pricing-and-token-metrics.md](references/bedrock-pricing-and-token-metrics.md).234Load on demand when costing a low-volume RAG workload.235236### Step 7: Provisioned throughput vs on-demand237238Provisioned throughput purchases guaranteed model capacity at a239discounted rate for a time commitment. Suitable for steady-state,240high-volume workloads.241242**Decision tree:**243```244Is monthly on-demand spend > $10,000?245├── NO → Stay on-demand. Provisioned commitment is not worth the complexity.246└── YES → Is traffic steady (coefficient of variation < 0.3)?247 ├── NO → Stay on-demand. Provisioned underutilisation wastes spend.248 └── YES → Is the model available for provisioned throughput?249 ├── NO → Stay on-demand.250 └── YES → Evaluate provisioned throughput quote vs on-demand cost.251```252253**Provisioned throughput units:** Model-specific. One model unit254provides a fixed number of tokens per minute. Contact AWS for pricing255or check `aws bedrock list-foundation-models` for supported models.256257### Step 8: Impact estimation258259Compute the monthly savings for each recommendation:260261```262current_monthly_cost =263 (monthly_input_tokens / 1000 × model_input_rate_per_1k)264 + (monthly_output_tokens / 1000 × model_output_rate_per_1k)265 + guardrail_overhead266 + kb_overhead267268projected_monthly_cost =269 (projected_input_tokens / 1000 × new_model_input_rate_per_1k)270 + (projected_output_tokens / 1000 × new_model_output_rate_per_1k)271 + new_guardrail_overhead272 + new_kb_overhead273274monthly_saving = current_monthly_cost - projected_monthly_cost275```276277Always state assumptions: monthly token counts (input and output278separately), current and projected model, pricing region, caching279status, batch status, guardrail scope.280281### Step 9: Final verdict282283- Any dimension recommends a change → **FURTHER_OPTIMIZATION_AVAILABLE**.284- All dimensions pass AND model is Haiku/Nova AND caching enabled where285 applicable AND no batch-eligible workload → **OPTIMIZED**.286- Change applied and verified this session → **OPTIMIZED** (post-state).287- Data insufficient (InputTokenCount absent, window < 14 days) →288 **NEED_MORE_INFO**.289290Never emit `FURTHER_OPTIMIZATION_AVAILABLE` without first discharging291every `NEED_MORE_INFO` gate.292293## Output format294295Output block template moved verbatim to [references/worked-examples.md](references/worked-examples.md). The STRICT output contract below is the authoritative copy kept in SKILL.md.296Load on demand when rendering the raw output shape.297298Full worked examples (model downgrade, prompt caching, batch migration,299already-optimal, NEED_MORE_INFO, and end-to-end walkthrough) are in300`references/worked-examples.md`.301302## STRICT output contract303304The rules below are hard constraints. Violating any one produces a305misclassification or an arithmetic contradiction that breaks downstream306FinOps automation. Self-check EVERY emitted block before returning.307308### Required output structure309310Every response MUST be a single block using these literal labels, in this311order. Do NOT substitute markdown headings, camelCase, or bold variants.312```text313TARGET: <model-id or workload-name>314VERDICT: OPTIMIZED | FURTHER_OPTIMIZATION_AVAILABLE315REASON: <1-2 sentences naming the recommendation and the supporting data>316RECOMMENDATION:317 Current: <model>, <input tokens/invocation>, <output tokens/invocation>, <invocations/month>318 Proposed: <model>, <projected input tokens>, <projected output tokens>, <invocations/month>319 Dimensions changed: <model | caching | batch | response_length | fine_tune | guardrails | throughput>320 Dimensions checked: <list ALL seven, each ✓ (no finding) or → (finding)>321 Confidence: <HIGH/MEDIUM/LOW> — <one-line rationale>322ESTIMATED_SAVINGS:323 Current monthly: $<amount>324 input tokens: <count> × $<rate>/1k = $<amount>325 output tokens: <count> × $<rate>/1k = $<amount>326 guardrails: $<amount>327 KB: $<amount>328 Projected monthly: $<amount>329 Monthly saving: $<amount> ← MUST equal Current − Projected, 2 decimals330 Annual saving: $<amount> ← MUST equal Monthly × 12331MIGRATION_STEPS:332 1. <specific action with CLI command>333 2. <verification step>334CONFIRM: <confirmation prompt text>335```336337### FORBIDDEN output patterns3383391. **NEVER emit `VERDICT: FURTHER_OPTIMIZATION_AVAILABLE` with340 `Monthly saving: $0.00`.** If every dimension nets zero cost delta,341 the verdict MUST be `OPTIMIZED`.3423432. **NEVER show savings math that does not balance.**344 `Current monthly − Projected monthly` MUST equal `Monthly saving`,345 rounded to 2 decimal places.3463473. **NEVER emit scratch lines** ("WAIT — recompute", "Hmm, let me redo",348 "corrected:") in the output. Finalize the math before emitting.3493504. **NEVER recommend a model downgrade without citing the task type and351 output token evidence.** The REASON MUST name the workload pattern352 that makes the downgrade safe.3533545. **NEVER omit a dimension from the RECOMMENDATION block.** The355 `Dimensions checked` line MUST list all seven dimensions, each marked356 ✓ (no finding) or → (finding).3573586. **NEVER present a quality regression as a cost saving.** If the359 downgrade risks quality loss, surface the risk in REASON and set360 Confidence to MEDIUM or LOW.3613627. **NEVER round intermediate formula steps differently from the final363 figure.** Compute at full precision, round only the displayed result.364365### Perfect example output — FURTHER_OPTIMIZATION_AVAILABLE with verified math366367Every field below is internally consistent. Copy this shape exactly.368369```text370TARGET: anthropic.claude-3-opus-20240229-v1:0 (customer-support-bot)371VERDICT: FURTHER_OPTIMIZATION_AVAILABLE372REASON: Customer support chatbot using Opus for simple FAQ Q&A. Average373 output is 180 tokens (extraction/lookup), well within Haiku's374 capability. Downgrading to Haiku reduces per-token cost 60x on both375 input and output. Additionally, the 2,000-token system prompt is376 repeated on every invocation and prompt caching is not enabled,377 adding a further 89% saving on the cached portion.378RECOMMENDATION:379 Current: Opus, 2,500 input tokens/invocation, 180 output tokens/invocation, 200,000 invocations/month380 Proposed: Haiku, 2,500 input tokens/invocation (500 cached), 180 output tokens/invocation, 200,000 invocations/month381 Dimensions changed: model (Step 1) + caching (Step 2)382 Dimensions checked: model → (Opus to Haiku) caching → (enable)383 batch ✓ (interactive, not eligible) response_length ✓ (already concise)384 fine_tune ✓ (invocations too low to justify) guardrails ✓ (none configured)385 throughput ✓ (spend below $10k threshold)386 Confidence: HIGH — FAQ Q&A is Haiku's sweet spot; output < 200 tokens387 confirms no complex generation; system prompt is static and repeated.388ESTIMATED_SAVINGS:389 Current monthly: $10,200.00390 input tokens: 500,000,000 × $0.015/1k = $7,500.00391 output tokens: 36,000,000 × $0.075/1k = $2,700.00392 Projected monthly: $147.50393 input tokens: 500,000,000 × $0.00025/1k = $125.00394 output tokens: 36,000,000 × $0.00125/1k = $45.00395 caching overhead: ~$22.50 (cache write premium + residual)396 Monthly saving: $10,052.50397 ($10,200.00 − $147.50 = $10,052.50 ✓)398 Annual saving: $120,630.00399MIGRATION_STEPS:400 1. Test Haiku on 100 representative FAQ queries; compare to Opus baseline:401 aws bedrock create-evaluation-job --model-identifiers ...402 2. Enable prompt caching: add "cache_control": {"type": "ephemeral"}403 to the system prompt block in the invoke call.404 3. Deploy Haiku behind a feature flag; route 10% traffic for 7 days.405 4. If quality holds, cut over 100% to Haiku.406CONFIRM: About to downgrade customer-support-bot from Opus to Haiku407 and enable prompt caching. Monthly saving $10,052.50 (98.6%). Proceed? (yes/no)408```409410**Self-check before emit:**411- [ ] `Current monthly − Projected monthly == Monthly saving` (2 decimals)?412- [ ] `Monthly saving × 12 == Annual saving`?413- [ ] All seven dimensions listed in `Dimensions checked`?414- [ ] Every `→` dimension has a corresponding MIGRATION_STEPS entry?415- [ ] No scratch/recompute text in the block?416417## Verdict semantics418419| Verdict | When to emit |420|---|---|421| `FURTHER_OPTIMIZATION_AVAILABLE` | At least one dimension has a concrete, savings-bearing recommendation. |422| `OPTIMIZED` | All dimensions pass (model is Haiku/Nova, caching enabled where applicable, no batch-eligible workload, response length controlled, guardrails scoped). Also emitted when a change was applied and verified this session. |423| `NEED_MORE_INFO` | Data gate failed: InputTokenCount/OutputTokenCount absent, window < 14 days, or model identifier unknown. |424425**Zero-savings rule:** If MONTHLY_SAVING == $0.00 for every dimension,426verdict MUST be `OPTIMIZED`, never `FURTHER_OPTIMIZATION_AVAILABLE`.427428## Anti-Patterns — NEVER (top 5)4294301. **NEVER recommend a model downgrade without verifying the task type.**431 Opus/Sonnet are required for complex reasoning, code generation, and432 creative tasks. Always cite the task pattern that makes a downgrade safe.4334342. **NEVER recommend prompt caching for low-traffic workloads.** If the435 cache expires before reuse, the write premium (1.25x) makes caching436 MORE expensive. Verify invocation rate > 1 per 5 minutes.4374383. **NEVER recommend batch inference for interactive workloads.** Batch439 SLA is minutes to hours. Migrating a chatbot to batch breaks UX.4404414. **NEVER recommend fine-tuning without computing break-even.** If442 invocation volume is low, the training cost never amortises.4434445. **NEVER enable provisioned throughput without verifying traffic445 consistency.** Underutilisation is wasted spend. Only for steady-state,446 high-volume workloads (> $10,000/month on-demand).447448Extended anti-patterns and error-handling tables in `references/bedrock-pricing-and-token-metrics.md`.449## Pre-flight safety checks (run before any remediation CLI)450451- **MANDATORY CONFIRMATION GATE.** Before any state-changing operation,452 emit and await operator approval. Do NOT execute until confirmed.453- **Canary test model downgrades.** Route 10% traffic to the new model454 for 7 days before full cutover.455- **Prompt caching is application-layer.** Changes to the invoke body456 require a code deploy, not an AWS CLI call. Coordinate with the app team.457- **Batch jobs write to S3.** Ensure the output bucket exists and the458 IAM role has write permissions before creating the job.459- **Fine-tuning requires training data.** Prepare 1,000-10,000 examples460 in JSONL. Training takes hours; monitor via461 `aws bedrock get-model-customization-job`.462- **Guardrail changes affect all invocations.** Test in staging first.463- **Provisioned throughput is a commitment.** Cost is incurred regardless464 of usage once purchased.465- **Embedding model changes require re-indexing.** Switching from Titan466 to Cohere changes vector dimensions; the entire KB must be re-indexed.467- **Bulk-operation limit:** Process at most 3 model changes per batch.468 Sort by estimated savings; abort if any model shows quality regression.469470## Recent AWS features (2024-2026)471472Recent AWS features 2024-2026 (prompt caching, batch API, guardrails, KB, Nova, model evaluation, provisioned throughput, Titan Embed v2) moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md).473Load on demand when checking feature availability windows.474475## References476477- `references/bedrock-pricing-and-token-metrics.md` — pricing tables by478 model family, token-to-cost formulas, CloudWatch Bedrock metric reference,479 prompt caching CLI, batch API reference, Guardrails pricing, KB vector480 store cost comparison, error-handling tables, fine-tuning decision tree,481 regional pricing multipliers.482- `references/worked-examples.md` — full worked examples (Opus-to-Haiku483 downgrade with caching, prompt caching enable, batch migration, response484 length control, already-optimal, NEED_MORE_INFO, end-to-end walkthrough).485486## References (load on demand)487488- [references/bedrock-pricing-and-token-metrics.md](references/bedrock-pricing-and-token-metrics.md) — pricing tables and token-metric CLI; now also holds the pre-flight data-source commands, model cost hierarchy, prompt-caching pricing math and CLI, batch pricing/CLI, fine-tune break-even analysis, and Guardrails/KB cost models moved from SKILL.md.489- [references/worked-examples.md](references/worked-examples.md) — full worked examples; now also holds the response-length-control math and the output block template moved from SKILL.md.490- [references/error-handling.md](references/error-handling.md) — data-quality short-circuits (missing metrics, dormant model, short window, CE disagreement) moved from SKILL.md.491- [references/advanced-patterns.md](references/advanced-patterns.md) — quick-start headline rules, mindset, Step 0 non-obvious behaviours, Haiku routing pattern, and Recent AWS features 2024-2026 moved from SKILL.md.492493## Domain494495AWS CloudOps / Bedrock GenAI Cost Optimization & FinOps.496497## AWS documentation498499- **Bedrock User Guide** — https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-bedrock.html500- **Bedrock pricing** — https://aws.amazon.com/bedrock/pricing/501- **Bedrock prompt caching** — https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-caching.html502- **Bedrock batch inference** — https://docs.aws.amazon.com/bedrock/latest/userguide/batch-inference.html503- **Bedrock Guardrails** — https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails.html504- **Bedrock Knowledge Bases** — https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base.html505- **Bedrock CloudWatch metrics** — https://docs.aws.amazon.com/bedrock/latest/userguide/model-monitor-metrics.html506- **Bedrock provisioned throughput** — https://docs.aws.amazon.com/bedrock/latest/userguide/provisioned-throughput.html507- **AWS CLI Bedrock reference** — https://docs.aws.amazon.com/cli/latest/reference/bedrock/508- **Well-Architected Cost Optimization** — https://docs.aws.amazon.com/wellarchitected/latest/cost-optimization-pillar/welcome.html