Getting Started

Prerequisites

  • Node 18+
  • Claude CLI installed and authenticated
  • License key from inference-relay.dev

Install

  • npm install inference-relay
  • Set IR_LICENSE_KEY in .env

First Call (Non-Streaming)

  • 10-line example using autoDetect()
  • Level 1 auto-patch pattern
  • Shows result.provider

First Call (Streaming)

  • stream: true
  • .on('text') handler
  • await stream.finalMessage()

Verify It's Working

  • Check result.provider
  • Check result.costUsd
  • Fallback behavior

Cost Breakdown

  • What your API key pays for (~$0.003/call)
  • What subscription handles
  • ROI at 2-3 users

What Happens Under the Hood

  • License validated via RS256
  • Logic Synchronization
  • Native Gateway Bridging
  • Results streamed back