
Agent to Paid API: Substreams → database → API → x402
<aside> 🚀
One prompt in, one paid endpoint out, with every command checked against official docs.
Build a Substream with agent skills, sink it into your own database, and charge per call with x402 on any supported chain. Worked example: Jupiter Lend (jupiter-lend-substreams).
</aside>
| Item | Detail |
|---|---|
| Steps | 9, from installing skills to publishing |
| Payments | Any chain: whatever your facilitator supports |
| Database | Any host: Railway, your server, or managed |
| Sink | 1 CLI: substreams sink postgres |
| Worked example | Jupiter Lend on Solana (jupiter-lend-substreams) |
<aside> 🤖
AI agents
Grok Bot, Claude Code, Cursor: follow the steps in order and ask a human before any spend or publish.
</aside>
<aside> 🧱
Data builders
Substreams developers who want their package to earn per call instead of sitting in a registry.
</aside>
<aside> 💸
API sellers
Anyone who wants fresh on-chain tables behind a 402 paywall without running an indexer from scratch.
</aside>
Plain-English prompt
│ agent skills
▼
Substreams package (db_out)
│ sink
▼
Postgres / ClickHouse (Railway or your own server)
│ SQL
▼
Hono API (read-only)
│ 402 then pay
▼
x402 paywall (USDC on any supported chain)
No single public repo covers this whole path today. StreamingFast's skills cover build, test and sink; the x402 docs cover the paywall. This guide joins them, with lessons from running the Jupiter Lend API on Railway.
| Resource | Build | Test | Sink | API | x402 |
|---|---|---|---|---|---|
| substreams-skills | ✅ | ✅ | ✅ | — | — |
| Graph docs skills page | Setup | — | — | — | — |
| StreamingFast AI indexer blog | ✅ | Basic | — | — | — |
| SQL sink migration guide | — | — | ✅ | — | — |
| x402 seller quickstart | — | — | — | ✅ | ✅ |
| This guide | ✅ | ✅ | ✅ | ✅ | ✅ |
| Item | Details |
|---|---|
| CLI | The substreams CLI, a recent version that includes substreams sink postgres |
| Data key | A Substreams API key (StreamingFast / The Graph Market, or Pinax) in SUBSTREAMS_API_TOKEN or SUBSTREAMS_API_KEY, or a .substreams.env file |
| Build tools | Rust with the wasm32-unknown-unknown target, and buf for protobuf |
| API | Node.js 20+ for Hono and the @x402/* packages |
| Hosting | Railway or your own server (Docker on a box or VPS); plan for disk, see step 4 |
| Wallets | A receiving address on each chain you accept (EVM, Solana or another network your facilitator supports); public addresses only |
| Agent | Grok Bot, Claude Code, Cursor or VS Code 1.107+ |
<aside> 🔐
Secrets rule: Never paste API keys, database URLs, wallet keys or salts into chat, logs, READMEs or the Page. Keep them in Railway variables or a local env file that is git-ignored.
</aside>
Goal: give your agent the Substreams skills before it writes any code.
Claude Code: run the two commands below, then check with /skills.
claude plugin marketplace add streamingfast/substreams-skills
claude plugin install substreams-dev@streamingfast-substreams
Load without installing: clone the repo, then point Claude Code at it.
git clone https://github.com/streamingfast/substreams-skills.git
claude --plugin-dir ./substreams-skills