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

Uploaded Python 3

File details

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

File metadata

  • Download URL: valuator-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 5f27dd05ea4ea59ef89592c541b9645f4587f6a7b01315b8c8d96bda84534455
MD5 ffaa1b3fcdb14f24af6b3c3c8f355ef6
BLAKE2b-256 49c36d93656f2b9b430703e489fd1123699b2dda68eb471e8f2ba2d8c31d506b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: valuator-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 47cfa7e1f5fef37968e606ca8d2ba05e1357b43073b6d88fc192fa3e654574dd
MD5 7d56b02bf7844267b55030da010de2ea
BLAKE2b-256 ae96915c2f2a08ffe30a382db252ebaeb379637d88238c56293212b3486f200e

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