Pay-per-call API marketplace powered by x402 payments on the Stacks blockchain. AI agents autonomously discover, pay for, and consume APIs using HTTP 402 — no API keys, no subscriptions, just HTTP and STX.
x402-conduit is an early-stage JavaScript project in the AI payments / x402 ecosystem. It currently has 5 GitHub stars and 3 forks.
Pay-per-call API marketplace powered by x402 payments on the Stacks blockchain.
AI agents autonomously discover, pay for, and consume APIs using HTTP 402 — no API keys, no subscriptions, just HTTP and STX.
Talent Protocol Update (April 2026): New features added for the hackathon event including on-chain analytics helpers, trust scoring enhancements, and a streamlined event submission flow. See EVENT_SUBMISSION.md for details.
Today's API economy is broken for machines:
Conduit uses the x402 payment protocol to create a marketplace where:
x402-stacks interceptor auto-pays in STX and retriesAgent → GET /api/v1/price?symbol=BTC
Server → 402 Payment Required (0.005 STX)
Agent → Signs STX transfer via x402 interceptor
Server → 200 OK + { price: 97500.00, ... }
┌─────────────────────────────────────────────────────────────┐
│ Conduit Server │
│ │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────────┐ │
│ │ Free Layer │ │ x402 Paywall │ │ API Services │ │
│ │ │ │ │ │ │ │
│ │ /discover │ │ paymentMiddle│ │ Weather │ │
│ │ /stats │ │ ware() │ │ Sentiment │ │
│ │ /health │ │ │ │ Translation │ │
│ └──────────────┘ │ Validates │ │ Crypto Prices │ │
│ │ payment-sig │ │ Image Gen │ │
│ │ header │ │ Code Review │ │
│ └──────┬───────┘ │ News │ │
│ │ │ Chain Analytics │ │
│ ┌──────▼───────┐ └──────────────────┘ │
│ │ Facilitator │ │
│ │ Settlement │ │
│ └──────────────┘ │
└─────────────────────────────────────────────────────────────┘
# Clone
git clone https://github.com/YOUR_USERNAME/conduit.git
cd conduit
# Install
npm install
# Configure (optional — defaults work out of the box)
cp .env.example .env
# Run
npm run build
npm run dev
Open http://localhost:3402 in your browser.
| Endpoint | Method | Description |
|---|---|---|
/api/v1/discover |
GET | Full API catalog with pricing and docs |
/api/v1/stats |
GET | Marketplace analytics and recent transactions |
/api/v1/health |
GET | Server health check |
| Endpoint | Method | Price | Description |
|---|---|---|---|
/api/v1/weather |
GET | 0.01 STX | Weather data and forecasts |
/api/v1/sentiment |
POST | 0.02 STX | NLP sentiment analysis |
/api/v1/translate |
POST | 0.015 STX | Neural machine translation |
/api/v1/price |
GET | 0.005 STX | Crypto price oracle |
/api/v1/generate-image |
POST | 0.05 STX | AI image generation |
/api/v1/code-review |
POST | 0.03 STX | Automated code review |
/api/v1/news |
GET | 0.008 STX | AI-curated news feed |
/api/v1/chain-analytics |
GET | 0.02 STX | Stacks on-chain analytics |
import axios from 'axios';
import { wrapAxiosWithPayment, privateKeyToAccount } from 'x402-stacks';
const account = privateKeyToAccount(process.env.PRIVATE_KEY, 'mainnet');
const api = wrapAxiosWithPayment(
axios.create({ baseURL: 'http://localhost:3402' }),
account
);
// Discover APIs (free)
const catalog = await api.get('/api/v1/discover');
// Use paid APIs — payment is automatic
const weather = await api.get('/api/v1/weather?location=Tokyo');
const price = await api.get('/api/v1/price?symbol=BTC');
import express from 'express';
import { paymentMiddleware, STXtoMicroSTX } from 'x402-stacks';
const app = express();
app.get('/api/premium',
paymentMiddleware({
amount: STXtoMicroSTX(0.01),
payTo: 'YOUR_STACKS_ADDRESS',
network: 'mainnet',
facilitatorUrl: 'https://x402-facilitator.x402stacks.xyz',
description: 'Premium data access',
}),
(req, res) => res.json({ data: 'Your premium content' })
);
Run the interactive agent demo to see the full x402 flow:
npm run agent:demo
# Or with a specific task:
node agent-demo/agent.js "What's the price of Bitcoin?"
node agent-demo/agent.js "Translate hello to Spanish"
node agent-demo/agent.js "Get blockchain news"
Conduit includes 4 production-ready Clarity smart contracts that bring the marketplace logic on-chain:
api-registry.clar — On-Chain API RegistryProviders register APIs with pricing, descriptions, and metadata. Agents discover endpoints by reading contract state.
| Function | Description |
|---|---|
register-api |
Register a new API with pricing and metadata |
update-api-price |
Update pricing for your API |
toggle-api-status |
Activate/deactivate an API |
get-api-by-id |
Read API details from chain |
get-api-by-slug |
Look up API by name slug |
payment-escrow.clar — Payment Escrow & SettlementHandles the full payment lifecycle: deposit → settle → dispute → refund. Includes platform fees and expiry-based auto-refund.
| Function | Description |
|---|---|
create-payment |
Deposit STX into escrow for an API call |
settle-payment |
Release escrowed STX to provider |
dispute-payment |
Lock funds for admin review |
refund-payment |
Admin refund for disputed payments |
claim-expired-escrow |
Auto-refund after 24h if unsettled |
reputation.clar — On-Chain Reputation SystemAgents rate APIs after paid calls, building a trust layer. Includes 5 tiers: New → Bronze → Silver → Gold → Platinum.
| Function | Description |
|---|---|
rate-api |
Submit a 1-5 star rating with comment |
get-api-reputation |
Full star distribution for an API |
get-api-average-rating |
Average rating (scaled ×100) |
get-provider-reputation |
Provider's aggregate score and tier |
has-rated |
Check if a user already rated an API |
subscription-manager.clar — Prepaid Credits & SubscriptionsAgents deposit STX to get credits with volume discounts (up to 100% bonus). Subscription plans with block-based expiry.
| Function | Description |
|---|---|
purchase-credits |
Buy credits with volume discounts |
spend-credits |
Use credits for API calls |
subscribe |
Subscribe to a prepaid plan |
create-plan |
Admin: create subscription plans |
calculate-credits |
Preview credits for a deposit amount |
conduit/
├── contracts/
│ ├── api-registry.clar # On-chain API registration & discovery
│ ├── payment-escrow.clar # STX escrow, settlement & disputes
│ ├── reputation.clar # Rating system with provider tiers
│ └── subscription-manager.clar # Prepaid credits & subscription plans
├── server/index.js # Express server with x402 middleware
├── public/
│ ├── index.html # Marketplace UI
│ ├── css/styles.css # Premium design system
│ └── js/app.js # Frontend logic
├── agent-demo/agent.js # AI agent demo script
├── package.json
├── .env.example
├── LICENSE
└── README.md
MIT — see LICENSE
Built for the x402 Stacks Challenge on DoraHacks