Skip to main content

A lightweight library to fetch and search AI model pricing data

Project description

Valuator A lightweight Python library to fetch AI model pricing data and perform searches to retrieve input and output costs per token for matching models. Installation pip install valuator

Usage import asyncio from valuator import Valuator

async def main(): valuator = Valuator() try: # Search with regex pattern costs = valuator.get_model_costs("claude.*haiku") print(costs)

    # Search with partial name
    costs = valuator.get_model_costs("gpt-4")
    print(costs)
finally:
    await valuator.close()

asyncio.run(main())

Features

Fetches model pricing data from a specified URL or local cache. Performs regex-based searches on model names for flexible matching. Returns only input_cost_per_token and output_cost_per_token for matched models. Optimized for low memory usage with efficient data structures (sets, cached regex). Asynchronous HTTP requests for fast data retrieval.

Requirements

Python 3.8+ aiohttp

License MIT License

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

valuator-0.2.0.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

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

valuator-0.2.0-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file valuator-0.2.0.tar.gz.

File metadata

  • Download URL: valuator-0.2.0.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for valuator-0.2.0.tar.gz
Algorithm Hash digest
SHA256 a59d843a5e4744b3fa226e737b7159a1a2fac0a4bbbbb9d892f0be8acb8d5341
MD5 7be5b43993bbd065ae3dbcee6191d418
BLAKE2b-256 f19164b7a074712e3a8df32307291760cfd6b5ca3e364fc89d3656855632865c

See more details on using hashes here.

File details

Details for the file valuator-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: valuator-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for valuator-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 547db6da78a70dc2fe6245c3dfdef4497150d21182aa83b592ab202af4f846b1
MD5 fac7419a7c4bde7d3ce300b574475917
BLAKE2b-256 f9c3198a877edaca5ac158a76816cae4cdbaa208f16f544072fc24e1352d2088

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