Skip to main content

Prompt-Profiler & Token-Kostenrechner

Project description

PromtProf

PyPI License: MIT Python

Ein leichter Token-Kostenrechner & Prompt-Profiler – mit:

  • YAML-basierter Preistabelle (PROMTPROF_PRICING oder --pricing)
  • Währungsumrechnung (FX) per YAML (PROMTPROF_FX oder --fx + --to-currency)
  • Tokenzählung via tiktoken (optional) und Fallback
  • CLI & Python-API

Installation

pip install -e .

Pricing-YAML

# pricing.yaml
models:
  gpt-5-mini:
    prompt_per_million: 0.25
    completion_per_million: 2.00
  sonnet-3-7:
    prompt_per_million: 3.00
    completion_per_million: 15.00
  gemini-flash:
    prompt_per_million: 0.10
    completion_per_million: 0.40
  llama-4:
    prompt_per_million: 0.15
    completion_per_million: 0.60
  my-internal-model:
    prompt_per_million: 0.07
    completion_per_million: 0.11

Setze den Pfad per ENV oder Flag:

export PROMTPROF_PRICING=/pricing.yaml

FX-YAML (Währungsumrechnung)

# fx.yaml
base: USD
rates:
  EUR: 0.92
  GBP: 0.78
  JPY: 145.0

ENV setzen oder Flag verwenden:

export PROMTPROF_FX=/fx.yaml

CLI

# Ohne Umrechnung (USD)
promtprof --model my-internal-model --pricing /path/pricing.yaml --file prompt.txt

# Mit Umrechnung in EUR
promtprof --model my-internal-model --pricing /path/pricing.yaml --fx /path/fx.yaml --to-currency EUR --file prompt.txt

Python-API

from promtprof import estimate, PricingTable, FxRates

pt = PricingTable.from_yaml("/path/pricing.yaml")
fx = FxRates.from_yaml("/path/fx.yaml")
prof = estimate("Hallo", model="my-internal-model", pricing=pt, expected_output_tokens=5, currency="EUR", fx=fx)
print(prof.total_cost_usd, prof.total_cost, prof.currency)

MIT

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

promtprof-0.4.3.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

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

promtprof-0.4.3-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file promtprof-0.4.3.tar.gz.

File metadata

  • Download URL: promtprof-0.4.3.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for promtprof-0.4.3.tar.gz
Algorithm Hash digest
SHA256 ea100b56f9c632e4adda139d08c2372ac8474f79d754bc5ea1508710a9555beb
MD5 bfb64500997e42ca9409f1961e9aff0b
BLAKE2b-256 d1266ca770f1ea20f0288eeb320c01d5c17f90ce7f6edd57e42d49cd0ce2532f

See more details on using hashes here.

File details

Details for the file promtprof-0.4.3-py3-none-any.whl.

File metadata

  • Download URL: promtprof-0.4.3-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for promtprof-0.4.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d485cc09ca8c8ff696e045ec166c99de7faf6670384bcb40d03d3e7691a3491a
MD5 3db58eaffef0b2ebca4f76767b6ce2bf
BLAKE2b-256 441b59e6cb78730ea68bfb799106a1d3ee29e296a823b1b092c80befa66540bb

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