Install

npm install conductor-sdk

Declare a route

import { route, type Rule, type Model } from 'conductor-sdk';

const models: Model[] = [
  { name: 'gpt-4o-mini', costPer1M: 0.75 },
  { name: 'gpt-4o',      costPer1M: 15.0 },
];

const rules: Rule[] = [
  { when: 'summarize', routeTo: 'gpt-4o-mini', priority: 10 },
  { when: 'analyze',   routeTo: 'gpt-4o',      priority: 10 },
];

const { model } = route('summarize this document', rules);
// → model === 'gpt-4o-mini'

Schema validation

Every routing declaration is validated against a Zod schema at load time. Missing fields, unknown model identifiers, unset constraints, and empty fallback chains are surfaced synchronously — not at the first traffic spike. Type errors appear in your editor; structural errors appear in your build log. Either way, bad declarations never reach the routing engine.