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"}
Targets pay.json v1.2 (the current spec). v1.2 introduces a
facilitators[] array (multi-facilitator failover), an optional
verifier endpoint, and drops the pre-1.2 single-string facilitator
field. Pre-1.2 documents are not accepted.
License
MIT. See the spec for the (CC-BY-4.0) specification text itself.
Metadata
Release files for pay.json 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pay_json-1.2.0.tar.gz | 15.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pay_json-1.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.2 kB
Release files / pay_json-1.2.0.tar.gz
| Download URL | pay_json-1.2.0.tar.gz |
|---|---|
| Size | 15.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aabd72a603f376a6a7ac2376ed6b398e0dbbadf38c0310ad84c0a71ed4e5ffc0
|
|
BLAKE2b-256 checksum How to use checksums |
36c1441c187ba8b58ab11c707b83c247bbf4cea2ba221d19014da5c41d78dafa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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}
|
Release files / pay_json-1.2.0-py3-none-any.whl
| Download URL | pay_json-1.2.0-py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
13ea4cbaf0856f9ae8dd9b94297676216319f25b817348f11ba1a82a50345635
|
|
BLAKE2b-256 checksum How to use checksums |
e12966016bd62746985c3f70be3352332131f12cb727254116df6d1c62a4f2a6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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}
|