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.0.tar.gz (3.3 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.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: valuator-0.1.0.tar.gz
  • Upload date:
  • Size: 3.3 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.0.tar.gz
Algorithm Hash digest
SHA256 544f66523a5844f818f8e4e9602b446a7327ae6f0b38da3c54cdcc83cc34f66b
MD5 eaacd51b4b1e320d07e6c99be5fbe0c1
BLAKE2b-256 a6875dc57da4eb6b28017398940c361b0a7466519d12227f85e8f62ba9334f8c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: valuator-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.6 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 22dc9b3a9de69b6e2993f7d7b88d25b0616428f671d44da713eca94a24ef2870
MD5 7c061feb4ccf6414429a027100d10ea7
BLAKE2b-256 3375d0921c1a6d340001f1b0f2ed82458a485f6ab9e72dcfd5edad5104bad96c

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