Skip to main content

AI-Cost-CLI & MCP (aicost-mcp)

PyPI npm License: MIT Python 3.9+ MCP Registry

A terminal-based AI API cost calculator, monthly workload budget estimator, recommender, and Model Context Protocol (MCP) server. Compare Direct providers vs. Aggregators/Gateways, factor in prompt caching and Batch API discounts, and convert across 200+ currencies.

Preview: Direct vs. Aggregator Comparison

Compare the effective cost of using models directly vs. through gateways like OpenRouter, including platform fees, context windows, and prompt-caching rates.

                Comparison: gpt-4o vs openrouter/gpt-4o                 
┏━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Attribute          ┃         gpt-4o          ┃   openrouter/gpt-4o   ┃
┡━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━┩
│ Provider           │         OpenAI          │      OpenRouter       │
├────────────────────┼─────────────────────────┼───────────────────────┤
│ Source             │         Direct          │      Aggregator       │
├────────────────────┼─────────────────────────┼───────────────────────┤
│ Platform Fee       │          0.0%           │         5.5%          │
├────────────────────┼─────────────────────────┼───────────────────────┤
│ Context Window     │          128K           │         128K          │
├────────────────────┼─────────────────────────┼───────────────────────┤
│ Input Cost         │    2.5000 USD (/1M)     │   2.6375 USD (/1M)    │
├────────────────────┼─────────────────────────┼───────────────────────┤
│ Cached Input       │    1.2500 USD (/1M)     │   1.3188 USD (/1M)    │
├────────────────────┼─────────────────────────┼───────────────────────┤
│ Output / Unit Cost │    10.0000 USD (/1M)    │   10.5500 USD (/1M)   │
└────────────────────┴─────────────────────────┴───────────────────────┘

Supported Models

Text Models

Model Provider Input/1M Cached/1M Output/1M Context
Claude Opus 4.7 Anthropic $5.00 $0.50 $25.00 200K
GPT-5.5 OpenAI $5.00 $1.25 $30.00 12M
GPT-5.5 Pro OpenAI $30.00 $15.00 $180.00 12M
Claude Sonnet 4.6 Anthropic $3.00 $0.30 $15.00 200K
Gemini 3.1 Pro Google $2.00 $0.50 $12.00 2M
DeepSeek R1 DeepSeek $0.55 $0.14 $2.19 128K
Gemini 3.1 Flash-Lite Google $0.25 $0.0625 $1.50 1M
DeepSeek V3 DeepSeek $0.14 $0.014 $0.28 128K

Image, Video & Audio Models

Model Provider Price Billing Unit Type
Imagen 4 Fast Google $0.02 per image Image
GPT-Image-1 OpenAI $0.02 per image Image
DALL-E 3 OpenAI $0.04 per image Image
Imagen 4 Ultra Google $0.06 per image Image
Veo 3 Lite Google $0.05 per second Video
Veo 3 Google $0.40 per second Video
Lyria 3 Clip Google $0.04 per clip Music
Lyria 3 Pro Google $0.08 per song Music
Whisper OpenAI $0.006 per minute Speech-to-Text
TTS Standard / HD OpenAI $15 / $30 per 1M chars Text-to-Speech

Full catalog available via aicost list --currency USD

Features

  • Direct vs. Aggregator & Gateway Math: Automatically breaks down base API costs vs. middle-layer fees (e.g., OpenRouter 5.5%) and enterprise gateway monthly tiers.
  • Prompt Caching & Batch Discounts: First-class support for --cached-input read rates and --batch API discounts.
  • Monthly Workload Estimator (aicost estimate): Forecast daily, 30-day, and annual API spend from expected request traffic.
  • 200+ Currencies with Offline Resilience: Powered by a 3-tier CDN currency engine (TRY, EUR, GBP, AZN, AED, JPY, etc.) with 24-hour local cache.
  • Scriptable --json Mode: Every CLI command supports clean JSON output for CI/CD pipelines and AI agent skills.
  • Dual MCP Server Ecosystem (npx & uvx): Zero-install MCP integration via npm (aicost-mcp) or PyPI (aicost-cli).

Installation

Python CLI (pip / uv)

pip install aicost-cli

Add to your MCP configuration (claude_desktop_config.json or .cursor/mcp.json):

{
  "mcpServers": {
    "aicost": {
      "command": "npx",
      "args": ["-y", "aicost-mcp"]
    }
  }
}

Or run via Python uvx:

{
  "mcpServers": {
    "aicost": {
      "command": "uvx",
      "args": ["--from", "aicost-cli", "aicost-mcp"]
    }
  }
}

CLI Usage

List & Filter Models

aicost list --currency TRY
aicost list --provider Google --type video --hide-legacy
aicost list --tag agentic --sort input --json

Calculate Cost (with Caching & Batch Support)

# Standard text model calculation
aicost calc claude-opus-4.7 --input 200000 --cached-input 800000 --output 100000 --currency USD

# Batch API (-50%) calculation
aicost calc gpt-5.5 --input 1000000 --output 500000 --batch

# Aggregator fee breakdown
aicost calc openrouter/gpt-4o --input 1000000 --output 500000 --currency TRY

# Multimodal unit calculation (seconds, minutes, images)
aicost calc veo-3 --units 8 --currency USD

Project Monthly Workload Budget

aicost estimate claude-sonnet-4.6 --requests-per-day 2500 --input 1800 --output 450 --currency USD

Compare 2+ Models Side-by-Side

aicost compare claude-opus-4.7 gpt-5.5 gemini-3.1-pro --currency USD

Get Task Recommendations

aicost recommend "fast cheap agentic coding" --max-cost 1.0 --currency USD

Sync Latest Pricing & Exchange Rates

aicost sync

Registries

Community & Governance

License

MIT — see LICENSE for details. Developed by Ufuk Aydın.

Metadata

Release files for aicost-cli 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aicost-cli 1.2.0
File Size Uploaded Provenance Actions
aicost_cli-1.2.0.tar.gz 30.5 kB With provenance Details for aicost_cli-1.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for aicost-cli 1.2.0
File Interpreter ABI Platform Actions
aicost_cli-1.2.0-py3-none-any.whl Python 3 none any Details for aicost_cli-1.2.0-py3-none-any.whl

Total release size: 57.8 kB

Release files / aicost_cli-1.2.0.tar.gz

Download URL aicost_cli-1.2.0.tar.gz
Size 30.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ed9767f9b9f7cdf561be1114f8fa767dd08c9c52e75807251bf1f83661af42b5
BLAKE2b-256 checksum
How to use checksums
b8b54d380d325d9362f8ff0a933b90d76ce3a5bfdb35ab42e8f271ee346142e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Release files / aicost_cli-1.2.0-py3-none-any.whl

Download URL aicost_cli-1.2.0-py3-none-any.whl
Size 27.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5d8e32d5044aafcd34ae0cf5d671b4bfd8c014a7644fbd36030618cd37fb928a
BLAKE2b-256 checksum
How to use checksums
f92311f0598d54ce91c98032527a0e34efb42f49963bad56c00dcc19ffcbc7ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Security for aicost-cli 1.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for aicost_cli-1.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page