🧭

Styrr

@carloscortezcloud/styrr-llm

Multi-model LLM router with automatic ordered fallback. If your primary model rate-limits, crashes, or returns 402 — Styrr silently switches to the next model in your chain. Zero config. Zero dependencies.

Install
npm install @carloscortezcloud/styrr-llm

Features

Ordered Fallback

Try models in sequence. Skip 429 (rate limit), 404 (removed), 402 (no credits). Fail fast on 401 (auth).

Tool Calling

Pass tool schemas, get structured tool_calls back. Normalizes camelCase ↔ snake_case automatically.

Any Provider

OpenRouter, OpenAI, Bedrock, NVIDIA, Ollama — anything with an OpenAI-compatible API.

Hooks

onFallback, onAllFailed callbacks for observability and logging.

Usage

import { StyrRouter } from '@carloscortezcloud/styrr-llm';

const router = new StyrRouter({
  apiKey: process.env.OPENROUTER_API_KEY,
  models: [
    { id: 'nvidia/nemotron-3-ultra-550b:free' },
    { id: 'google/gemma-4-31b-it:free' },
    { id: 'meta-llama/llama-3.3-70b-instruct:free' },
  ],
  onFallback: (model, error, next) => console.log(`${model} failed → ${next}`),
});

const result = await router.call([
  { role: 'user', content: 'Explain FinOps in 2 sentences' }
]);

console.log(result.text);       // "FinOps is..."
console.log(result.modelUsed);  // which model responded
console.log(result.latencyMs);  // total time
GitHub →npm →Demo →

When to Use Styrr

vs Other Approaches

StyrrManual try/catchLiteLLM
Fallback logicBuilt-inYou write itBuilt-in
Dependencies00Many
Edge-compatible✗ (Python)
Tool normalization✓ autoManual
Bundle size~250 lines~50 linesLarge

Works With

Tinkuy AgentStrands Agents (via adapter)LangChain (via ChatModel)CF WorkersDenoBunNode.js