sciphi cloud setup
Setting Up SciPhi Cloud for Supen
Section titled “Setting Up SciPhi Cloud for Supen”This guide shows you how to set up SciPhi Cloud (hosted R2R) for your Supen knowledge base.
Step 1: Sign Up for SciPhi Cloud
Section titled “Step 1: Sign Up for SciPhi Cloud”- Go to https://app.sciphi.ai
- Click “Sign Up” (free tier available, no credit card required)
- Verify your email
- Log in to the dashboard
Step 2: Get Your API Key
Section titled “Step 2: Get Your API Key”- In the SciPhi dashboard, navigate to “Settings” or “API Keys”
- Click “Create API Key”
- Give it a name (e.g., “Supen Production”)
- Copy the API key - you won’t see it again!
- Save it securely
Step 3: Configure Supen
Section titled “Step 3: Configure Supen”For Local Development
Section titled “For Local Development”Add to your app/.env.local:
# SciPhi Cloud ConfigurationR2R_API_URL=https://api.sciphi.aiR2R_API_KEY=your_api_key_hereFor Railway Production
Section titled “For Railway Production”In your Railway dashboard:
- Go to your Supen service
- Click “Variables”
- Add these environment variables:
R2R_API_URL=https://api.sciphi.aiR2R_API_KEY=your_api_key_here- Click “Deploy”
Step 4: Test the Connection
Section titled “Step 4: Test the Connection”Run this test to verify everything works:
# Start your Supen dev serverpnpm dev
# In another terminal, test the health endpointcurl http://localhost:3333/api/knowledge/healthYou should see:
{ "available": true, "provider": "R2R", "baseUrl": "https://api.sciphi.ai"}Step 5: Upload Your First Document
Section titled “Step 5: Upload Your First Document”Via API:
Section titled “Via API:”curl -X POST http://localhost:3333/api/knowledge/documents \ -F "file=@/path/to/your/document.pdf" \ -F "useHiResMode=true"Via UI:
Section titled “Via UI:”- Go to http://localhost:3333/knowledge (once we build the UI)
- Click “Upload Document”
- Select your PDF
- Enable “Complex Layout Mode” for PDFs with tables/images
- Click “Upload”
Step 6: Query Your Knowledge Base
Section titled “Step 6: Query Your Knowledge Base”curl -X POST http://localhost:3333/api/knowledge/query \ -H "Content-Type: application/json" \ -d '{ "query": "What is this document about?", "limit": 5 }'API Endpoints
Section titled “API Endpoints”Once configured, Supen provides these knowledge endpoints:
GET /api/knowledge/health # Check R2R availabilityGET /api/knowledge/collections # List knowledge basesPOST /api/knowledge/collections # Create knowledge baseGET /api/knowledge/documents # List documentsPOST /api/knowledge/documents # Upload documentGET /api/knowledge/documents/:id # Get document detailsDELETE /api/knowledge/documents/:id # Delete documentPOST /api/knowledge/search # Search (no generation)POST /api/knowledge/query # RAG query (with generation)Usage with Vibex Agents
Section titled “Usage with Vibex Agents”Vibex agents can automatically use knowledge context:
import { getKnowledgeService } from "@/lib/r2r";
// In your agent codeconst knowledgeService = getKnowledgeService();
// Search for relevant contextconst context = await knowledgeService.search( userQuery, { workspaceId, limit: 5 });
// Use context in agent system promptconst systemPrompt = `You are an AI assistant with access to the following knowledge:
${context.map(c => c.text).join("
")}
Use this knowledge to answer the user's question accurately.`;SciPhi Cloud Limits
Section titled “SciPhi Cloud Limits”Free Tier:
- Generous document storage
- Standard retrieval speed
- Community support
Paid Plans:
- Larger document limits
- Faster processing
- Priority support
- Advanced features (knowledge graphs, etc.)
Check https://www.sciphi.ai/pricing for current limits.
Troubleshooting
Section titled “Troubleshooting””Failed to connect to R2R service”
Section titled “”Failed to connect to R2R service””Check:
- Is
R2R_API_URLset correctly? (should behttps://api.sciphi.ai) - Is
R2R_API_KEYvalid? - Test directly:
curl https://api.sciphi.ai/v3/health
Document upload fails
Section titled “Document upload fails”Check:
- File size limits (check SciPhi dashboard for your plan limits)
- Supported file types (PDF, DOCX, TXT, MD, etc.)
- API key has write permissions
Slow document processing
Section titled “Slow document processing”This is normal for complex PDFs:
- Hi-res mode with table extraction takes longer
- Check document status:
GET /api/knowledge/documents/:id - Status will change from “processing” → “completed”
Authentication errors
Section titled “Authentication errors”Make sure:
- API key is in environment variables (not hardcoded)
- API key has correct format (Bearer token)
- API key hasn’t expired
Security Best Practices
Section titled “Security Best Practices”- Never commit API keys - Use environment variables
- Rotate keys regularly - Create new keys periodically
- Use different keys - Dev vs Production
- Monitor usage - Check SciPhi dashboard for unusual activity
- Limit access - Only give keys to necessary services
Next Steps
Section titled “Next Steps”- Build the knowledge UI for document management
- Integrate knowledge retrieval into Vibex agents
- Set up automated document ingestion pipelines
- Configure project-specific knowledge bases
Need Help?
Section titled “Need Help?”- SciPhi Documentation: https://r2r-docs.sciphi.ai
- SciPhi Discord: https://discord.gg/sciphi (check their GitHub for invite)
- Supen Issues: https://github.com/your-repo/supen/issues