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

import asyncio
from valuator import Valuator

async def main():
    valuator = Valuator()
    try:
        await valuator.initialize()
        print(valuator.get_model_costs("claude.*haiku"))
        print(valuator.get_model_costs("gpt-4"))
    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.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.2.1-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: valuator-0.2.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.2.1.tar.gz
Algorithm Hash digest
SHA256 3f963a1bca2907f12c0e1feb3278b46cd950928d270889e57261a61c3967848a
MD5 7892471d2de6cf7dde3a06db56e2073f
BLAKE2b-256 8e34e4243ee0e5d65139dc8df4e33d0c106890fd5e651bde0e02bfa0cbb32f68

See more details on using hashes here.

File details

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

File metadata

  • Download URL: valuator-0.2.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.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8859a8cda5a0a64d70f93d5ae9f80c140397884c903c1e4634a78e91cf1c14d5
MD5 9bbab19fa13e3c8612e08ebc56e8c7a4
BLAKE2b-256 c679ff770c78c44aff79fd9948507deb3f34259bc65b4ed0949a5b709512287f

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