Spaces:
Runtime error
Runtime error
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. | |