Skip to main content

PHION Python client

Budget-safe synchronous x402 v2 client. It gets a non-paying quote, validates the origin, Base network, official USDC contract, PHION recipient and maximum amount, then delegates local signing and retry to the official x402 SDK.

Installing this package never authorizes a payment. A paid call requires an explicit PhionBuyer.call(...), a locally supplied wallet key and a SpendingPolicy. Use a dedicated low-balance wallet and set cumulative, call, expiry and service-path limits through SpendingMandate.

python -m venv .venv
. .venv/bin/activate
pip install -e .
export EVM_PRIVATE_KEY=0x... # dedicated agent wallet; never commit this value
python example.py

The example has a hard limit of 0.001 USDC and verifies the signed result.

The shortest verified workflow resolves first, then carries the resolution ID through the bounded paid call:

resolution = buyer.resolve(
    capability="inference",
    task="Return a one-sentence classification.",
)
candidate = next(
    (
        item for item in resolution["candidates"]
        if item.get("eligible") is True and item.get("serviceId") == "phion-inference"
    ),
    None,
)
if candidate is None:
    raise RuntimeError("no authorized candidate selected")
result = buyer.call(
    candidate["endpoint"],
    {"prompt": "Return a one-sentence classification."},
    mandate,
    trace={"resolution_id": resolution["resolutionId"]},
)
assert result["receipt_verified"] is True

resolve() is advisory: it never signs, pays or executes, and may honestly return ABSTAIN when evidence is incomplete. call() preserves the spending policy and quote checks and automatically verifies a signed receipt when a commercial result is returned. Receipt verification proves integrity and origin, not that arbitrary external source content is necessarily true.

The public MCP decision surface remains available without this package at https://phion.systems/mcp/decision; start with phion_resolve in PREFLIGHT mode when payment is not yet authorized.

Metadata

Release files for phion-client 1.57.0

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

Source distribution (sdist)

Source distribution for phion-client 1.57.0
File Size Uploaded
phion_client-1.57.0.tar.gz 6.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for phion-client 1.57.0
File Interpreter ABI Platform
phion_client-1.57.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.4 kB

Release files / phion_client-1.57.0.tar.gz

Download URL phion_client-1.57.0.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c28acfa086cccaae5a3691388e8645c404e730ce2588cb9cf7e96fb7048ffe10
BLAKE2b-256 checksum
How to use checksums
6a945215b95732d83af856df8e1ce26cd80d220550e2b7104f99c91d0c406b2d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / phion_client-1.57.0-py3-none-any.whl

Download URL phion_client-1.57.0-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eea685b5838c979e66cb2efe12e448c537f94fa5803e3ac19e9e327d8c90d447
BLAKE2b-256 checksum
How to use checksums
cd4fec76f8877391216591513fc1ceebcdbad86403d846547fdc9f8e8cdfe2eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

1.57.0 This release

2 release files

1.52.9

2 release files

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