Metadata-Version: 2.4
Name: pay.json
Version: 1.2.0
Summary: Python reader for the pay.json standard — machine-readable pricing for AI agents.
Project-URL: Homepage, https://payjson.org
Project-URL: Repository, https://github.com/xenarch-ai/pay-json
Project-URL: Specification, https://github.com/xenarch-ai/pay-json/blob/main/spec/pay-json-v1.md
Author: pay.json community
Author-email: Xenarch <hello@xenarch.dev>
License: MIT
Keywords: ai-agents,micropayments,pay.json,pricing,x402
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Internet :: WWW/HTTP
Requires-Python: >=3.10
Requires-Dist: httpx>=0.24
Provides-Extra: test
Requires-Dist: pytest>=7; extra == 'test'
Requires-Dist: respx>=0.20; extra == 'test'
Description-Content-Type: text/markdown

# pay-json (Python)

Python reader for the [pay.json](https://github.com/xenarch/pay-json)
standard. Fetches a site's `/.well-known/pay.json`, validates structure,
and resolves the price rule for a given URL path.

## Install

```bash
pip install pay-json
```

## Usage

```python
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](https://github.com/xenarch/pay-json/blob/main/spec/pay-json-v1.md) for
the (CC-BY-4.0) specification text itself.
