This directory contains demonstration servers that show the problems with traditional API monetization and how Stellar Oxide Gateway solves them.
Traditional APIs have several critical issues:
- ❌ API Key Management - Keys can leak, require manual provisioning
- ❌ Subscription Friction - Users must commit to monthly plans
- ❌ Rate Limits - Users get blocked, can't pay for extra usage
- ❌ Manual Onboarding - Agents can't self-onboard
- ❌ Complex Billing - Requires payment processors, invoicing, etc.
Stellar Oxide Gateway eliminates these problems:
- ✅ No API Keys - Pay with blockchain transactions
- ✅ Pay-Per-Use - No subscriptions, pay only for what you use
- ✅ No Rate Limits - Pay for what you need, when you need it
- ✅ Agent Self-Onboarding - Autonomous agents can start using APIs immediately
- ✅ Zero Billing Infrastructure - Payments settle on Stellar blockchain
See both servers running at the same time:
# From project root
yarn demo:comparisonThis starts:
- Traditional API on
http://localhost:4000 - Stellar Oxide Gateway on
http://localhost:3000
See the problems with traditional approach:
yarn demo:traditionalTry it:
# Will fail - no API key
curl http://localhost:4000/api/search?q=test
# Works but counts against rate limit
curl -H "x-api-key: sk_test_123" http://localhost:4000/api/search?q=testSee the solution in action:
yarn demo:stellarTry it:
# Set up your wallet first
yarn cli setup
# Make a paid request (pays with Stellar)
yarn cli ai --query "test"
# Check your usage stats
curl http://localhost:3000/stats| Feature | Traditional API | Stellar Oxide Gateway |
|---|---|---|
| Authentication | API keys (can leak) | Blockchain signatures |
| Onboarding | Manual signup | Instant, autonomous |
| Billing | Subscriptions | Pay-per-use |
| Rate Limits | Hard limits | Pay for what you need |
| Agent Access | Requires human setup | Self-service |
| Payment Rails | Credit cards, invoices | Stellar blockchain |
| Settlement | Monthly billing cycles | Instant on-chain |
| Billing Infrastructure | Complex (Stripe, etc.) | None needed |
Problem: API Key Required
curl http://localhost:4000/api/search?q=test
# Response: {"error": "Missing API key", "message": "Please sign up..."}Problem: Rate Limits
# Make 100+ requests with the same key
for i in {1..101}; do
curl -H "x-api-key: sk_test_123" http://localhost:4000/api/search?q=test$i
done
# After 100 requests: {"error": "Rate limit exceeded", "message": "Upgrade your plan..."}Problem: Subscription Friction
- User wants to make 1 request
- Must sign up for monthly plan
- Pays for 100 requests even if only using 1
Solution: No API Key Needed
# First request returns 402 with payment requirements
curl http://localhost:3000/api/search?q=test
# Response includes payment requirements in machine-readable formatSolution: Pay-Per-Use
# Set up wallet once
yarn cli setup
# Pay for exactly what you use
yarn cli ai --query "test"
# Pays 0.02 USD in XLM, gets instant access
# Check your spending
curl http://localhost:3000/stats
# Shows total requests and revenueSolution: No Rate Limits
# Make as many requests as you want
# Each request requires payment, but no artificial limits
yarn cli ai --query "request 1"
yarn cli ai --query "request 2"
yarn cli ai --query "request 3"
# Each pays separately, no rate limit errors-
User wants to use API
- Must visit website
- Fill out signup form
- Verify email
- Add payment method
- Choose subscription plan
-
Get API key
- Receive API key via email or dashboard
- Store securely (but can still leak)
- Add to all requests
-
Make requests
- Include API key in headers
- Count against rate limit
- Get blocked when limit reached
-
Billing
- Charged monthly regardless of usage
- Must upgrade plan for more requests
- Complex invoicing and payment processing
-
Agent wants to use API
- No signup needed
- No email verification
- No payment method setup
-
Make request
- Call endpoint directly
- Receive 402 with payment requirements
- Sign Stellar transaction
- Retry with payment proof
-
Instant access
- Payment verified on-chain
- Request processed immediately
- Structured receipt returned
-
Billing
- Pay only for what you use
- Instant settlement on Stellar
- No monthly charges
- No invoicing needed
Traditional:
- Requires API key
- 100 searches/month on free plan
- $29/month for 1000 searches
Stellar Oxide Gateway:
- $0.02 per search
- Pay only for searches you make
- No monthly commitment
Traditional:
- Subscription required
- Fixed token limits per month
- Unused tokens wasted
Stellar Oxide Gateway:
- $0.10 per 1000 tokens
- Pay for exact tokens used
- Dynamic pricing based on prompt length
Traditional:
- Monthly subscription
- Rate limited
- Must upgrade for more requests
Stellar Oxide Gateway:
- $0.05 per query
- No rate limits
- Pay as you go
Traditional:
- Tiered pricing plans
- Unused credits expire
- Complex billing
Stellar Oxide Gateway:
- $0.03 per page
- Pay per page scraped
- Perfect for one-time jobs
# Start traditional API
yarn demo:traditional
# Test 1: No API key
curl http://localhost:4000/api/search?q=test
# Expected: 401 Unauthorized
# Test 2: Valid API key
curl -H "x-api-key: sk_test_123" http://localhost:4000/api/search?q=test
# Expected: Success, but counts against limit
# Test 3: Hit rate limit
for i in {1..101}; do
curl -H "x-api-key: sk_test_123" http://localhost:4000/api/search?q=test$i
done
# Expected: 429 Rate Limit Exceeded after 100 requests# Start Stellar Oxide Gateway
yarn demo:stellar
# Test 1: Get payment requirements
curl http://localhost:3000/api/search?q=test
# Expected: 402 with payment requirements
# Test 2: Make paid request
yarn cli setup # One-time setup
yarn cli ai --query "test"
# Expected: Success with payment receipt
# Test 3: Check stats
curl http://localhost:3000/stats
# Expected: Request count and revenue
# Test 4: No rate limits
yarn cli ai --query "request 1"
yarn cli ai --query "request 2"
yarn cli ai --query "request 3"
# Expected: All succeed, each with separate paymentBy running these demos, you'll understand:
-
Why traditional API monetization is broken
- API key management overhead
- Subscription friction
- Rate limiting problems
- Manual onboarding barriers
-
How Stellar Oxide Gateway solves these problems
- Blockchain-based authentication
- Pay-per-use pricing
- Agent self-onboarding
- Instant settlement
-
How to integrate Stellar Oxide Gateway
- Declarative route definitions
- Dynamic pricing policies
- Storage configuration
- Discovery endpoints
-
Real-world use cases
- AI inference APIs
- Search services
- Market data feeds
- Web scraping services
After running the demos:
- Read the main README - Learn about all features
- Check the examples - See more integration patterns
- Run the tests - Verify everything works
- Deploy your own - Start monetizing your APIs
Found a bug or have a suggestion? Open an issue or PR!
MIT License - See LICENSE file for details