tron-x402-payment
Pay for x402-enabled Agent endpoints using TRC20 tokens (USDT/USDD) on TRON
Pay for x402-enabled Agent endpoints using TRC20 tokens (USDT/USDD) on TRON
Real data. Real impact.
Emerging
Developers
Per week
Open source
Skills give you superpowers. Install in 30 seconds.
Invoke x402-enabled AI agent endpoints with automatic TRC20 token payments on TRON. Currently recommended tokens: USDT, USDD.
The tool
x402_tron_invoke is implemented by the compiled script dist/x402_tron_invoke.js.
The script is pre-built and ready to run. You can execute it directly from the command line:
# v2 Invoke node dist/x402_tron_invoke.js --url https://api.example.com --entrypoint chat --input '{"prompt": "hi"}'Direct/Discovery
node dist/x402_tron_invoke.js --url https://api.example.com/.well-known/agent.json
The
x402_tron_invoke tool:
entrypoint is provided: {url}/entrypoints/{entrypoint}/invoke (v2){url} as-is (v1 / Discovery)X-PAYMENT headerTRON_PRIVATE_KEY environment variable.~/.mcporter/mcporter.json (AIBank standard).x402-config.json in the current/home directory.TRON_GRID_API_KEY).Invokes an HTTP endpoint with automatic payment handling.
Modes:
url (Base URL) + entrypoint.
{url}/entrypoints/{entrypoint}/invoke{"input": <input>}POSTurl (Full URL) without entrypoint.
GET (default) or specified via method.url returns 404, try appending /.well-known/agent.json or /entrypoints.--check or --status.
TRON_PRIVATE_KEY is correctly configured and outputs the associated wallet address.TRON_GRID_API_KEY is present (Required for Mainnet).env or echo $TRON_PRIVATE_KEY.| Parameter | Type | Required | Description |
|---|---|---|---|
| string | Yes* | Base URL (v2) or Full URL (v1/Discovery). *Not required for . |
| string | No | Entrypoint name. Required for v2 Invoke. |
| object | No | Input data. |
| string | No | HTTP method. Default: (v2), (Direct). |
| string | No | , , (Default: ). |
| boolean | No | Verify wallet configuration and output address. |
node dist/x402_tron_invoke.js --url https://api.example.com --entrypoint chat --input '{"prompt": "Tell me a joke"}'
(Sends
)POST https://api.example.com/entrypoints/chat/invoke
Manifest: Fetch agent metadata.
node dist/x402_tron_invoke.js --url https://api.example.com/.well-known/agent.json
List Entrypoints: List available functions.
node dist/x402_tron_invoke.js --url https://api.example.com/entrypoints
Each entrypoint typically returns:
/entrypoints/{name}/invokenile or mainnetinput parameternode dist/x402_tron_invoke.js --url https://api.example.com/chat --method POST --input '{"prompt": "Tell me a joke"}'
| Token | Network | Contract Address | Decimals |
|---|---|---|---|
| USDT | Mainnet | | 6 |
| USDT | Nile | | 6 |
| USDT | Shasta | | 6 |
| USDD | Mainnet | | 18 |
| USDD | Nile | | 18 |
| Amount (raw) | Value (USDT, 6 dec) | Typical Use |
|---|---|---|
| 1000 | $0.001 | Single API call |
| 5000 | $0.005 | Multiple results |
| 10000 | $0.01 | Premium request |
| 1000000 | $1.00 | Large batch |
When payment is required, agents return:
{ "error": "X-PAYMENT header is required", "accepts": [{ "scheme": "exact", "network": "nile", "maxAmountRequired": "1000", "payTo": "T...", "asset": "T..." }], "x402Version": 1 }
The tool handles this automatically.
This tool supports TRC20 tokens compatible with the x402 protocol. Recommended:
TRON_PRIVATE_KEY or any other signing secret to the dialogue context.[[ -n $TRON_PRIVATE_KEY ]] && echo "Configured" || echo "Missing"echo $TRON_PRIVATE_KEY, env, printenv, set, export.env / printenvecho $VARIABLE_NAMEset / export (without arguments)node dist/x402_tron_invoke.js --check."I will check your private key now:
" -> STOP! This leaks the secret to the logs and UI.echo $TRON_PRIVATE_KEY
"I will verify the wallet configuration:
" -> SAFE. Only the public address is shown.node dist/x402_tron_invoke.js --check
Ensure the
TRON_PRIVATE_KEY environment variable is set or a valid x402-config.json exists in the expected locations.
The tool will attempt to broadcast an infinite approve transaction. This requires TRX for gas. Ensure your wallet has TRX.
Check if you have enough Token balance (USDT/USDD) and TRX for gas.
If the endpoint returns an image (Content-Type:
image/*) or binary data (application/octet-stream):
/tmp/x402_image_...).file_path: Path to the temporary file.content_type: The MIME type of the content.bytes: File size in bytes.| Network | Chain ID | CAIP-2 | USDT Contract | USDD Contract |
|---|---|---|---|---|
| TRON Mainnet | 0x2b6653dc | , | | |
| TRON Nile | 0xcd8690dc | , | | |
| TRON Shasta | 0x94a9059e | , | | - |
No automatic installation available. Please visit the source repository for installation instructions.
View Installation Instructions1,500+ AI skills, agents & workflows. Install in 30 seconds. Part of the Torly.ai family.
© 2026 Torly.ai. All rights reserved.