By dnvriend
CLI tool for analyzing AWS Bedrock model costs with comprehensive reporting and visualization
A CLI tool for analyzing AWS Bedrock model costs using the Cost Explorer API.
Requirements: Python 3.14+, AWS CLI configured, uv
git clone https://github.com/dnvriend/aws-bedrock-cost-tool.git
cd aws-bedrock-cost-tool
uv sync
uv build
uv tool install dist/aws_bedrock_cost_tool-0.1.0-py3-none-any.whl
# Option 1: AWS profile
aws configure --profile my-profile
aws-bedrock-cost-tool --profile my-profile
# Option 2: Environment variables
export AWS_PROFILE=my-profile
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Action": "ce:GetCostAndUsage",
"Resource": "*"
}]
}
Cost Explorer must be enabled in AWS Console.
# JSON output (default), last 30 days
aws-bedrock-cost-tool
# Summary with all models, tokens, and cache stats
aws-bedrock-cost-tool --summary
# Table output
aws-bedrock-cost-tool --table
# Specific period and profile
aws-bedrock-cost-tool --period 7d --profile production
# Time series plot
aws-bedrock-cost-tool --plot-time
# Bar chart by model
aws-bedrock-cost-tool --plot-models
# All visualizations (ASCII)
aws-bedrock-cost-tool --all-visual
# High-quality matplotlib plots (iTerm2 only)
aws-bedrock-cost-tool --plot-image
# Full detail with regional breakdown
aws-bedrock-cost-tool --detail full --table
Summary:
Total: ~$1015.85
Models:
Claude Sonnet 4.5: ~$962.35 (~24M tokens, cache read: ~1410M tokens, cache write: ~95M tokens)
Claude Haiku 4.5: ~$35.92 (~24M tokens, cache read: ~20M tokens, cache write: ~5M tokens)
Claude Sonnet 4: ~$16.95 (~4M tokens)
Claude Opus 4.5: ~$0.63 (~0.006M tokens)
JSON (pipe to jq):
aws-bedrock-cost-tool | jq '.models[] | select(.model_name | contains("Sonnet"))'
| Option | Description |
|---|---|
--period | Time period (7d, 2w, 1m, 3m). Default: 30d, Max: 365d |
--profile | AWS profile name |
--detail | basic, standard (default), full |
--table | Table output |
--plot-time | Time series plot (ASCII) |
--plot-models | Bar chart by model (ASCII) |
--all-visual | All ASCII visualizations |
--plot-image | Matplotlib plots inline in iTerm2 |
--summary | Summary with tokens and cache stats |
-v | Verbose logging (-vv for debug, -vvv for trace) |
-q | Quiet mode |
from aws_bedrock_cost_tool import (
create_cost_explorer_client,
query_bedrock_costs,
analyze_cost_data,
parse_period,
calculate_date_range,
format_date_for_aws,
)
days = parse_period("30d")
start_date, end_date = calculate_date_range(days)
client = create_cost_explorer_client(profile_name="my-profile")
response = query_bedrock_costs(client, format_date_for_aws(start_date), format_date_for_aws(end_date))
cost_data = analyze_cost_data(response, start_date, end_date, detail="standard")
print(f"Total: ${cost_data['total_cost']:.2f}")
for model in cost_data['models']:
print(f"{model['model_name']}: ${model['total_cost']:.2f}")
make install # Install dependencies
make check # Run lint + typecheck + test + security
make pipeline # Full pipeline including build
MIT License - see LICENSE
Dennis Vriend - @dnvriend
Own this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimOwn this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimBased on adoption, maintenance, documentation, and repository signals. Not a security audit or endorsement.
npx claudepluginhub joshuarweaver/cascade-business-ops --plugin dnvriend-aws-bedrock-cost-toolA CLI tool that loads images, sends a prompt to ollama to invoke deepseek-ocr and instructs it to return the image as markdown
Claude Code Scheduler
vector rag gui
Generate images using Google Gemini with AI prompt optimization, cost tracking, and multi-turn conversations
A CLI that provides text-to-speech using kokoro
Expert FinOps guidance for cloud, AI, SaaS, and data-platform spend. Reference files spanning AWS (incl. SageMaker operational FinOps and GPU instance rightsizing), Azure, GCP, Anthropic, Bedrock, Azure OpenAI, Vertex AI, Databricks, Microsoft Fabric, Snowflake, OCI, AI coding tools, FinOps Framework 2024+2026, GreenOps (AWS Sustainability Console, CSRD engagement framing), self-hosted vs managed AI inference decisioning, anomaly management, allocation and showback, chargeback (incl. Finance and accounting prerequisites), onboarding workloads (migration-time cost hygiene + M&A), Kubernetes (cross-cluster EKS/GKE/AKS discipline), waste-detection playbooks (seven-category taxonomy backed by OptimNow's WasteLine appliance) plus RAG-friendly named-pattern playbooks across AWS, Azure, GCP and cross-cloud (incl. SageMaker idle endpoint, notebook auto-shutdown, MME consolidation, oversized GPU, multi-GPU underutilization, MIG candidate, GPU for CPU-bound workload, outdated GPU generation), SaaS asset management, and ITAM. Open source, model-agnostic, refreshed monthly.
AWS cost optimization, monitoring, and operational excellence — analyze bills, estimate costs, set CloudWatch alarms, query logs, audit CloudTrail, and assess security posture. Use for AWS costs, budgets, observability, or auditing.
Comprehensive CloudZero cost analysis plugin providing AI-powered skills for investigating cost spikes, analyzing trends, comparing spending, optimizing services, and tracking cloud infrastructure costs using CloudZero's MCP server
A real-time directory of AI models that allows your AI agent to advise and pick the ideal LLM for the user's task.
This no-cost tool assesses your current cloud provider's usage, geography, and billing data to estimate and compare AWS services and pricing, and recommends migration or continued use of your current provider. Supports GCP and Heroku migrations. AWS pricing is based on current published pricing and may vary over time. The tool may generate a .migration folder containing comparison and migration execution data, which you may delete upon completion or use to migrate to AWS.
Claude plugin for FinOps Toolkit, providing tools and integrations for financial operations management.