Skip to main content

Nory x402 Payment Tools for LlamaIndex

Enable your LlamaIndex 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
  • Simple integration: Drop-in tool spec for any LlamaIndex agent

Installation

pip install llama-index-tools-nory-x402

Quick Start

from llama_index.agent.openai import OpenAIAgent
from llama_index_tools_nory_x402 import NoryX402ToolSpec

# Create the tool spec
tool_spec = NoryX402ToolSpec()

# Create an agent with payment capabilities
agent = OpenAIAgent.from_tools(tool_spec.to_tool_list())

# Use the agent
response = agent.chat("Check if the Nory payment service is healthy")
print(response)

Available Tools

get_payment_requirements

Get x402 payment requirements for accessing a paid resource.

requirements = tool_spec.get_payment_requirements(
    resource="/api/premium/data",
    amount="0.10",  # $0.10 USDC
    network="solana-mainnet"
)

verify_payment

Verify a signed payment transaction before settlement.

result = tool_spec.verify_payment(payload="base64-encoded-payload")

settle_payment

Settle a payment on-chain with ~400ms settlement time.

result = tool_spec.settle_payment(payload="base64-encoded-payload")

lookup_transaction

Look up transaction status.

status = tool_spec.lookup_transaction(
    transaction_id="tx-signature",
    network="solana-mainnet"
)

health_check

Check Nory service health and see supported networks.

health = tool_spec.health_check()

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:

tool_spec = NoryX402ToolSpec(api_key="your-api-key")

How It Works

  1. Your agent encounters an HTTP 402 Payment Required response
  2. Use get_payment_requirements to learn how much to pay
  3. Sign and encode the payment transaction (client-side)
  4. Use verify_payment to validate before submission
  5. Use settle_payment to execute the payment on-chain
  6. Access the paid resource with the payment receipt

Links

  • Nory - Payment infrastructure for AI agents
  • x402 Protocol - HTTP payment protocol specification
  • LlamaIndex - Data framework for LLM applications

License

MIT

Metadata

Release files for llama-index-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)

Source distribution for llama-index-tools-nory-x402 0.1.0
File Size Uploaded
llama_index_tools_nory_x402-0.1.0.tar.gz 4.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for llama-index-tools-nory-x402 0.1.0
File Interpreter ABI Platform
llama_index_tools_nory_x402-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.8 kB

Release files / llama_index_tools_nory_x402-0.1.0.tar.gz

Download URL llama_index_tools_nory_x402-0.1.0.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
92e64fc3d0bad2e3bab4539290746903e7d20b3c42474e07abd622b47a66f654
BLAKE2b-256 checksum
How to use checksums
efaa0c0eefcfbe70d0d941e222f42b04727ef834f0859b4e2246f60bff575606
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.3

Release files / llama_index_tools_nory_x402-0.1.0-py3-none-any.whl

Download URL llama_index_tools_nory_x402-0.1.0-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c5f6d2d1cd67e6142c25c26ede39d8d18f6c700dc8faabba9888d20b27f3793a
BLAKE2b-256 checksum
How to use checksums
64be1937b4a87213c3355598a7f96fd84987421f5678bcfb8a466cc67a33846b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.3

Release history Release notifications | RSS feed

This release

0.1.0 This release

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