New in v0.2: Zero-Config Wins & Zero-Config AI

RelayPlane SDK

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.

Zero-Config Win

Get started in under 30 seconds. No configuration, no setup, no complexity. Just ask and get intelligent AI responses.

Install & Use
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

✨ Auto-Detection

Automatically discovers your API keys and selects the best model for each task

🧠 Intelligent Routing

Analyzes your prompt and routes to the optimal model with reasoning

Ready-to-Use Examples

Common AI patterns ready to use. Copy, paste, and customize for your needs.

šŸ’¬ Chatbot

const chat = await RelayPlane.examples.chatbot(
  "Hello! How can you help me?",
  {
    personality: "You are a helpful coding assistant",
    budget: "moderate"
  }
);

šŸ“„ Summarization

const summary = await RelayPlane.examples.summarize(
  longDocument,
  {
    length: "brief",
    focus: "key findings"
  }
);

šŸ” Code Review

const review = await RelayPlane.examples.codeReview(
  myCode,
  {
    language: "typescript",
    focus: "security"
  }
);

šŸŒ Translation

const translation = await RelayPlane.examples.translate(
  "Hello world",
  "Spanish",
  { tone: "formal" }
);

8+ Examples Available: chatbot, summarize, codeReview, translate, research, creativeWriting, dataAnalysis, explain, and more!

Contextual Error Handling

When things go wrong, get helpful suggestions instead of cryptic error messages.

Example Error Output
āŒ 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

šŸ”‘ API Key Issues

Clear guidance on setting up API keys with copy-paste solutions

⚔ Rate Limits

Automatic fallback suggestions and retry guidance

Advanced Features

Intelligent Model Selection

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

Automatic Optimization

// 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

Global Optimization Settings

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
    }
  }
});

Agent-to-Agent (A2A) Communication

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.

Installation & Quick Setup

1. Install the SDK

npm install @relayplane/sdk

2. Set API Keys (Optional)

# 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"

3. Start Using

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: [...] });

API Reference

RelayPlane.ask()

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[];
  };
}>

RelayPlane.examples

Ready-to-use patterns for common AI tasks.

Available Examples:

  • • chatbot(message, options)
  • • summarize(text, options)
  • • codeReview(code, options)
  • • translate(text, language, options)

More Examples:

  • • research(topic, options)
  • • creativeWriting(prompt, options)
  • • dataAnalysis(data, options)
  • • explain(topic, options)

Need Help?

Experiencing issues with timeouts, model errors, or slow performance? Our comprehensive troubleshooting guide covers all common issues and solutions.

Migrating to v0.2

āœ… Fully Backward Compatible

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!

šŸŽÆ Recommended: Try the New Features

  • • Replace manual model selection with RelayPlane.ask()
  • • Use RelayPlane.examples.* for common patterns
  • • Benefit from enhanced error handling automatically