Skip to content

kiratonine/slkp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

107 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

S1lkPay x402 Bridge

x402 payment bridge that lets AI agents pay for APIs from a bank account with Solana settlement.

Backend CI Frontend CI Solana Devnet x402 NestJS React TypeScript

🚀 Live App · 🤖 Live Agent · 🎥 Video Demo · 🎤 Pitch · 📊 Pitch Deck · 📚 Docs · 🔌 Swagger


What is S1lkPay x402 Bridge? ⚡

S1lkPay x402 Bridge lets AI agents pay for paid APIs through x402 while the user pays from a familiar bank account.

The agent does not get access to the user’s card, wallet, or full balance.
It only receives a limited session token with spending rules.

User KZT balance → Agent session token → x402 API payment → Solana settlement → Paid API response


Problem 🤖

AI agents can use tools, APIs, data feeds, and paid services.

But payments are still hard:

Problem Why it matters
Agents should not get card access Too risky
Agents should not get private keys Unsafe for users
Users do not want crypto wallet UX Too much friction
Manual approval for every API call is slow Breaks automation
Paid APIs need machine-friendly payments Agents need automatic access

Core question:
How can an AI agent pay for digital services without direct access to the user’s money?


Solution ✅

S1lkPay x402 Bridge adds a safe payment layer between the user, the agent, and the paid API.

1. User enables AI payments
2. User sets spending limits
3. User creates an agent session token
4. Agent calls an x402-protected API
5. Seller returns HTTP 402 Payment Required
6. Agent asks S1lkPay Bridge to pay
7. Bridge checks limits and balance
8. Bridge creates x402 PAYMENT-SIGNATURE
9. Seller accepts Solana payment
10. Bridge confirms payment and debits KZT

The agent can pay only through the bridge and only within the user’s limits.


Demo Flow 🚀

1. Open the main S1lkPay frontend
2. Register or log in
3. Enable agent payments
4. Set daily and per-transaction limits
5. Create an agent session
6. Copy sessionToken
7. Open the browser agent terminal
8. Click Start
9. Run: Connect s1lk-x402-bridge
10. Paste sessionToken
11. Run: Get premium sol quote
12. Agent pays through x402
13. Seller returns paid data
14. Payment appears in history
15. Ledger shows KZT debit

Why Solana? 🟣

Solana is part of the actual payment path.

The seller only unlocks the paid API after receiving a valid x402 payment flow using Solana settlement.

Solana value How it helps
Fast payments Good for agent-to-API requests
Low fees Works for small API payments
USDC support Fits paid digital services
x402 SVM flow Enables HTTP 402 payments on Solana
Payment proof Paid access depends on payment success

Without Solana settlement, the core paid API flow does not work.


Screenshots

Main Dashboard

Agent Payment Settings

Agent Sessions

Browser Agent Terminal

Payment Detail

Ledger


Architecture 🧩

User
  ↓
Main frontend
  ↓
apps/api
  ↓
Agent session + limits + balance check
  ↓
apps/agent-cli / browser terminal
  ↓
apps/seller returns HTTP 402
  ↓
@s1lk/x402-agent-sdk calls bridge
  ↓
Bridge creates PAYMENT-SIGNATURE
  ↓
x402 Solana settlement
  ↓
Seller returns paid data
  ↓
Bridge confirms payment and writes ledger

More details: docs/architecture.md


Repository Structure

slkp/
├── frontend/                      # Main user application
│
└── backend/
    ├── apps/
    │   ├── api/
    │   │   └── Main NestJS backend
    │   ├── seller/
    │   │   └── x402-protected paid API
    │   ├── agent-cli/
    │   │   └── Interactive AI agent simulator
    │   └── agent-terminal-web/
    │       └── Browser terminal for demo
    │
    └── packages/
          └── agent-sdk/
             └── @s1lk/x402-agent-sdk

Tech Stack

Layer Technology
Main Frontend React, Vite, TypeScript, Tailwind CSS, React Router
Browser Agent Terminal React, Vite, xterm.js, Socket.IO
Backend API NestJS, TypeScript, Prisma
Database PostgreSQL
Seller API Express, x402 middleware
Agent CLI TypeScript
Agent SDK TypeScript
Payments x402
Blockchain Solana Devnet, x402 SVM

Quick Start

Prerequisites

  • Node.js 24+
  • pnpm
  • PostgreSQL
  • Solana Devnet USDC for treasury
  • Browser with WebSocket support

Install

git clone https://github.com/kiratonine/slkp.git
cd slkp
pnpm install

Environment

Create environment files from examples:

cp frontend/.env.example frontend/.env
cp backend/apps/api/.env.example backend/apps/api/.env
cp backend/apps/seller/.env.example backend/apps/seller/.env
cp backend/apps/agent-terminal-web/.env.example backend/apps/agent-terminal-web/.env

Fill the required variables inside each .env file.


Prisma

cd backend
pnpm --dir apps/api exec prisma generate --schema=./prisma/schema.prisma
pnpm --dir apps/api exec prisma migrate dev --schema=./prisma/schema.prisma

Build

cd backend
pnpm --dir packages/agent-sdk build
pnpm --dir apps/agent-cli build
pnpm --dir apps/seller build
pnpm --dir apps/agent-terminal-web build
pnpm --dir apps/api build

cd ../frontend
pnpm build

Run Locally

Terminal 1 — backend API:

cd backend/apps/api
pnpm start:dev

Terminal 2 — x402 seller:

cd backend/apps/seller
pnpm dev

Terminal 3 — main frontend:

cd frontend
pnpm dev

Terminal 4 — browser agent terminal:

cd backend/apps/agent-terminal-web
pnpm dev

Open:

Main app: http://localhost:5173
Agent terminal: http://localhost:5174
Swagger: http://localhost:3001/docs

Browser Agent Commands

Use these commands in the browser terminal:

Connect s1lk-x402-bridge
Get premium sol quote

The first command connects the bridge and asks for a session token.
The second command runs the paid x402 API flow.


Roadmap

  • Auth and KZT balance
  • Agent sessions and limits
  • x402 seller API
  • Agent SDK
  • Browser agent terminal
  • Two-phase payment confirmation
  • Ledger after seller success
  • Backend CI
  • Improve payment reconciliation
  • Publish agent SDK
  • Integrate real S1lkPay balance
  • Add seller approval flow
  • Prepare mainnet treasury model

Full roadmap: docs/roadmap.md


Docs


About

x402 payment bridge that lets AI agents pay for APIs from a bank account with Solana settlement.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors