Spaces:
Runtime error
Runtime error
File size: 2,140 Bytes
8459353 8d0b054 e6c80ed 8d0b054 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
---
title: x402 AI Demo - Pay-per-inference with Base micropayments
emoji: π³
colorFrom: blue
colorTo: purple
sdk: docker
app_file: app.py
app_port: 7860
suggested_hardware: cpu-upgrade
suggested_storage: small
startup_duration_timeout: 10m
short_description: Pay-per-use Inference with Base micropayments
models:
- distilgpt2
- cardiffnlp/twitter-roberta-base-sentiment-latest
tags:
- fastapi
- x402
- micropayments
- cryptocurrency
- nova
- ai
- blockchain
- base
- usdc
- metamask
pinned: false
license: mit
fullWidth: true
---
# π€ x402 AI Demo - Pay-per-use AI Services
A FastAPI demonstration of micropayments for AI services using the x402 protocol.
## π Features
- **π Text Generation** - DistilGPT-2 ($0.01 per request)
- **π Sentiment Analysis** - RoBERTa ($0.005 per request)
- **πΌοΈ Image Generation** - Amazon Nova Canvas ($0.02 per request)
- **π° Automatic Revenue Splitting** - CDP Wallet integration
- **π MetaMask Integration** - Seamless crypto payments
## π§ How It Works
1. Connect your MetaMask wallet to Base Sepolia testnet
2. Click a service button to make a request
3. Sign the x402 payment with your wallet
4. AI service processes your request
5. Revenue is automatically split between stakeholders
## π‘ Demo Mode
This is running on **Base Sepolia testnet** - no real money required! Get testnet USDC from the [Base Sepolia faucet](https://www.coinbase.com/faucets/base-ethereum-sepolia-faucet).
## ποΈ Technology Stack
- **Backend**: FastAPI with x402 payment protocol
- **Frontend**: HTML/CSS/JavaScript with MetaMask integration
- **AI Models**: Hugging Face Transformers (DistilGPT-2, RoBERTa)
- **Image Generation**: AWS Bedrock Nova Canvas
- **Payments**: Base Sepolia testnet with USDC
- **Revenue Splitting**: Coinbase Developer Platform (CDP)
## π Links
- [x402 Protocol](https://github.com/sourcegraph/fastapi-x402)
- [Base Sepolia Faucet](https://www.coinbase.com/faucets/base-ethereum-sepolia-faucet)
- [MetaMask Download](https://metamask.io/)
---
Built with β€οΈ using FastAPI, Hugging Face, and the x402 payment protocol.
|