The easiest way to add AI to your app. Zero configuration, intelligent model selection, built-in examples, and automatic optimization. Get from idea to production in minutes.
Get started in under 30 seconds. No configuration, no setup, no complexity. Just ask and get intelligent AI responses.
npm install @relayplane/sdk
import RelayPlane from '@relayplane/sdk';
// That's it! Zero configuration required
const result = await RelayPlane.ask("Explain quantum computing simply");
console.log(result.response.body);
console.log(result.reasoning.rationale); // See why this model was chosen
Automatically discovers your API keys and selects the best model for each task
Analyzes your prompt and routes to the optimal model with reasoning
Common AI patterns ready to use. Copy, paste, and customize for your needs.
const chat = await RelayPlane.examples.chatbot(
"Hello! How can you help me?",
{
personality: "You are a helpful coding assistant",
budget: "moderate"
}
);
const summary = await RelayPlane.examples.summarize(
longDocument,
{
length: "brief",
focus: "key findings"
}
);
const review = await RelayPlane.examples.codeReview(
myCode,
{
language: "typescript",
focus: "security"
}
);
const translation = await RelayPlane.examples.translate(
"Hello world",
"Spanish",
{ tone: "formal" }
);
8+ Examples Available: chatbot, summarize, codeReview, translate, research, creativeWriting, dataAnalysis, explain, and more!
When things go wrong, get helpful suggestions instead of cryptic error messages.
ā OpenAI API key not found or invalid
š§ Quick Fix:
export OPENAI_API_KEY="your_api_key_here"
š” Suggestions:
⢠Add OPENAI_API_KEY to your environment variables
⢠Or configure RelayPlane hosting with: RelayPlane.configure({ apiKey: "rp_your_key" })
⢠Check that your API key is valid and has the right permissions
⢠Verify OpenAI account has sufficient credits/quota
š Helpful Links:
⢠https://docs.relayplane.com/setup/api-keys
⢠https://docs.relayplane.com/quick-start
Clear guidance on setting up API keys with copy-paste solutions
Automatic fallback suggestions and retry guidance
const result = await RelayPlane.ask(
"Review this React component for security issues",
{
budget: "minimal", // Cost optimization
priority: "quality", // Favor accuracy
taskType: "coding" // Hint for better selection
}
);
// See the reasoning
console.log(result.reasoning.rationale);
// "Selected Claude 3.5 Sonnet because: excellent for
// code analysis, estimated $0.003 cost, ~1500ms response time"
console.log(result.reasoning.alternatives);
// Array of alternative model suggestions with reasons
// Configure global optimization
RelayPlane.configure({
defaultOptimization: {
enabled: true,
strategy: "balanced",
maxRetries: 3,
enableCache: true,
cacheTtl: 300
}
});
// All requests now have:
// ā
Automatic retries with fallbacks
// ā
Intelligent caching
// ā
Cost optimization
// ā
Performance monitoring
Configure advanced optimization settings across your entire application:
import RelayPlane from '@relayplane/sdk';
const relayplane = new RelayPlane({
apiKey: 'your-api-key',
globalOptimize: {
cacheStrategy: {
type: 'hybrid', // memory, disk, hybrid, none
maxSize: '500MB',
evictionPolicy: 'lru', // lru, lfu, fifo
compression: true,
encryption: true
},
batchProcessing: {
enabled: true,
defaultConcurrency: 5,
maxBatchSize: 100,
autoGrouping: true,
timeoutMs: 30000
},
parallelExecution: {
enabled: true,
maxConcurrentRequests: 10,
requestPooling: true,
loadBalancing: 'round_robin' // round_robin, least_connections, random
},
timeoutSettings: {
requestTimeoutMs: 30000,
connectionTimeoutMs: 5000,
readTimeoutMs: 15000,
totalTimeoutMs: 45000,
retryTimeoutMs: 60000
},
rateLimitingStrategy: {
strategy: 'adaptive', // fixed, adaptive, burst
backoffMultiplier: 1.5,
maxBackoffMs: 30000,
jitterEnabled: true,
respectProviderLimits: true,
globalRateLimit: 1000 // requests per minute
}
}
});
Enable agents to communicate with each other for complex multi-step workflows:
import { relay } from '@relayplane/sdk';
// Multi-agent workflow with A2A communication
const analysisResult = await relay({
to: 'claude-3-7-sonnet-20250219',
payload: {
max_tokens: 1000,
messages: [
{ role: 'user', content: 'Analyze this sales data and identify trends' }
]
},
metadata: {
workflow_id: 'sales-analysis-pipeline',
next_agent: 'report-generator-v2', // A2A routing
context: {
data_source: 'Q4-2024',
format: 'executive-summary'
}
}
});
// Chain multiple agents
const reportResult = await relay({
to: 'gpt-4.1',
payload: {
max_tokens: 2000,
messages: [
{
role: 'system',
content: 'You are a report generator. Use the analysis results to create an executive summary.'
},
{
role: 'user',
content: `Analysis results: ${analysisResult.body.content}`
}
]
},
metadata: {
workflow_id: 'sales-analysis-pipeline',
parent_request: analysisResult.relay_id,
final_step: true
}
});
Available on Team+ plans: A2A communication enables sophisticated multi-agent workflows with automatic context passing and error handling.
npm install @relayplane/sdk
# Add any provider's API key - RelayPlane will auto-detect
export OPENAI_API_KEY="your-openai-key"
export ANTHROPIC_API_KEY="your-anthropic-key"
export GOOGLE_API_KEY="your-google-key"
# Or use RelayPlane hosting for all models
export RELAY_API_KEY="rp_your-key"
import RelayPlane from '@relayplane/sdk';
// Zero-config magic
const result = await RelayPlane.ask("What is the capital of France?");
// Built-in examples
const summary = await RelayPlane.examples.summarize(document);
const chat = await RelayPlane.examples.chatbot("Hello!");
// Advanced features
const optimized = await RelayPlane.optimize(request);
const chain = await RelayPlane.chain({ steps: [...] });
Zero-config method for instant AI access with intelligent model selection.
RelayPlane.ask(input: string, options?: {
budget?: 'unlimited' | 'moderate' | 'minimal';
priority?: 'speed' | 'balanced' | 'quality';
taskType?: 'general' | 'coding' | 'creative' | 'analysis' | 'translation';
stream?: boolean;
config?: Partial<EnhancedRelayConfig>;
}): Promise<{
response: RelayResponse;
reasoning: {
selectedModel: string;
rationale: string;
alternatives: Array<{model: string, reason: string}>;
detectedCapabilities: string[];
};
}>
Ready-to-use patterns for common AI tasks.
chatbot(message, options)
summarize(text, options)
codeReview(code, options)
translate(text, language, options)
research(topic, options)
creativeWriting(prompt, options)
dataAnalysis(data, options)
explain(topic, options)
Experiencing issues with timeouts, model errors, or slow performance? Our comprehensive troubleshooting guide covers all common issues and solutions.
All existing v1.x code continues to work without changes.
// v1.x code still works
const response = await RelayPlane.relay({
to: 'claude-3-7-sonnet-20250219',
payload: { messages: [{ role: 'user', content: 'Hello!' }] }
});
// New v0.2 Zero-Config Wins are additive
const result = await RelayPlane.ask("Hello!"); // New!
RelayPlane.ask()
RelayPlane.examples.*
for common patterns