Nory x402 Payment Tools for Pydantic AI
Enable your Pydantic AI agents to make blockchain payments using the x402 HTTP payment protocol.
Features
- Multi-chain support: Solana and 7 EVM chains (Base, Polygon, Arbitrum, Optimism, Avalanche, Sei, IoTeX)
- Sub-400ms settlement: Fast payment finality for real-time agent interactions
- x402 HTTP protocol: Native support for HTTP 402 Payment Required responses
- Type-safe: Full Pydantic validation with TypedDict responses
- Async-first: Built with httpx for efficient async operations
Installation
pip install pydantic-ai-tools-nory-x402
Quick Start
from pydantic_ai import Agent
from pydantic_ai_tools_nory_x402 import nory_x402_tools
# Create an agent with all payment tools
agent = Agent('openai:gpt-4o', tools=nory_x402_tools())
# Use the agent
result = agent.run_sync("Check if the Nory payment service is healthy")
print(result.data)
Available Tools
nory_get_payment_requirements_tool
Get x402 payment requirements for accessing a paid resource.
from pydantic_ai_tools_nory_x402 import nory_get_payment_requirements_tool
tool = nory_get_payment_requirements_tool()
# Returns: PaymentRequirements with amount, currency, networks, wallet_address
nory_verify_payment_tool
Verify a signed payment transaction before settlement.
from pydantic_ai_tools_nory_x402 import nory_verify_payment_tool
tool = nory_verify_payment_tool()
# Returns: VerificationResult with valid, payer, amount
nory_settle_payment_tool
Settle a payment on-chain with ~400ms settlement time.
from pydantic_ai_tools_nory_x402 import nory_settle_payment_tool
tool = nory_settle_payment_tool()
# Returns: SettlementResult with success, transaction_id, network
nory_lookup_transaction_tool
Look up transaction status.
from pydantic_ai_tools_nory_x402 import nory_lookup_transaction_tool
tool = nory_lookup_transaction_tool()
# Returns: TransactionStatus with status, confirmations, transaction_id
nory_health_check_tool
Check Nory service health and see supported networks.
from pydantic_ai_tools_nory_x402 import nory_health_check_tool
tool = nory_health_check_tool()
# Returns: HealthStatus with status, networks
nory_x402_tools
Get all tools at once:
from pydantic_ai_tools_nory_x402 import nory_x402_tools
# All tools with optional API key
tools = nory_x402_tools(api_key="your-api-key")
Supported Networks
| Network | Chain Type |
|---|---|
solana-mainnet |
Solana |
solana-devnet |
Solana (testnet) |
base-mainnet |
EVM (Base) |
polygon-mainnet |
EVM (Polygon) |
arbitrum-mainnet |
EVM (Arbitrum) |
optimism-mainnet |
EVM (Optimism) |
avalanche-mainnet |
EVM (Avalanche) |
sei-mainnet |
EVM (Sei) |
iotex-mainnet |
EVM (IoTeX) |
Authentication
For public endpoints, no API key is required. For authenticated endpoints:
tools = nory_x402_tools(api_key="your-api-key")
How It Works
- Your agent encounters an HTTP 402 Payment Required response
- Use
nory_get_payment_requirementsto learn how much to pay - Sign and encode the payment transaction (client-side)
- Use
nory_verify_paymentto validate before submission - Use
nory_settle_paymentto execute the payment on-chain - Access the paid resource with the payment receipt
Links
- Nory - Payment infrastructure for AI agents
- x402 Protocol - HTTP payment protocol specification
- Pydantic AI - Agent framework for Python
License
MIT
Metadata
Release files for pydantic-ai-tools-nory-x402 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 |
|---|---|---|---|---|
| pydantic_ai_tools_nory_x402-0.1.0.tar.gz | 5.2 kB | Without provenance | Details for pydantic_ai_tools_nory_x402-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pydantic_ai_tools_nory_x402-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for pydantic_ai_tools_nory_x402-0.1.0-py3-none-any.whl |
Total release size: 11.9 kB
Release files / pydantic_ai_tools_nory_x402-0.1.0.tar.gz
| Download URL | pydantic_ai_tools_nory_x402-0.1.0.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
50e1a4e551f06803102ae3c8b34d6e9f1d990424b2ab5caa9632756e19a1b785
|
|
BLAKE2b-256 checksum How to use checksums |
51df5faca494df3bb506259b60142b7fce1e3c249eb9842ae369ec782cd83c46
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.3
|
Release files / pydantic_ai_tools_nory_x402-0.1.0-py3-none-any.whl
| Download URL | pydantic_ai_tools_nory_x402-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c82b9c80e1fa7eca76f52c31703218b545f8290d35daad7f4bd11b5c3380b65f
|
|
BLAKE2b-256 checksum How to use checksums |
3331aa6db270482e6fbb7292c60d0113d1e7510ab48a084b8f03571e447113db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.3
|
Security for pydantic-ai-tools-nory-x402 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.