Quick Start Guide¶
Get the OpenLibx402 RAG Chatbot up and running in 5 minutes.
Prerequisites¶
1. Setup (2 minutes)¶
Replace the API keys with your actual keys.
2. Start Server (1 minute)¶
You should see:
3. Test Chatbot (2 minutes)¶
Option A: Via Browser¶
- Open
http://localhost:8000(your docs site) - Click the chat bubble (💬) in bottom-right
- Type a question: "What is OpenLibx402?"
- See the response!
Option B: Via cURL¶
4. Test Payments (Optional)¶
To test the payment system:
- Get devnet tokens:
- Visit https://spl-token-faucet.com/
- Paste your Phantom wallet address
- Select USDC token
-
Request airdrop
-
Make a test payment:
- Use 3 free queries in chatbot
- Click "Pay with Solana"
- Select 0.01 USDC (10 queries)
- Confirm in Phantom wallet
- Wait for blockchain confirmation
- See queries granted!
Common Issues¶
"Server won't start"¶
"OpenAI API error"¶
"Pinecone connection error"¶
"No responses from chat"¶
Check server logs for errors:
Next Steps¶
- 📖 Read Configuration Guide for advanced setup
- 🚀 See Deployment Guide for production
- 💰 Learn about Payment System
- 📚 Check API Reference for all endpoints
File Structure¶
Key Endpoints¶
| Method | Endpoint | Purpose |
|---|---|---|
| POST | /api/chat |
Send message to chatbot |
| GET | /api/status |
Check rate limit |
| GET | /api/payment/info |
Get payment info |
| POST | /api/payment |
Submit payment |
Environment Variables Summary¶
| Variable | Purpose | Required |
|---|---|---|
OPENAI_API_KEY |
GPT API access | ✅ Yes |
PINECONE_API_KEY |
Vector DB access | ✅ Yes |
PINECONE_INDEX_NAME |
Index name | ✅ Yes |
X402_WALLET_ADDRESS |
Payment receiver | ✅ Yes |
X402_WALLET_SECRET_KEY |
Sign transactions | ✅ Yes |
SOLANA_NETWORK |
devnet/mainnet | ✅ Yes |
USDC_MINT_ADDRESS |
Token address | ✅ Yes |
RATE_LIMIT_FREE_QUERIES |
Free limit per day | ⚠️ Optional (default: 3) |
PORT |
Server port | ⚠️ Optional (default: 3000) |
ALLOWED_ORIGINS |
CORS origins | ⚠️ Optional |
Rate Limiting¶
- Free: 3 queries per day (per IP)
- Paid: Purchase with USDC (10-1000 queries)
- Reset: Daily at midnight UTC
Pricing¶
- Cost to user: $0.001 per query (0.01 USDC = 10 queries)
- Cost to operate: ~$0.000133 per query
- Profit margin: ~87%
Support¶
For issues or questions: 1. Check Configuration Guide 2. Check Payment System 3. Review server logs for [ERROR] messages 4. Create an issue on GitHub
What's Next?¶
Once you have the chatbot running:
- Test thoroughly on devnet with USDC payments
- Review the API at
/docs/chatbot/api.md - Configure production settings following
/docs/chatbot/deployment.md - Deploy to production using Docker or VPS
- Monitor costs and performance
- Gather feedback from users
Enjoy your RAG chatbot! 🚀