Skip to main content

Instant token count and cost estimate across all major LLMs

Project description

promptpricer

Token count and cost estimate across all major LLMs. One command, no API keys.

$ promptpricer "You are a helpful assistant. Summarize this document in detail."

Prompt: 12 tokens   Expected output: 500 tokens

 Model              Input tokens   Output tokens   Input cost   Output cost      Total
 ──────────────────────────────────────────────────────────────────────────────────────
 gpt-4.1-nano                 12             500   <$0.0001      $0.0002        $0.0002
 gemini-2.0-flash             12             500   <$0.0001      $0.0002        $0.0002
 gpt-4o-mini                  12             500   <$0.0001      $0.0003        $0.0003
 gpt-4.1-mini                 12             500   <$0.0001      $0.0008        $0.0008
 gemini-2.5-flash             12             500   <$0.0001      $0.0013        $0.0013
 o4-mini                      12             500   <$0.0001      $0.0022        $0.0022
 claude-haiku-4               12             500   <$0.0001      $0.0025        $0.0025
 gpt-4o                       12             500   <$0.0001      $0.0050        $0.0051
 claude-sonnet-4              12             500   <$0.0001      $0.0075        $0.0075
 claude-opus-4                12             500    $0.0002      $0.0375        $0.0377

Prices are fetched from LiteLLM and cached locally for 24 hours.

Install

pip install promptpricer

Or from source:

git clone https://github.com/Sreechandh22/Prompt-cost
cd Prompt-cost
pip install -e .

Usage

# pass a prompt directly
promptpricer "your prompt here"

# specify expected output tokens (default: 500)
promptpricer "your prompt" --output 1000

# read from a file
promptpricer --file prompt.txt

# read from clipboard
promptpricer

# filter by provider
promptpricer "your prompt" --filter anthropic
promptpricer "your prompt" --filter openai
promptpricer "your prompt" --filter google

# show only the N cheapest models
promptpricer "your prompt" --top 3

# output as JSON (pipe into other tools)
promptpricer "your prompt" --json

# force refresh pricing cache
promptpricer --update

Providers

Provider Models
OpenAI gpt-4o, gpt-4o-mini, gpt-4.1, gpt-4.1-mini, gpt-4.1-nano, o3, o4-mini
Anthropic claude-opus-4, claude-sonnet-4, claude-haiku-4
Google gemini-2.5-pro, gemini-2.5-flash, gemini-2.0-flash

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

promptpricer-0.1.1.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

promptpricer-0.1.1-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file promptpricer-0.1.1.tar.gz.

File metadata

  • Download URL: promptpricer-0.1.1.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.6

File hashes

Hashes for promptpricer-0.1.1.tar.gz
Algorithm Hash digest
SHA256 bba337d76e5e4ef9550f60a23519775a8edfea5e399609882f8139c9b2904d47
MD5 d58fd08bdce7e5c9d2d16f5129ccca13
BLAKE2b-256 75d0ee42fd94567524b8bdfe897281b7e38c2472da15350962a326470a56fe2a

See more details on using hashes here.

File details

Details for the file promptpricer-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: promptpricer-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.6

File hashes

Hashes for promptpricer-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f75d05e10e6316c975053a32dc9e2e77b6291acaa317baee31b819e7e03f85e2
MD5 137b6121941090188f2ecee2592e3b7f
BLAKE2b-256 e279bcad576d73abc18d2daf0e6a2e30c9371fde8339197b5f448c2643f3e9c1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page