Python reader for the pay.json standard — machine-readable pricing for AI agents.
Project description
pay-json (Python)
Python reader for the pay.json
standard. Fetches a site's /.well-known/pay.json, validates structure,
and resolves the price rule for a given URL path.
Install
pip install pay-json
Usage
from pay_json import PayJson
# Fetch and parse a host's pay.json
doc = PayJson.fetch("example.com")
# Resolve a rule for a given path
rule = doc.match_rule("/api/inference/foo")
if rule:
print(rule.price_usd) # Decimal("0.01")
print(rule.terms) # {"type": "per_unit", "unit": "1000_tokens"}
Supports both v1.0 and v1.1 of the pay.json spec. v1.1 adds optional
per-rule terms and budget_hints fields.
License
MIT. See the spec for the (CC-BY-4.0) specification text itself.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pay_json-1.1.0.tar.gz.
File metadata
- Download URL: pay_json-1.1.0.tar.gz
- Upload date:
- Size: 14.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8f963c5af30243314b67a532825c02e405427ac57a39adec49b35606c165c0a7
|
|
| MD5 |
08dc3d8e7c70afacbb7ec86d0e57972e
|
|
| BLAKE2b-256 |
04448b47af3c71fccee0c62dffc314b08ea9c949c5a85ed1a112ea63dce44a55
|
File details
Details for the file pay_json-1.1.0-py3-none-any.whl.
File metadata
- Download URL: pay_json-1.1.0-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a90d80026bcea6adf7da8cd971ddc1d9f92d084d3374da6294f9c31fcf17701
|
|
| MD5 |
95850068642e997317504d689ff6cab4
|
|
| BLAKE2b-256 |
a1236033370939f7d4acd0208e4e2dd3d45209611876b2a62246d3c2c7777ceb
|