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 returns402 Payment Required.
Full flag matrix and example output: FEATURES.md.
Install
pip install bankofai-x402-cli
x402-tools --help
Or from source:
cd python/x402-cli
pip install -e .
x402-tools --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-decimal 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 python/x402-cli
pip install -e .[dev]
pytest
python -m bankofai.x402_tools.cli server --help
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bankofai_x402_cli-0.1.0b5.tar.gz.
File metadata
- Download URL: bankofai_x402_cli-0.1.0b5.tar.gz
- Upload date:
- Size: 27.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
10998824ff6f88631127f77368f2c8b1b2e13e1e05308d87bed8d7dc556625e6
|
|
| MD5 |
e9d10f789b659c5f959b5b0e45d61870
|
|
| BLAKE2b-256 |
4ffacde183e390558100955d1356de9c9b8429291f7759c46453f305b8a7a8b4
|
File details
Details for the file bankofai_x402_cli-0.1.0b5-py3-none-any.whl.
File metadata
- Download URL: bankofai_x402_cli-0.1.0b5-py3-none-any.whl
- Upload date:
- Size: 15.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b5e5df0fe023f229603e42c0315460f5001e3bf78f673c02fe1a5150864cfae
|
|
| MD5 |
302eef99acbedb613ec0a4e10923980c
|
|
| BLAKE2b-256 |
5a26324d6590d2347df5e3cb17135cfe6a210b5ec1b3a9d97f6d5a558310abde
|