Skip to content

Commit 866c19f

Browse files
committed
fix
1 parent 40897c6 commit 866c19f

8 files changed

Lines changed: 214 additions & 106 deletions

File tree

docs/x402/api-catalog/get-started.md

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
11
---
22
title: Get Started
33
sidebar_label: Get Started
4-
description: Plug your Agent into the API Catalog in 3 minutes — install the Agent Wallet, then one MCP install to discover and call every service in the catalog.
4+
description: Plug your Agent into the API Catalog in 3 minutes — install the Agent Wallet, then install the x402 CLI to discover and call every service in the catalog.
55
---
66

7-
import Tabs from '@theme/Tabs';
8-
import TabItem from '@theme/TabItem';
9-
107
# Get Started
118

12-
Two steps and under 3 minutes to plug your Agent into the whole catalog: install the wallet, then do one MCP install. After that, your Agent can discover and call any service in the catalog by name, paying per call on-chain.
9+
Two steps and under 3 minutes to plug your Agent into the whole catalog: install the wallet, then install the x402 CLI. After that, your Agent can discover and call any service in the catalog, paying per call on-chain.
1310

14-
**Prerequisite**: an MCP-compatible Agent (Claude Code, OpenAI Codex, Cursor, Continue, etc.).
11+
**Prerequisite**: Node.js (for the wallet) and Python with `pip` (for the CLI).
1512

1613
## Step 1: Install the Agent Wallet
1714

1815
Run the command below to install a local wallet that manages stablecoins on TRON & BNB Chain. Every paid call your Agent makes from now on is signed locally by this wallet.
1916

2017
```bash
2118
npm i @bankofai/agent-wallet
19+
agent-wallet --help
2220
```
2321

2422
:::tip No wallet yet?
@@ -29,54 +27,58 @@ Follow the [Agent Wallet Quick Start](../../Agent-Wallet/QuickStart.md) to creat
2927
Keep only a small amount of stablecoins in the wallet for per-call payments. Never store your main assets in an Agent wallet.
3028
:::
3129

32-
## Step 2: Connect the Catalog to your Agent
33-
34-
One MCP install and your Agent immediately sees every service in the catalog and can call them by name — no accounts, no API keys to manage.
30+
## Step 2: Install the x402 CLI
3531

36-
<Tabs>
37-
<TabItem value="claude" label="Claude Code" default>
32+
One install connects your Agent to the catalog — it discovers and calls every service over x402, paying per call. No accounts, no API keys to manage.
3833

3934
```bash
40-
claude mcp add bankofai -s user -- npx @bankofai/mcp-catalog
35+
pip install bankofai-x402-cli
36+
x402-cli --version
4137
```
4238

43-
</TabItem>
44-
<TabItem value="other" label="Other MCP Agents">
45-
46-
Also works with OpenAI Codex, Cursor, Continue, and any MCP-compatible Agent: add a server named `bankofai` to its MCP configuration, with the startup command:
39+
Once installed, your Agent can discover and call services through the CLI. Search by name or keyword to see what's in the catalog:
4740

4841
```bash
49-
npx @bankofai/mcp-catalog
42+
x402-cli catalog search <keyword> --catalog https://catalog.bankofai.io/api/catalog.json --json
5043
```
5144

52-
</TabItem>
53-
</Tabs>
54-
55-
Once installed, just tell your Agent what you want in plain language — for example, "find a weather API and look up the current weather in Shanghai." The Agent finds the service in the catalog, gets a quote, pays on-chain with the wallet, and brings back the result — discovery, payment, and the call all happen automatically.
56-
57-
## Calling from the command line (optional)
58-
59-
If you prefer the terminal, `x402-cli` offers the same capabilities: search, inspect, and make paid calls directly.
60-
61-
Search by name or keyword to see what's in the catalog:
45+
Inspect a service's details and available endpoints:
6246

6347
```bash
64-
x402-cli catalog search weather --catalog https://catalog.bankofai.io/api/catalog.json --json
48+
x402-cli catalog show <fqn> --catalog https://catalog.bankofai.io/api/catalog.json --json
49+
x402-cli catalog endpoints <fqn> --catalog https://catalog.bankofai.io/api/catalog.json --json
6550
```
6651

67-
Inspect a service's details and available endpoints:
52+
Then make a paid call against the target endpoint — quote, payment, and result retrieval in one step. A simple GET endpoint needs nothing more than the URL:
6853

6954
```bash
70-
x402-cli catalog show acme-weather --catalog https://catalog.bankofai.io/api/catalog.json --json
71-
x402-cli catalog endpoints acme-weather --catalog https://catalog.bankofai.io/api/catalog.json --json
55+
x402-cli pay 'https://gateway.bankofai.io/providers/<fqn>/...'
7256
```
7357

74-
Then make a paid call against the target endpoint — quote, payment, and result retrieval in one step:
58+
For a POST endpoint, or to pin the payment chain, token, and scheme, pass them explicitly:
7559

7660
```bash
77-
x402-cli pay 'https://gateway.bankofai.io/providers/acme-weather/v1/current?city=Shanghai'
61+
x402-cli pay 'https://gateway.bankofai.io/providers/<fqn>/<path>' \
62+
--method POST \
63+
--network tron:mainnet \
64+
--token USDT \
65+
--scheme exact_gasfree \
66+
--max-amount 0.001 \
67+
--header 'Content-Type: application/json' \
68+
--body '{ ... }'
7869
```
7970

71+
| Flag | Purpose |
72+
|---|---|
73+
| `--method` | HTTP method (defaults to `GET`) |
74+
| `--network` | CAIP-2 payment chain, e.g. `tron:mainnet`, `eip155:56` |
75+
| `--token` | Settlement token, e.g. `USDT` |
76+
| `--scheme` | Payment scheme — `exact_gasfree` (TRON) or `exact_permit` (EVM) |
77+
| `--max-amount` | Spend ceiling in USD; the call aborts if the quote exceeds it |
78+
| `--header` / `--body` | Request headers and body for the upstream call |
79+
80+
A service that settles on multiple chains exposes one route per network (`x402Routes`); pick the route — and the matching `--network` / `--scheme` — for the chain you want to pay on.
81+
8082
:::tip
8183
`--catalog` can point to the hosted URL above or to a locally built `dist/catalog.json` for offline debugging.
8284
:::

docs/x402/api-catalog/index.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,22 @@ Three consumers share the same data:
4141

4242
## What's in the catalog
4343

44-
The catalog spans AI models, data, compute, web tools, messaging, DeFi, and more. Typical live services:
45-
46-
| Service | Category | What it does | Billing |
47-
|---|---|---|---|
48-
| LLM Aggregator | AI | OpenAI-compatible API across frontier models from Anthropic, OpenAI, Google, DeepSeek, and more | per token |
49-
| SunPump · Create Token | DeFi | Launch a Meme token on SunPump — name, symbol, description, image | per launch (stay tuned) |
50-
| SUN Swap | DeFi | Swap, liquidity, and farming on TRON via the SUN protocol | per call |
51-
| Wolfram\|Alpha | Compute | Computational engine for math, science, and factual queries | per call |
52-
| ScreenshotOne | Web Tools | Capture any webpage as a high-quality image | per shot |
53-
| Textbelt SMS | Messaging | Send SMS to any phone number, no A2P registration | per message |
54-
| 2Captcha | Web Tools | Solve image, reCAPTCHA, and hCaptcha challenges programmatically | per solve |
44+
The first live services cover token creation plus DeFi market data and on-chain security — all settling across TRON and BNB Chain, with more being added over time:
45+
46+
| Service | What it does | Billing |
47+
|---|---|---|
48+
| SunPump Agent Token Launch | Pay with x402, then submit token-launch metadata (name, symbol, description, image) to SunPump — the gateway forwards your request after settlement | From $0.001 / call |
49+
| DefiLlama Token Price | Current and historical USD price for one or many tokens, price charts, and percent change | Free |
50+
| DefiLlama DeFi Data | Protocol TVL, fees/revenue, and stablecoin metrics for research and risk screening | Free |
51+
| DefiLlama Yields / APY | List and compare DeFi pool yields (APY/TVL), plus a pool's historical series | Free |
52+
| DexScreener DEX Data | Token DEX pairs, price and liquidity; token search; latest new-listing profiles | Free |
53+
| DIA Token Price | Real-time, multi-source aggregated USD price by symbol or by chain + contract address | Free |
54+
| GoPlus Token & Address Security | Honeypot/scam checks, malicious-address screening, and risky-approval detection | Free |
55+
56+
All of the above are in the **Finance** category and available on both TRON and BNB Chain.
5557

5658
:::note
57-
The live service list and statistics (service count, chain count, etc.) are **generated dynamically** from catalog data — treat `/api/catalog.json` as the source of truth; this page hard-codes no numbers.
59+
The live service list and statistics (service count, chain count, etc.) are **generated dynamically** from catalog data — treat `/api/catalog.json` as the source of truth; this page hard-codes no numbers, and the catalog grows as new services are listed.
5860
:::
5961

6062
## Next steps

docs/x402/api-catalog/list-your-service.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,10 @@ CI enforces the following rules — go through them before submitting:
147147
- `version` must be `1`.
148148
- `fqn` is lowercase letters/digits/hyphens and must match the directory name.
149149
- `category` must be one of the allowed values (see [reference](./reference.md#allowed-categories)).
150-
- `chains` needs at least one entry, using CAIP-2 style chain IDs (e.g. `tron:mainnet`, `eip155:56`).
150+
- `chains` needs at least one entry, using CAIP-2 style chain IDs — mainnets or testnets (e.g. `tron:mainnet`, `tron:nile`, `eip155:56`, `eip155:97`).
151151
- `isFirstParty`, `isFeatured` (booleans) and `featuredTags` (string array, may be empty `[]`) are **required** — missing any of them fails validation.
152152
- For every endpoint: `method` must be uppercase, `path` must start with `/`, and `maxPriceUsd` must not be less than `minPriceUsd`.
153+
- _(Optional)_ An endpoint that settles across multiple chains can add `x402Routes` — one entry per network (`network`, `provider`, `scheme`, `url`). See the [reference](./reference.md#x402routes--multi-network-routing).
153154
- The service and every endpoint must provide `i18n.zh-CN` translations for `title`, `subtitle`, `description`, and `useCase`.
154155
- `pay.md` must be submitted together with `catalog.json`; both files are scanned for sensitive data.
155156
- No keys, private keys, or private network addresses anywhere.

docs/x402/api-catalog/reference.md

Lines changed: 56 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,35 @@ Each service is described in `providers/<fqn>/catalog.json`. Top-level fields:
5050
| `metered` | boolean | Yes | Metered billing or not |
5151
| `minPriceUsd` | number | Yes | Minimum price (USD) |
5252
| `maxPriceUsd` | number | Yes | Maximum price (USD), must not be less than `minPriceUsd` |
53+
| `x402Routes` | object[] | No | Per-network payment routes (see below) |
54+
55+
### x402Routes — multi-network routing
56+
57+
An endpoint may serve the same capability across several chains, each settling through its own gateway provider and payment scheme. List those alternatives in `x402Routes`; each route describes one network:
58+
59+
| Field | Type | Description |
60+
|---|---|---|
61+
| `network` | string | CAIP-2 chain ID this route settles on (e.g. `tron:mainnet`, `eip155:56`) |
62+
| `provider` | string | The gateway provider `fqn` that handles this network |
63+
| `scheme` | string | Payment scheme — `exact_gasfree` (TRON) or `exact_permit` (EVM) |
64+
| `url` | string | Full gateway URL for this network's route |
65+
66+
The build passes this through to outputs as `x402_routes`. When present, callers/agents pick the route matching their intended payment chain; the top-level `url` remains the default route.
67+
68+
For example, a token-launch endpoint might expose four routes — TRON Nile, TRON Mainnet, BSC Testnet, BSC Mainnet — each with its own `provider` and `scheme`. To call one, point `x402-cli pay` at the chosen route's `url` and pass the matching `--network` / `--scheme`:
69+
70+
```bash
71+
x402-cli pay 'https://gateway.bankofai.io/providers/<provider>/<path>' \
72+
--method POST \
73+
--network tron:mainnet \
74+
--token USDT \
75+
--scheme exact_gasfree \
76+
--max-amount 0.001 \
77+
--header 'Content-Type: application/json' \
78+
--body '{ ... }'
79+
```
80+
81+
The other routes reuse the same request body, swapping only the route `url`, `--network`, and `--scheme` (TRON routes use `exact_gasfree`; EVM routes use `exact_permit`).
5382

5483
### status block
5584

@@ -76,12 +105,17 @@ security shopping storage translation
76105

77106
## Chain IDs
78107

79-
`chains` uses CAIP-2 style chain identifiers:
108+
`chains` uses CAIP-2 style chain identifiers. Mainnets and testnets are both recognized:
80109

81110
| Chain | ID |
82111
|---|---|
83112
| TRON mainnet | `tron:mainnet` |
113+
| TRON Nile testnet | `tron:nile` |
114+
| TRON Shasta testnet | `tron:shasta` |
84115
| BNB Chain (BSC) | `eip155:56` |
116+
| BNB Smart Chain testnet | `eip155:97` |
117+
118+
The build resolves each chain ID into display metadata (`kind` / `label` / `label_zh`) so the frontend doesn't have to parse CAIP-2 itself — see [Frontend display fields](#frontend-display-fields).
85119

86120
## Validation and secret scanning
87121

@@ -120,10 +154,10 @@ Besides the `providers` array, the list endpoint carries dynamic stats — front
120154
| `chain_count` | Chains covered |
121155
| `generated_at` | Build time (UTC) |
122156
| `frontend.featured_fqns` | `fqn` list of featured services |
123-
| `frontend.categories` | Categories and counts |
124-
| `frontend.chains` | Chains and counts |
157+
| `frontend.categories` | Categories in use — each `{ id, label, label_zh, count }` |
158+
| `frontend.chains` | Chains in use — each `{ id, kind, label, label_zh, count }` |
125159

126-
The `providers` array is pre-sorted at build time by **featured first → category → fqn**; frontends can render it as-is.
160+
The `providers` array is pre-sorted at build time by **featured first → category → fqn**; frontends can render it as-is. Use `frontend.categories` / `frontend.chains` to drive filter UIs — including their `label` / `label_zh` display names — rather than hard-coding category or chain lists.
127161

128162
### Derived fields
129163

@@ -137,11 +171,26 @@ Build outputs add derived fields on top of the raw data and convert everything t
137171
| `min_price_usd` / `max_price_usd` | The service's price range across all endpoints |
138172
| `sha` | Content hash of `catalog.json` + `pay.md`, for change detection |
139173

174+
### Frontend display fields
175+
176+
To save the frontend from parsing raw IDs and picking translations, the build also emits ready-to-render fields on each provider summary and detail:
177+
178+
| Field | Description |
179+
|---|---|
180+
| `title_zh` | Chinese service name (falls back to `title`) — usable directly as the first header line |
181+
| `main_title` | Primary title (equals `title`) — second header line |
182+
| `sub_title` | Subtitle — third header line |
183+
| `category_meta` | `{ id, label, label_zh }` for the category |
184+
| `chain_kinds` | De-duplicated friendly chain kinds, e.g. `["tron"]`, `["bnb"]` |
185+
| `chains_meta` | Per-chain `{ id, kind, label, label_zh }`, so the frontend never parses CAIP-2 |
186+
187+
These are additive — the raw `title`, `subtitle`, `category`, `chains`, and `i18n.zh-CN` are still present. A separate frontend-facing contract (`API.md` in the catalog repo) documents the full response shapes and rendering guidance.
188+
140189
### Other output structures
141190

142-
- **`/api/pay/<fqn>.json`**: payment summary for Agents / CLI. Top level: `version`, `fqn`, `title`, `subtitle`, `description`, `use_case`, `i18n`, `service_url`, `chains`, `sha`; `endpoints[]` keeps only call-relevant fields: `method`, `path`, `url`, `description`, `metered`, `min_price_usd`, `max_price_usd`.
143-
- **`/api/search-index.json`**: `{ version, generated_at, documents[] }`, each document being a service summary plus each endpoint's `method` / `path` / `title` / `description`.
144-
- **`/api/categories.json`**: array of categories in use, each `{ id, count }`.
191+
- **`/api/pay/<fqn>.json`**: payment summary for Agents / CLI. Top level includes `version`, `fqn`, `title`, `title_zh`, `main_title`, `sub_title`, `subtitle`, `description`, `use_case`, `i18n`, `service_url`, `chains`, `chain_kinds`, `chains_meta`, `sha`; `endpoints[]` keeps the call-relevant fields `method`, `path`, `url`, `description`, `metered`, `min_price_usd`, `max_price_usd`, plus `x402_routes` when the endpoint defines multi-network routes.
192+
- **`/api/search-index.json`**: `{ version, generated_at, documents[] }`, each document being a service summary (with `category_meta` / `chain_kinds` / `chains_meta`) plus each endpoint's `method` / `path` / `title` / `description` (and `x402_routes` when present).
193+
- **`/api/categories.json`**: array of categories in use, each `{ id, label, label_zh, count }` — a direct export of `frontend.categories`.
145194
- **`/api/status.json`**: `{ version, generated_at, provider_count, status }`; `status` of `ok` means the build is healthy.
146195

147196
## Local build and run

0 commit comments

Comments
 (0)