Pay for APIs, unlock content, and settle x402 micropayments right inside VS Code.
vscode-x402 is an early-stage JavaScript project in the AI payments / x402 ecosystem, focused on crypto, cryptocurrency, http-402, micropayments. It currently has 5 GitHub stars and 0 forks, and sits alongside related tools like x402-payments-mcp, x402charity, x402-dart.
Browse an x402 bazaar, decode
402 Payment Requiredchallenges, and pay-per-call paid APIs and MCP tools with USDC — without leaving your editor.
Install:
code --install-extension threews.vscode-x402 · VS Code Marketplace · Open VSX (Cursor / VSCodium / Windsurf)
.env you'll commit), and a per-call spending cap means an agent loop can't drain you.scaffold a working paid endpoint of your own in one command.x402 is a payment protocol for developers and agents. A server answers a
request with 402 Payment Required and a machine-readable challenge; the caller
signs a USDC authorization and retries the same request with proof of payment;
the server does the work and returns a settlement receipt. No accounts, no API
keys, no subscriptions — just per-call settlement on-chain.
This extension brings that whole loop into VS Code, where the people wiring up and calling paid endpoints actually work. Paste a URL and see what it costs. Click Pay & call and get the response plus the on-chain receipt inline. Browse a marketplace of paid APIs and MCP tools in the sidebar. Scaffold your own paid endpoint in one command.
It has no dependency on any specific provider. Point it at any compliant x402 endpoint, or at any bazaar that serves the discovery API. Discovery is optional — inspecting and paying a single endpoint URL needs zero configuration.
payTo
address, with the one requirement your wallet can satisfy flagged. Read-only,
no signing, no configuration.settings.json and never on disk in plaintext. A
status-bar item shows the derived address.From the Marketplace — open the Extensions view (Ctrl/Cmd +
Shift + X), search for x402, and install
threews.vscode-x402. Or run from the Command Palette:
ext install threews.vscode-x402
From a .vsix — download a release .vsix (or build one with
npx @vscode/vsce package) and install it:
code --install-extension vscode-x402-0.1.0.vsix
Or in the editor: Extensions view → … menu → Install from VSIX….
After install, the x402 Bazaar icon appears in the activity bar.
Every command is available from the Command Palette (Ctrl/Cmd +
Shift + P), prefixed with x402:. Bazaar-scoped commands
also appear as icons on the sidebar title bar and in the service context menu.
| Command Title | Command ID | What it does |
|---|---|---|
| x402: Inspect Endpoint (decode 402 challenge) | x402.inspect |
Prompts for a URL, does an unpaid request, and writes the decoded 402 challenge (networks, assets, prices in USD, payTo) to the x402 output channel. No wallet, no host, no signing. |
| x402: Pay & Call Endpoint | x402.pay |
Prompts for a URL (or acts on the selected bazaar service) and opens the service detail panel where you set the method/body and pay. |
| x402: Open Service Details | x402.openService |
Opens the detail webview for a bazaar service. Fired automatically when you click a service in the sidebar. |
| x402: Scaffold a Paid Endpoint | x402.scaffoldEndpoint |
Generates api/x402/<slug>.js in the open workspace — a standalone Node handler that returns a 402 challenge and runs your work only after payment verifies. |
| x402: Set Wallet Key | x402.setWalletKey |
Prompts for an EVM private key (0x + 64 hex), validates that it derives an address, and stores it in the OS keychain (SecretStorage). |
| x402: Clear Wallet Key | x402.clearWalletKey |
Deletes the stored wallet key from SecretStorage. |
| x402: Set Bazaar Discovery Host | x402.setBazaarUrl |
Prompts for the origin that serves the bazaar discovery API and saves it to x402.bazaarUrl. Leave blank to disable discovery. |
| x402: Refresh Bazaar | x402.refresh |
Re-fetches the service list from the configured bazaar host. |
| x402: Search Bazaar | x402.search |
Prompts for keywords and full-text searches the bazaar (empty query lists everything). |
| x402: Set Bazaar Filters | x402.setFilters |
Sets the default bazaar filters — type (http / mcp), max price (USDC atomics), and tag — and refreshes. |
Configure these under Settings → Extensions → x402, or edit settings.json
directly. Every payment-related setting works whether or not a bazaar host is
configured.
| Setting | Type | Default | Description |
|---|---|---|---|
x402.bazaarUrl |
string |
"" |
Origin that hosts the bazaar discovery API (serves /api/bazaar/list and /api/bazaar/search). Optional — leave blank to disable discovery. Inspecting or paying a specific endpoint URL needs no host. |
x402.maxPaymentUsd |
number |
0.1 |
Spending cap per request, in USD. Any payment above this is refused before signing (you're prompted to raise the cap for that call). |
x402.confirmEachPayment |
boolean |
true |
Show a modal confirmation with the exact USD amount before signing each payment. |
x402.network |
string |
"eip155:8453" |
Preferred CAIP-2 network when an endpoint accepts several. Default is Base mainnet. |
x402.filters |
object |
{ "type": "http" } |
Default bazaar filters. Supported keys: type (http / mcp), network, maxPrice (USDC atomics), asset, extension, tag, sort. |
No bazaar, no wallet, no account — this is read-only.
https://your-api.example.com/x402/summarize.← payable by this wallet flagging the one your configured network/asset can
satisfy. If nothing is payable (e.g. a Solana-only service), it says so.0x + 64 hex). It is stored in the OS keychain — see Security.
The status bar shows the derived address.GET/POST) and, for POST or MCP calls, edit the JSON
request body. Click Pay & call.x402.confirmEachPayment). If the price is above x402.maxPaymentUsd, you're
asked to Raise cap & pay instead.X-PAYMENT proof, and renders the response body plus the settlement receipt
(status, amount paid, paying address, and transaction hash) in the panel./api/bazaar/list and /api/bazaar/search (this writes x402.bazaarUrl).summarize), a price per call in USD (e.g. 0.01), and a
description shown in the 402 challenge.api/x402/<slug>.js and opens it. It's a standalone Node
handler: an unpaid request gets a 402 challenge; once an X-PAYMENT header
verifies through your facilitator, run() executes.X402_RESOURCE_URL, X402_PAY_TO, and X402_FACILITATOR_VERIFY_URL
(env), then replace the run() echo with your real service logic.A full walkthrough of each flow lives in docs/usage.md.
The payment client is vendored and zero-dependency —
src/vendor/x402-fetch.js — so the extension pulls
in no payment SDK at runtime. It:
402, that
response is returned as-is (free endpoints just work).x402.network) and a USDC EIP-3009 asset your EVM key can sign.transferWithAuthorization (EIP-3009 / EIP-712) and
retries the request with the X-PAYMENT header.x-payment-response header.The secp256k1 / keccak256 / EIP-712 stack is pure JavaScript and depends only on
Web Crypto (crypto.subtle), present in Node ≥ 18 and modern browsers.
Solana-only services appear in the bazaar but are flagged as not payable by this
EVM signer.
settings.json, never logged, never persisted to disk in
plaintext. Run x402: Clear Wallet Key to remove it.x402.maxPaymentUsd (default $0.10) is checked before
signing; anything above it requires explicit consent for that call.x402.confirmEachPayment on (default), a
modal shows the exact amount and paying address before any signature.^1.85.0 or newer.fetch
and Web Crypto). The extension itself bundles everything it needs."No bazaar discovery host is set."
You opened the sidebar without configuring x402.bazaarUrl. That's expected —
the extension ships pointing nowhere. Run x402: Set Bazaar Discovery Host, or
skip it entirely and use Inspect / Pay & Call with a bare URL.
"This endpoint requires payment but offers no requirement this wallet can satisfy." The 402 challenge has no USDC EIP-3009 accept on an EVM network this signer supports (often a Solana-only service). The EVM signer can't pay it; use a wallet and network the endpoint accepts.
"Expected a 0x-prefixed 32-byte (64 hex char) EVM private key."
The key must be exactly 0x followed by 64 hexadecimal characters. Export it in
that raw hex form, not as a seed phrase or keystore JSON.
A call costs more than my cap.
x402.maxPaymentUsd blocked it. The extension prompts Raise cap & pay for
that single call, or raise the default in settings.
The payment went through but I got a 402 back.
The merchant didn't accept the settlement — usually a price or recipient
mismatch, or the facilitator rejected the proof. Re-inspect the endpoint to
confirm the current price and payTo, and that your wallet has enough USDC.
Where do I get a bazaar host / how do I publish a service to one?
Discovery is an open API contract (/api/bazaar/list, /api/bazaar/search).
Point x402.bazaarUrl at any host that implements it. To publish a paid
service, scaffold an endpoint (above) and register its resource URL with your
bazaar of choice.
Does this lock me into a provider? No. The extension speaks the open x402 protocol against any compliant endpoint or bazaar. The payment client is vendored, with no third-party SDK at runtime.
npm install
npm run build # bundle to dist/extension.js
npm run watch # rebuild on change
Press F5 in VS Code to launch an Extension Development Host with the
extension loaded. See CONTRIBUTING.md for the layout and how
to package a .vsix.
@three-ws/x402-fetch —
the standalone, zero-dependency fetch wrapper this extension vendors.402-based pay-per-call.All rights reserved. See LICENSE.
Give AI agents a wallet — x402 payment tools over Model Context Protocol.
Automatic micro-donations powered by x402. Drop-in Express/Next.js middleware that sends USDC to charities on every user action. npm install x402charity.
Dart implementation of the x402 payment protocol. 🎯
The agent-native LLM router for autonomous agents. 55+ models (8 free), <1ms local routing, USDC payments on Base & Solana via x402.
The AI agent with a wallet — spends USDC autonomously to get real work done. Apache-2.0, TypeScript.
DePIN for Vintage Hardware — Proof-of-Antiquity blockchain where old machines outmine new ones. AI-powered hardware fingerprinting, 15+ CPU architectures, Solana bridge (wRTC). $0 VC.
🚀 Curated list of x402 resources: HTTP 402 Payment Required protocol for blockchain payments, crypto micropayments, AI agents, API monetization. Includes SDKs (TypeScript, Python, Rust), examples, facilitators (Coinbase, Cloudflare), MCP integration, tutorials. Accept USDC payments with one line of code. Perfect for AI agent economy.
Client SDK for the Vybe x402 API. Pay-per-call USDC over HTTP and prepaid-credit WebSocket streaming for Vybe's Solana analytics API. Built for AI agents.
The financial operating system for AI agents. A single HTTP client that intercepts '402 Payment Required', routes across x402, L402, and MPP, persists credentials as recoverable assets, enforces per-envelope budgets, and emits a structured trace.