npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@relayplane/sdk

v1.0.0

Published

RelayPlane SDK - Local-first AI workflow engine for building multi-step AI workflows

Readme

@relayplane/sdk

Local-first AI workflow engine for building multi-step AI workflows with explicit provider:model selection.

Build production-ready AI workflows that run locally by default, with optional cloud features like webhooks, schedules, and run history.

npm version License: MIT

Why RelayPlane?

  • Local-First - Workflows run on your machine using your API keys. No cloud required.
  • Multi-Model - Chain GPT-4, Claude, Gemini, Groq in a single workflow
  • Explicit Models - Use provider:model format: openai:gpt-4o, anthropic:claude-3.5-sonnet
  • Type-Safe - Full TypeScript support with Zod schema validation
  • Dependency Graphs - Express complex step dependencies with .depends()
  • No Gateway Tax - Direct API calls to providers, no usage fees
  • Optional Cloud - Add webhooks, schedules, and run history when you need them

Quick Start

npm install @relayplane/sdk
import { relay } from "@relayplane/sdk";

const result = await relay
  .workflow("invoice-processor")
  .step("extract").with("openai:gpt-4o-vision")
  .step("summarize").with("anthropic:claude-3.5-sonnet").depends("extract")
  .run({ fileUrl: "https://example.com/invoice.pdf" });

console.log(result.steps.summarize);

That's it! This workflow runs locally with zero configuration beyond API keys.

Core Concepts

Fluent Builder API

RelayPlane uses a fluent builder pattern: step → with → depends → run

relay
  .workflow("workflow-name")
  .step("step-name").with("provider:model")
  .step("step-name").with("provider:model").depends("previous-step")
  .run(input);

Explicit Provider:Model Format

Always specify both provider and model:

.with("openai:gpt-4o")           // ✅ Correct
.with("anthropic:claude-3.5-sonnet")  // ✅ Correct
.with("google:gemini-1.5-pro")   // ✅ Correct
.with("gpt-4")                   // ❌ Missing provider

Dependency Graphs

Chain steps with explicit dependencies:

relay
  .workflow("pipeline")
  .step("fetch").with("openai:gpt-4o-mini")
  .step("parse").with("openai:gpt-4o").depends("fetch")
  .step("validate").with("anthropic:claude-3.5-sonnet").depends("parse")
  .step("summarize").with("openai:gpt-4o-mini").depends("validate")
  .run(input);

Steps execute in dependency order. parse waits for fetch, validate waits for parse, etc.

Complete Example

import { relay } from "@relayplane/sdk";
import { z } from "zod";

// Define structured output schema
const InvoiceSchema = z.object({
  invoiceNumber: z.string(),
  vendor: z.string(),
  totalAmount: z.number(),
  items: z.array(z.object({
    description: z.string(),
    quantity: z.number(),
    unitPrice: z.number(),
  })),
});

// Build multi-step workflow
const result = await relay
  .workflow("invoice-processor")

  // Step 1: Extract structured data using vision model
  .step("extract", {
    schema: InvoiceSchema,
    systemPrompt: "Extract all invoice fields as structured JSON.",
  })
  .with("openai:gpt-4o-vision")

  // Step 2: Validate using language model
  .step("validate", {
    systemPrompt: "Verify totals and flag discrepancies.",
  })
  .with("anthropic:claude-3.5-sonnet")
  .depends("extract")

  // Step 3: Summarize for approval
  .step("summarize", {
    systemPrompt: "Create executive summary for finance approval.",
  })
  .with("openai:gpt-4o-mini")
  .depends("validate")

  .run({ fileUrl: "https://example.com/invoice.pdf" });

// Access step outputs
console.log(result.steps.extract);   // Typed as InvoiceSchema
console.log(result.steps.validate);
console.log(result.steps.summarize);

API Keys

Environment Variables (Recommended)

# .env.local
OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-ant-...
GOOGLE_API_KEY=...
GROQ_API_KEY=gsk-...

Programmatic Configuration

import { relay } from "@relayplane/sdk";

relay.configure({
  providers: {
    openai: { apiKey: process.env.OPENAI_API_KEY },
    anthropic: { apiKey: process.env.ANTHROPIC_API_KEY },
  },
});

Per-Run Override

await relay
  .workflow("example")
  .step("test").with("openai:gpt-4o")
  .run(input, {
    providers: {
      openai: { apiKey: "sk-override-key" },
    },
  });

Supported Providers

| Provider | Models | Format | |----------|---------|--------| | OpenAI | GPT-4, GPT-4 Turbo, GPT-4o, GPT-4o-mini | openai:gpt-4o | | Anthropic | Claude 3.5 Sonnet, Claude 3 Opus/Haiku | anthropic:claude-3.5-sonnet | | Google | Gemini 1.5 Pro/Flash | google:gemini-1.5-pro | | Groq | Llama 3.1, Mixtral | groq:llama-3.1-70b |

Full model list: docs.relayplane.com/providers

Cloud Features (Optional)

Webhooks

Trigger workflows via HTTP:

npx relay login

curl -X POST https://api.relayplane.com/webhooks/trigger \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{"workflowName": "invoice-processor", "input": {...}}'

Schedules

Run workflows on cron schedules:

relay
  .workflow("daily-report")
  .schedule("0 9 * * *")  // Every day at 9am
  .step("generate").with("openai:gpt-4o")
  .run(input);

Run History

Track executions with step-by-step logs and token usage:

npx relay dashboard

Pricing: Free local mode. Cloud features: $99/mo (Pro), $399/mo (Scale), Enterprise available.

Use Cases

Agency & Professional Services

  • Invoice Processing - Extract data from invoices with GPT-4 Vision
  • Contract Analysis - Extract key terms from legal documents
  • Proposal Generation - Auto-generate proposals from RFPs

Customer Support

  • Ticket Routing - Classify and route support tickets
  • Reply Generation - Draft context-aware support responses
  • CSAT Analysis - Analyze feedback sentiment and themes

Content & Marketing

  • Content Pipelines - Research, outline, write, edit workflows
  • SEO Audit - Analyze pages and generate recommendations
  • Email Digests - Summarize newsletters and reports

Data & Analytics

  • Data Enrichment - Augment records with external data
  • Metrics Summary - Generate executive dashboards
  • Churn Analysis - Predict customer churn risk

Development & Operations

  • Code Review - Automated PR feedback and suggestions
  • Log Analysis - Parse and summarize error logs
  • Incident Reports - Generate post-mortems from incident data

See 25+ examples: docs.relayplane.com/examples

Best Practices

1. Use Schemas for Structured Output

.step("extract", { schema: MySchema })
  .with("openai:gpt-4o")

Zod schemas provide type safety and validation.

2. Choose Models by Task

  • Complex reasoning: openai:gpt-4o, anthropic:claude-3.5-sonnet
  • Vision tasks: openai:gpt-4o-vision
  • Simple tasks: openai:gpt-4o-mini (cheaper, faster)
  • Code: anthropic:claude-3.5-sonnet

3. Chain Models for Validation

.step("extract").with("openai:gpt-4o")
.step("validate").with("anthropic:claude-3.5-sonnet").depends("extract")

Use a second model to verify critical data.

4. Handle Errors

try {
  const result = await relay.workflow("example")...run(input);
} catch (error) {
  console.error("Workflow failed:", error);
}

5. Optimize Costs

  • Use cheaper models (gpt-4o-mini) for non-critical steps
  • Cache results when possible
  • Minimize token usage with focused prompts

CLI Commands

# Authenticate with RelayPlane Cloud (optional)
npx relay login

# List discovered workflows in project
npx relay workflows

# Check cloud connection status
npx relay status

# Open web dashboard
npx relay dashboard

# Logout from cloud
npx relay logout

TypeScript Support

Full TypeScript support with type inference:

const InvoiceSchema = z.object({
  total: z.number(),
});

const result = await relay
  .workflow("example")
  .step("extract", { schema: InvoiceSchema })
  .with("openai:gpt-4o")
  .run(input);

// result.steps.extract is typed as z.infer<typeof InvoiceSchema>
result.steps.extract.total; // ✅ Type-safe

Upgrading from v2

The v3 API uses a fluent builder pattern. Migration guide:

v2 (deprecated):

const workflow = relay.workflow('name', [
  relay.step({ name: 'step1', model: 'gpt-4o', provider: 'openai' }),
]);

v3 (current):

const result = await relay
  .workflow('name')
  .step('step1').with('openai:gpt-4o')
  .run(input);

Documentation

Community

License

MIT © RelayPlane


Built with RelayPlane? Share your workflow on Twitter with #relayplane!