Skip to main content

OpenNodes Node Kit (Python) — MVP

Implements REQ-003 (subset): a reverse proxy that turns any OpenAI-compatible engine (vLLM, TGI, Ollama — all expose /v1) into a conforming ONP Node without touching the engine.

Requires Python ≥3.11. Dependencies: aiohttp, cryptography.

What it does

  • onp-node init — interrogates the engine's /v1/models, writes onp-node.toml (operator fills in pricing / data policy / identity) and generates an Ed25519 signing key.
  • onp-node serve — serves the signed Node Card at /.well-known/open-node.json, JWKS, the HTTP challenge endpoint, /onp/health, and proxies /v1/models + /v1/chat/completions with the ONP layer: header validation (409 offering-mismatch / price_changed), usage accounting (engine usage passed through; approximated when the engine omits it), and signed receipts — inline JWS header for non-streaming, by-URL (/onp/receipts/{id}, materialized after the stream ends) for streaming. Every receipt is appended to onp-receipts.jsonl — your audit trail: ids, token counts, amount and request hash, never prompt text — and the newest 50,000 stay retrievable by id, also after a restart ([receipts] file / keep in onp-node.toml; file = "" keeps them in memory only; the file grows ~0.8 KB per request, rotate it like any log). Plain OpenAI traffic without ONP headers passes untouched (NK-INV-02) — existing engine users are unaffected.
  • onp-node check — client-side Stage A self-test (card, signature, health, models agreement, blind invocation with usage + receipt); register refuses to submit while it fails (NK-REG-04, --force overrides).
  • onp-node register <registry> — submits the card URL, stages the HTTP challenge token (the kit serves it itself), completes verification, prints the resulting tier + Stage A verdict.

Cross-language proof

tests/test_e2e.py runs a mock engine → the kit → the real JS registry as a subprocess: registration, challenge, card signature verification across languages (Python Ed25519 signer, JS verifier, byte-identical stable JSON), Stage A pass to community, search with real pricing, pinned invoke with Python-verified receipt math, streaming receipt-by-URL, both 409s, and untouched plain-OpenAI traffic.

python -m venv .venv
.venv\Scripts\python -m pip install aiohttp cryptography
.venv\Scripts\python -m unittest discover -s tests

Real deployment (e.g. Ollama on this machine)

pipx install onp-node            # from PyPI; from a checkout: pipx install ./node-kit
onp-node init --engine http://127.0.0.1:11434/v1 --id org.example.ai --public-url https://ai.example.org
# The node id must be the reverse of the host that serves it (ai.example.org -> org.example.ai, or a
# name below it such as org.example.ai.box): registries accept a card only from a host that controls the id.
# review onp-node.toml (pricing, data_policy), then:
onp-node serve                   # add --mdns (pip install 'onp-node[mdns]') so LAN clients such as onp-ollama discover it
onp-node check
onp-node register https://registry.example.org

Describe each model so clients route well — a 235B model on four H100s and a 3B model on a laptop must not look alike. Ollama engines report size, quantization and tool/vision support themselves; vLLM reports the context length it serves (max_model_len). Add or correct the rest in onp-node.toml, keyed by the engine's model id:

[model."Qwen/Qwen3-235B-A22B-FP8"]
params_b = 235
supports = ["tool_calls", "json_mode"]   # also "vision"
languages = ["en", "de", { lang = "pl", grade = "native" }]
expected_tps = 60                        # claimed; the registry's measurements are shown beside it

Card-only listing (you already run an OpenAI-compatible API)

If you operate a production API and won't put a proxy in its path, list it with a static card instead. The kit signs the card once; you host two JSON files on your domain; the registry probes your real API with a key you provide.

pipx install onp-node
onp-node init --engine https://api.example.com/v1 --id com.example.ai --public-url https://ai.example.com   # ONP_ENGINE_KEY=<key> if /models needs one
# edit onp-node.toml: pricing (per MTok), schemes = ["prepaid"], data_policy, optional [hardware]
onp-node card --signup https://console.example.com/keys --out well-known
# host well-known/open-node.json and well-known/jwks.json at https://ai.example.com/.well-known/
ONP_PROBE_KEY=<a key with a small quota> onp-node register https://registry.opennodes.io \
    --card-url https://ai.example.com/.well-known/open-node.json --probe-key-env ONP_PROBE_KEY
# it prints a challenge: publish it as /.well-known/onp-challenge/<token> or a DNS TXT record; the command waits
  • The node id is the reverse of the host serving the card (ai.example.com → com.example.ai); your API may live on any host.
  • The probe key is held as pending until your challenge passes, is sent only to your card's own endpoints, and never appears in any registry API. Give it a small dedicated quota.
  • health defaults to your /models endpoint. Card-only listings carry no ONP receipts and no revision enforcement — clients call your API exactly as they do today.
  • Once you're verified, imported catalog listings that point at your own API (for example from models.dev) are retired automatically, so your verified listing replaces them rather than appearing beside them. Listings that reach your models through Hugging Face's or OpenRouter's routers stay: those are their routes, not yours.

MVP shortcuts (vs REQ-003)

  • Prepaid API-key management (onp-node keys), free-tier rate limiting, probe-allowance accounting, Prometheus metrics, status UI: not yet built (NK-PAY-02/03, NK-INV-04, NK-REG-05).
  • Engine adapters beyond the OpenAI-compatible surface (Ollama /api/tags fallback, TGI /info details, capability probing for tool_calls/vision) are minimal: models come from /v1/models only, supports defaults to ["streaming"].
  • Card revision changes require a serve restart; no apply/ping-on-revision yet (NK-REG-02).
  • TLS termination is assumed to happen in front (reverse proxy/ingress).

Metadata

Release files for onp-node 0.1.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for onp-node 0.1.9
File Size Uploaded Provenance
onp_node-0.1.9.tar.gz 27.3 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for onp-node 0.1.9
File Interpreter ABI Platform
onp_node-0.1.9-py3-none-any.whl Python 3 none any Details

Total release size: 47.8 kB

Release files / onp_node-0.1.9.tar.gz

Download URL onp_node-0.1.9.tar.gz
Size 27.3 kB
Tags Source
SHA-256 checksum
How to use checksums
6c3014512b6c0c989bf44ca3498a004ec467109639d6f78a86a40f593501b84c
BLAKE2b-256 checksum
How to use checksums
b397f55f7aa5586277b7f5b60540e2b816957b6f28f72e65a78b41e580b2e8fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Release files / onp_node-0.1.9-py3-none-any.whl

Download URL onp_node-0.1.9-py3-none-any.whl
Size 20.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6a15f01bf0ca4d5b2495fdd6ec250b1d6c59d89c7a1fa821a10bee5c803f606d
BLAKE2b-256 checksum
How to use checksums
14f4168a7f8a2f83a63ae2570b6721f07dae4134514915b1db7c15c2c90fbf65
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Security for onp-node 0.1.9

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for onp_node-0.1.9.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page