Gathering detailed insights and metrics for @relayplane/sdk
Gathering detailed insights and metrics for @relayplane/sdk
Gathering detailed insights and metrics for @relayplane/sdk
Gathering detailed insights and metrics for @relayplane/sdk
RelayPlane SDK provides a unified interface for routing AI model calls across providers with automatic fallback, optimization, and cost control.
npm install @relayplane/sdk
Typescript
Module System
Min. Node Version
Node Version
NPM Version
TypeScript (86.55%)
JavaScript (13.45%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
1 Stars
3 Commits
1 Branches
2 Contributors
Updated on Jun 19, 2025
Latest Version
0.3.1
Package Id
@relayplane/sdk@0.3.1
Unpacked Size
1.29 MB
Size
243.50 kB
File Count
21
NPM Version
10.9.2
Node Version
23.10.0
Published on
Jun 30, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
🪄 Zero-config AI for developers - The easiest way to add intelligent AI to your applications
RelayPlane SDK provides seamless AI integration with automatic optimization, intelligent model selection, and built-in examples. No configuration required - just ask!
1import RelayPlane from '@relayplane/sdk'; 2 3// Magic! Just ask - auto-detects your API keys and picks the best model 4const result = await RelayPlane.ask("Explain quantum computing simply"); 5console.log(result.response); 6console.log(result.reasoning.rationale); // See why this model was chosen
What makes this magical:
1// Get intelligent model selection with full reasoning 2const result = await RelayPlane.ask("Complex financial analysis task", { 3 budget: 'moderate', // 'minimal', 'moderate', 'unlimited' 4 priority: 'quality', // 'speed', 'balanced', 'quality' 5 taskType: 'analysis' // 'coding', 'creative', 'analysis', 'general' 6}); 7 8console.log(result.reasoning.rationale); 9// "Selected Claude-3-sonnet over GPT-4 because: 10// - 40% faster for financial analysis tasks 11// - $0.02 vs $0.08 estimated cost 12// - 94% success rate for this task type"
Ready-to-use patterns for instant productivity:
1// Summarization with intelligent length control 2const summary = await RelayPlane.examples.summarize(longText, { 3 length: 'brief' 4}); 5 6// Translation with context awareness 7const translation = await RelayPlane.examples.translate('Hello world', 'Spanish'); 8 9// Code review with focus areas 10const review = await RelayPlane.examples.codeReview(myCode, { 11 focus: 'security' 12}); 13 14// Research workflow 15const research = await RelayPlane.examples.research('quantum computing applications'); 16 17// Chatbot with personality 18const chat = await RelayPlane.examples.chatbot('How are you?', { 19 personality: 'helpful and friendly assistant', 20 context: previousMessages 21});
1// Automatic retry with intelligent model switching 2const result = await RelayPlane.smartRetry({ 3 to: 'claude-sonnet-4-20250514', 4 payload: { messages: [{ role: 'user', content: 'Complex task' }] } 5}, { 6 maxRetries: 3, 7 confidenceThreshold: 0.9, // Retry until 90% confident 8 retryOnFailureTypes: ['rate_limit', 'timeout', 'model_error'] 9}); 10 11console.log(result.retryInfo.modelAttempts); // See all attempts and reasoning
1// Enhanced streaming with intelligent chunking 2for await (const { chunk, metadata } of RelayPlane.optimizeStreaming(response, 'claude-sonnet-4-20250514')) { 3 console.log(chunk); // Optimally sized chunks for natural reading 4 console.log(metadata.isTyping); // Typing indicators 5 console.log(metadata.estimatedCost); // Real-time cost tracking 6 console.log(metadata.estimatedProgress); // Progress estimation 7} 8 9// React integration (if using React) 10const { content, metadata, isStreaming, startStreaming } = RelayPlane.useOptimizedStreaming();
1try { 2 const result = await RelayPlane.ask("Test prompt"); 3} catch (error) { 4 if (error instanceof RelayPlane.RelayApiKeyError) { 5 console.log(error.getHelpfulMessage()); 6 // Shows exact steps to fix API key issues with copy-paste commands 7 } 8 9 if (error instanceof RelayPlane.RelayRateLimitError) { 10 console.log(error.suggestions); 11 // ["Use RelayPlane.configure({ optimization: true }) for automatic fallbacks", 12 // "Switch to hosted mode for better rate limiting", 13 // "Try again in 60 seconds"] 14 } 15}
Want to see all these features in action? Try our interactive CLI:
1# Experience the magic in 30 seconds 2npx @relayplane/cli demo
This provides a beautiful terminal experience showcasing:
1npm install @relayplane/sdk
RelayPlane works without configuration, but you can customize it:
1// Optional: Configure for enhanced features 2RelayPlane.configure({ 3 apiKey: 'your-relayplane-key', // For hosted mode 4 debug: true, // Enable debug logging 5 defaultOptimization: { 6 enabled: true, // Auto-fallback and optimization 7 strategy: 'balanced' // 'speed', 'balanced', 'quality' 8 }, 9 costMonitoring: { 10 dailyLimit: 10.00, // Daily spend limit 11 alertThreshold: 0.8 // Alert at 80% of limit 12 } 13}); 14 15// Or use environment variables (zero config!) 16// RELAYPLANE_API_KEY=rp_... (hosted mode) 17// OPENAI_API_KEY=sk-... (local mode) 18// ANTHROPIC_API_KEY=sk-... (local mode) 19// GOOGLE_API_KEY=... (local mode)
1// Create intelligent workflows 2const result = await RelayPlane.chain({ 3 steps: [ 4 { step: 'research', to: 'claude-sonnet-4-20250514', prompt: 'Research topic' }, 5 { step: 'analyze', to: 'gpt-4-turbo', prompt: 'Analyze findings' }, 6 { step: 'summarize', to: 'claude-haiku', prompt: 'Create summary' } 7 ], 8 input: 'Analyze the impact of AI on healthcare', 9 optimization: true 10});
1// Process multiple requests efficiently 2const results = await RelayPlane.batch({ 3 requests: [ 4 { to: 'claude-sonnet-4-20250514', payload: { messages: [...] } }, 5 { to: 'gpt-4-turbo', payload: { messages: [...] } } 6 ], 7 parallel: true, 8 optimization: { enabled: true } 9});
1// Full control when needed 2const response = await RelayPlane.relay({ 3 to: 'claude-sonnet-4-20250514', 4 payload: { 5 messages: [ 6 { role: 'user', content: 'Hello, Claude!' } 7 ], 8 max_tokens: 1000, 9 temperature: 0.7 10 }, 11 optimization: { 12 enabled: true, 13 fallback: ['gpt-4-turbo', 'claude-haiku'] 14 } 15});
1// Complex setup required 2import OpenAI from 'openai'; 3import Anthropic from '@anthropic-ai/sdk'; 4 5const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY }); 6const anthropic = new Anthropic({ apiKey: process.env.ANTHROPIC_API_KEY }); 7 8// Manual model selection and error handling 9let response; 10try { 11 response = await openai.chat.completions.create({ 12 model: 'gpt-4', // Hard-coded model choice 13 messages: [{ role: 'user', content: 'Hello' }] 14 }); 15} catch (error) { 16 if (error.status === 429) { 17 // Manual fallback logic 18 response = await anthropic.messages.create({ 19 model: 'claude-3-sonnet-20240229', 20 messages: [{ role: 'user', content: 'Hello' }] 21 }); 22 } 23}
1// Zero config, intelligent optimization 2import RelayPlane from '@relayplane/sdk'; 3 4// That's it! Everything else is automatic 5const result = await RelayPlane.ask('Hello'); 6console.log(result.response.body); 7console.log(result.reasoning.rationale); // See the intelligent decision-making
✅ Zero Configuration - Works instantly without setup
✅ Intelligent Model Selection - AI chooses the best model for your task
✅ Built-in Examples - Ready-to-use patterns for common tasks
✅ Smart Retry Logic - Automatic fallback with reasoning
✅ Contextual Error Messages - Helpful recovery suggestions
✅ Real-time Cost Tracking - Know your spend as you go
✅ Optimized Streaming - Perfect chunk sizes and timing
✅ Dual Mode Operation - Use your keys or our hosted service
Provider | Model Identifiers |
---|---|
Anthropic | claude-opus-4-20250514 , claude-sonnet-4-20250514 , claude-3-7-sonnet-20250219 , claude-3-5-sonnet-20241022 , claude-3-5-haiku-20241022 , claude-3-opus-20240229 , claude-3-sonnet-20240229 , claude-3-haiku-20240307 |
OpenAI | gpt-4.1 , gpt-4.1-mini , o3 , o3-pro , o3-mini , o4-mini , gpt-4o , gpt-4o-mini , o1-preview , o1-mini , gpt-4 , gpt-4-turbo , gpt-3.5-turbo |
gemini-2.5-pro , gemini-2.5-flash , gemini-2.5-flash-lite , gemini-2.0-flash , gemini-1.5-pro , gemini-1.5-flash , gemini-pro , gemini-pro-vision |
1# Test your setup instantly 2npx @relayplane/cli test 3 4# See error recovery demos 5npx @relayplane/cli demo 6# Select: "🔧 Error Recovery"
Start with zero config: npm install @relayplane/sdk
🪄
No vulnerabilities found.
No security vulnerabilities found.