AI Terms reader for Python
One module, standard library only, no AIPayGen dependency, Python 3.8 or later. MIT. Copy ai_terms.py into your project.
AI Terms is a JSON file a site publishes at /.well-known/ai-terms that says, for each use of its content by AI (search, answer, training, agent), whether that use is allowed, allowed for a price, or not allowed. It is a draft (draft-ovalles-ai-terms), not a standard.
import ai_terms
terms = ai_terms.fetch("https://example.com") # None when the site publishes no terms
if terms:
rule = ai_terms.resolve(terms, "agent", "/blog/post")
if not ai_terms.allowed_within(rule, max_price_usd=0.01):
raise SystemExit("this site does not allow that use at my price")
# and declare what you are doing on every request:
headers = {"AI-Purpose": "agent"}
fetch(site)reads/.well-known/ai-termsover https, capped at 100 KB.resolve(terms, use, path)returns the rule that applies (access, andprice/attributionwhen set).allowed_within(rule, max_price_usd)is the check a careful client makes before reading or paying.validate(doc)returns(errors, warnings).
From a checkout of the repository, run python3 readers/python/test_vectors.py to check it against the published test vectors: 58 of 58 pass.
This is a second implementation of the format, in a different language from the reference one (TypeScript, in the AIPayGen gateway). It has the same author, so it is not yet the independent implementation a standard needs. If you write one, open a pull request and it will be listed here.
License: MIT.
Metadata
Release files for ai-terms 0.1.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 | Provenance | Actions |
|---|---|---|---|---|
| ai_terms-0.1.0.tar.gz | 7.7 kB | Without provenance | Details for ai_terms-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ai_terms-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for ai_terms-0.1.0-py3-none-any.whl |
Total release size: 16.2 kB
Release files / ai_terms-0.1.0.tar.gz
| Download URL | ai_terms-0.1.0.tar.gz |
|---|---|
| Size | 7.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a3c61979a7967675ac5ea86c507d92ca6031d96a28bb51f927bf8479bc46f60c
|
|
BLAKE2b-256 checksum How to use checksums |
7ca628b9cdc38b624da7bf90206b2f3b614d12498a77a3df5bf5baebe2df835a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Release files / ai_terms-0.1.0-py3-none-any.whl
| Download URL | ai_terms-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d71083a0b08c1b89afe2d7e286302a722c164bf9b7090bbfa5ac3102aae2bb63
|
|
BLAKE2b-256 checksum How to use checksums |
052285baf5923e6934f248043aee711faca2a80047c4dcca2af5ff74b7647ada
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Security for ai-terms 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.