Skip to main content

x402-cli — one-shot BankofAI x402 CLI: serve a 402 payment endpoint, or pay one as a client.

Project description

x402-cli (Python)

One-shot BankofAI x402 CLI built on top of the bankofai-x402 SDK. Two commands:

  • serve — start a local x402 payment server (advertises payment terms, accepts a signed payload, settles).
  • pay <url> — pay an x402-protected URL when the server returns 402 Payment Required.

Full flag matrix and example output: FEATURES.md.

Install

pip install bankofai-x402-cli
x402-cli --help

Or from source:

cd x402-cli
pip install -e .
x402-cli --help

Quick start

# Start a server that charges 1.25 USDT on TRON Nile
x402-cli serve --pay-to TJWdoJk8KyrfxZ2iDUqz7fwpXaMkNqPehx \
  --rawAmount 1.25 --network tron:nile

# In another shell — pay it
x402-cli pay http://127.0.0.1:4020/pay \
  --max-rawAmount 1.25 --network tron:nile --token USDT

Design

Unlike the TypeScript version which implements its own HTTP server and facilitator client, the Python CLI directly uses the SDK's X402Server and FacilitatorClient from bankofai-x402:

from bankofai.x402.server import X402Server
from bankofai.x402.facilitator import FacilitatorClient

server = X402Server()  # No duplication
facilitator = FacilitatorClient(base_url)  # SDK provided

This avoids code duplication and keeps the CLI thin (just argument parsing + output formatting).

Environment variables

Var Purpose
TRON_PRIVATE_KEY TRON wallet key for --wallet env
EVM_PRIVATE_KEY EVM wallet key for --wallet env
TRON_GRID_API_KEY Optional, forwarded to SDK for TronGrid

Development

cd x402-cli
pip install -e .[dev]
pytest
python -m bankofai.x402_tools.cli server --help

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bankofai_x402_cli-0.1.0b8.tar.gz (28.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bankofai_x402_cli-0.1.0b8-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

Details for the file bankofai_x402_cli-0.1.0b8.tar.gz.

File metadata

  • Download URL: bankofai_x402_cli-0.1.0b8.tar.gz
  • Upload date:
  • Size: 28.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for bankofai_x402_cli-0.1.0b8.tar.gz
Algorithm Hash digest
SHA256 7f1d200c3be2cc6695edaafa07bac56c2c0d7472d86a8111b8a32f2564c000a8
MD5 908f117205fed0af537e7de1dc588992
BLAKE2b-256 deb23e3b1107bdb05d53ad47c1cda5a6b6b65f4db72e3fa6e230d949e4d707b3

See more details on using hashes here.

File details

Details for the file bankofai_x402_cli-0.1.0b8-py3-none-any.whl.

File metadata

File hashes

Hashes for bankofai_x402_cli-0.1.0b8-py3-none-any.whl
Algorithm Hash digest
SHA256 56831c0e21653e02089ea17752666a9e4d2df088604e29984844081ac0b8cf97
MD5 25f37dc206d3a366f7fee296aadb1045
BLAKE2b-256 58207bd7c25cf65e1866c109c4b3c59d12950a9c8a1021e37930c4f82cf92769

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page