{"id":50897776,"url":"https://github.com/tekacs/llm-pricing","last_synced_at":"2026-07-03T16:01:25.650Z","repository":{"id":306463097,"uuid":"1026329537","full_name":"tekacs/llm-pricing","owner":"tekacs","description":null,"archived":false,"fork":false,"pushed_at":"2025-07-26T22:30:57.000Z","size":105,"stargazers_count":25,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-08-31T19:51:36.976Z","etag":null,"topics":["ai-tools","anthropic","cli","cost-calculator","cost-estimation","developer-tools","llm","openrouter","pricing","pricing-tool","token-counting","tokens"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tekacs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-25T17:39:10.000Z","updated_at":"2025-08-19T11:49:39.000Z","dependencies_parsed_at":"2025-07-25T23:03:31.800Z","dependency_job_id":"e01d251d-ea5e-494f-a740-53e11df7e204","html_url":"https://github.com/tekacs/llm-pricing","commit_stats":null,"previous_names":["tekacs/llm-pricing"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/tekacs/llm-pricing","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tekacs%2Fllm-pricing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tekacs%2Fllm-pricing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tekacs%2Fllm-pricing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tekacs%2Fllm-pricing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tekacs","download_url":"https://codeload.github.com/tekacs/llm-pricing/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tekacs%2Fllm-pricing/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35092185,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-03T02:00:05.635Z","response_time":110,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-tools","anthropic","cli","cost-calculator","cost-estimation","developer-tools","llm","openrouter","pricing","pricing-tool","token-counting","tokens"],"created_at":"2026-06-16T01:31:30.079Z","updated_at":"2026-07-03T16:01:25.638Z","avatar_url":"https://github.com/tekacs.png","language":"Rust","funding_links":[],"categories":["cli"],"sub_categories":[],"readme":"# LLM Pricing\n\nA CLI tool to visualize OpenRouter model pricing and calculate actual request costs in a clean, tabular format.\n\n## Features\n\n- 📊 **Tabular display** of model pricing per 1M tokens\n- 🧮 **Cost calculation** for actual requests with input/output tokens\n- 💾 **Cache pricing** support with TTL-based pricing (5min vs 1h)\n- 🔍 **Filter models** by name or provider (e.g., `anthropic`, `sonnet`)\n- 📝 **Verbose mode** showing all model details\n- 🌐 **Live data** fetched from [OpenRouter API](https://openrouter.ai/api/v1/models) ([docs](https://openrouter.ai/docs/overview/models), [api reference](https://openrouter.ai/docs/api-reference/list-available-models))\n\n## Quick Start\n\nCalculate the cost of a request with 10,000 input tokens, 200 output tokens, and 9,500 cached tokens:\n\n```bash\nllm-pricing calc 10000 200 -c 9500 opus-4 gpt-4.1\n```\n\n```\nCost calculation: 10000 input + 200 output (9500 cached, 5m TTL)\n\nModel                   | Input     | Output    | Cache Read | Cache Write | Total    \n------------------------+-----------+-----------+------------+-------------+----------\nanthropic/claude-opus-4 | $0.000000 | $0.015000 | $0.014250  | $0.009375   | $0.038625\nopenai/gpt-4.1          | $0.001000 | $0.001600 | $0.004750  | $0.000000   | $0.007350\nopenai/gpt-4.1-mini     | $0.000200 | $0.000320 | $0.000950  | $0.000000   | $0.001470\nopenai/gpt-4.1-nano     | $0.000050 | $0.000080 | $0.000237  | $0.000000   | $0.000367\n```\n\n## Installation\n\n### From Releases\n\nDownload the latest binary for your platform from the [releases page](https://github.com/tekacs/llm-pricing/releases).\n\n### From crates.io\n\n```bash\ncargo install llm-pricing\n```\n\n\u003cdetails\u003e\n\u003csummary\u003eFrom Source\u003c/summary\u003e\n\n```bash\ngit clone https://github.com/tekacs/llm-pricing.git\ncd llm-pricing\ncargo install --path .\n```\n\u003c/details\u003e\n\n## Usage\n\n### Calculate Request Costs\n\nCalculate the actual cost of a request with specific token counts:\n\n```bash\nllm-pricing calc 10000 200 opus-4\n```\n\n```\nCost calculation: 10000 input + 200 output\n\nModel                   | Input     | Output    | Total    \n------------------------+-----------+-----------+----------\nanthropic/claude-opus-4 | $0.150000 | $0.015000 | $0.165000\n```\n\nWith cached tokens (uses 5-minute TTL by default):\n\n```bash\nllm-pricing calc 10000 200 -c 9500 opus-4\n```\n\n```\nCost calculation: 10000 input + 200 output (9500 cached, 5m TTL)\n\nModel                   | Input     | Output    | Cache Read | Cache Write | Total    \n------------------------+-----------+-----------+------------+-------------+----------\nanthropic/claude-opus-4 | $0.000000 | $0.015000 | $0.014250  | $0.009375   | $0.038625\n```\n\nWith 1-hour cache TTL (higher write costs):\n\n```bash\nllm-pricing calc 10000 200 -c 9500 --ttl 60 opus-4\n```\n\n#### Understanding Cache vs No-Cache Pricing\n\nThe `-c` flag indicates you're using caching rules, which affects pricing even when no tokens are cached:\n\n**Without `-c` flag (no caching):**\n```bash\nllm-pricing calc 10000 200 opus-4\n```\n```\nCost calculation: 10000 input + 200 output\n\nModel                   | Input     | Output    | Total    \n------------------------+-----------+-----------+----------\nanthropic/claude-opus-4 | $0.150000 | $0.015000 | $0.165000\n```\n\n**With `-c 0` flag (using caching, 0 cached tokens):**\n```bash\nllm-pricing calc 10000 200 -c 0 opus-4\n```\n```\nCost calculation: 10000 input + 200 output\n\nModel                   | Input     | Output    | Cache Read | Cache Write | Total    \n------------------------+-----------+-----------+------------+-------------+----------\nanthropic/claude-opus-4 | $0.000000 | $0.015000 | $0.000000  | $0.187500   | $0.202500\n```\n\nWhen using caching (`-c` flag), all new tokens are written to cache at cache write prices (1.25x base price for 5-minute TTL), which replaces the regular input cost.\n\n### List Models\n\n#### Basic Usage\n\nShow all models in a table format:\n\n```bash\nllm-pricing\n```\n\n```\nModel                                     | Input | Output | Cache Read | Cache Write\n------------------------------------------+-------+--------+------------+------------\nanthropic/claude-opus-4                   | 15.00 | 75.00  | 1.50       | 18.75      \nanthropic/claude-sonnet-4                 | 3.00  | 15.00  | 0.30       | 3.75       \ngoogle/gemini-2.5-pro                     | 1.25  | 10.00  | N/A        | N/A        \nx-ai/grok-4                               | 3.00  | 15.00  | 0.75       | N/A        \nopenai/gpt-4o                             | 2.50  | 10.00  | N/A        | N/A        \n...\n```\n\n### Filter by Provider\n\nShow only Anthropic models:\n\n```bash\nllm-pricing anthropic\n```\n\n```\nModel                                     | Input | Output | Cache Read | Cache Write\n------------------------------------------+-------+--------+------------+------------\nanthropic/claude-opus-4                   | 15.00 | 75.00  | 1.50       | 18.75      \nanthropic/claude-sonnet-4                 | 3.00  | 15.00  | 0.30       | 3.75       \nanthropic/claude-3.5-sonnet               | 3.00  | 15.00  | 0.30       | 3.75       \nanthropic/claude-3.5-haiku                | 0.80  | 4.00   | 0.08       | 1.00       \nanthropic/claude-3-opus                   | 15.00 | 75.00  | 1.50       | 18.75      \n...\n```\n\n### Filter by Model Name\n\nShow models containing \"sonnet\":\n\n```bash\nllm-pricing sonnet\n```\n\n```\nModel                                     | Input | Output | Cache Read | Cache Write\n------------------------------------------+-------+--------+------------+------------\nanthropic/claude-sonnet-4                 | 3.00  | 15.00  | 0.30       | 3.75       \nanthropic/claude-3.7-sonnet               | 3.00  | 15.00  | 0.30       | 3.75       \nanthropic/claude-3.5-sonnet               | 3.00  | 15.00  | 0.30       | 3.75       \nanthropic/claude-3-sonnet                 | 3.00  | 15.00  | 0.30       | 3.75       \n```\n\n### Verbose Output\n\nGet detailed information about models with the `-v` flag:\n\n```bash\nllm-pricing opus-4 -v\n```\n\n```\n=== ANTHROPIC ===\n\nModel: anthropic/claude-opus-4\n  Name: Anthropic: Claude Opus 4\n  Description: Claude Opus 4 is benchmarked as the world's best coding model, at time of release, \n  bringing sustained performance on complex, long-running tasks and agent workflows. It sets new \n  benchmarks in software engineering, achieving leading results on SWE-bench (72.5%) and \n  Terminal-bench (43.2%).\n  Pricing:\n    Input: $15.00 per 1M tokens\n    Output: $75.00 per 1M tokens\n    Cache Read: $1.50 per 1M tokens\n    Cache Write: $18.75 per 1M tokens\n    Per Request: $0\n    Image: $0.024\n  Context Length: 200000 tokens\n  Modality: text+image-\u003etext\n  Tokenizer: Claude\n  Max Completion Tokens: 32000\n  Moderated: true\n```\n\n## Understanding the Output\n\n### Table Columns\n\n- **Model**: The model identifier used in API calls\n- **Input**: Cost per 1M input tokens (USD)\n- **Output**: Cost per 1M output tokens (USD)  \n- **Cache Read**: Cost per 1M tokens read from cache (when available)\n- **Cache Write**: Cost per 1M tokens written to cache (when available)\n\n### Cache Pricing\n\nSome providers (like Anthropic and xAI) offer caching to reduce costs on repeated content:\n\n- **Cache Read**: Much cheaper than regular input tokens (typically 10x less)\n- **Cache Write**: Slightly more expensive than input tokens (to build the cache)\n- **N/A**: Model doesn't support caching\n\n## CLI Options\n\n### List Command (Default)\n\n```bash\nllm-pricing [OPTIONS] [FILTERS...]\n\nArguments:\n  [FILTERS...]  Filter models by name (e.g., 'anthropic/', 'sonnet')\n\nOptions:\n  -v, --verbose  Show verbose output with all model information\n  -h, --help     Print help\n```\n\n### Calculate Command\n\n```bash\nllm-pricing calc [OPTIONS] \u003cINPUT\u003e \u003cOUTPUT\u003e [FILTERS...]\n\nArguments:\n  \u003cINPUT\u003e       Number of input tokens\n  \u003cOUTPUT\u003e      Number of output tokens\n  [FILTERS...]  Filter models by name (e.g., 'anthropic/', 'sonnet')\n\nOptions:\n  -c, --cached \u003cCACHED\u003e  Number of cached input tokens read from cache. Using this flag enables caching pricing rules.\n  -t, --ttl \u003cTTL\u003e        Cache TTL in minutes (affects pricing) [default: 5]\n  -h, --help             Print help\n```\n\n## Development\n\nThis project uses [just](https://github.com/casey/just) for task running:\n\n```bash\n# Show available tasks\njust\n\n# Build the project\njust build\n\n# Run with arguments\njust run anthropic -v\n\n# Format and lint\njust fmt\njust clippy\n```\n\n## License\n\nMIT License - see [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftekacs%2Fllm-pricing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftekacs%2Fllm-pricing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftekacs%2Fllm-pricing/lists"}