Skip to main content

Proxy Mode (Simplest)

Use your HTTPayer API key for account-based payments.
from httpayer import HTTPayerClient

# Initialize with API key from environment
client = HTTPayerClient()

# Make a request - automatically handles 402 payments
response = client.request("GET", "https://api.example.com/protected")

print(response.status_code)  # 200
print(response.json())       # API data

Relay Mode (Self-Custodial)

Use your own wallet for self-custodial payments.

EVM Wallet

import os
from httpayer import HTTPayerClient

client = HTTPayerClient(
    private_key=os.getenv("EVM_PRIVATE_KEY"),
    network="base"
)

response = client.request("GET", "https://api.example.com/protected")
print(response.json())

Solana Wallet

import os
from httpayer import HTTPayerClient

client = HTTPayerClient(
    private_key=os.getenv("SOLANA_PRIVATE_KEY"),
    network="solana-mainnet-beta"
)

response = client.request("GET", "https://api.example.com/protected")
print(response.json())

Simulate Before Paying

Preview payment costs without executing:
# Dry-run simulation
sim = client.request("GET", "https://api.example.com/protected", simulate=True)
print(sim.json())  # Shows payment requirements

# Execute actual payment
response = client.request("GET", "https://api.example.com/protected")
print(response.json())  # Actual data

Next Steps