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.0b6.tar.gz (27.9 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.0b6-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bankofai_x402_cli-0.1.0b6.tar.gz
  • Upload date:
  • Size: 27.9 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.0b6.tar.gz
Algorithm Hash digest
SHA256 aa4ae01d7f895a671936c719065d1a19f11b1d991b3f5a8403128f92dc4a2c09
MD5 6f00d64c960e6353a10efe747b9c948d
BLAKE2b-256 547bf14b5fcd2267b287ddefacb9dc0ba3342aaf4c9eb0ce2b43c5075a3925f9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bankofai_x402_cli-0.1.0b6-py3-none-any.whl
Algorithm Hash digest
SHA256 67fcff731d2450b6f2de282fc1a2024a269d660b5cb39c5cfdc0deb3018aa0af
MD5 ee75504e312a14ecc862d2ca03c5d490
BLAKE2b-256 d275a803da503c18a0dd6ecf211a5ff8601c39c0eb6f062e1fca9cbaac9f3f27

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