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.1.1.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.1.1-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: valuator-0.1.1.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.1.1.tar.gz
Algorithm Hash digest
SHA256 b99c8b2a056d1ba0fce1c9bd67f669a2f45c1c1ac14c72d8d061402c8839d958
MD5 f7423bc3ecb3003847018f2dad5c8175
BLAKE2b-256 57b22d3d1d5d9119ce479ff38352d7370e88245fbb8d609a751f47beaea3993d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: valuator-0.1.1-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.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4a2945313784283678c80898c28ee1e2a2eed9ad786edb8ebb5817a01b280e5f
MD5 b42ca382fa319782e17f8211e36120bc
BLAKE2b-256 c9aefbb76f3f1bd49261c912359b182d7fec15ff375789dee0a39f999ad6014f

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