Skip to content

ryzeagent/ai-cascade

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

92 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ai-cascade

Multi-model AI cascade for structured output generation. Tries the fastest model first, falls back through the chain until a valid response is obtained.

Used in ryze-agent to power the verdict and analytics endpoints.

Model chain

Claude Haiku → GLM 4.5 Air → DeepSeek R1 → DeepSeek V3

Fastest first. Cheapest first. Falls through only on timeout or invalid output.

Usage

import { cascade } from "ai-cascade";

const { result, model_used, latency_ms } = await cascade(
  "Analyze this token: ...",
  (r) => r.includes("signal")
);

Config

Env var Default Description
OPENROUTER_API_KEY Your OpenRouter API key
CASCADE_TIMEOUT_MS 8000 Per-model timeout

License

MIT

About

Multi-model AI cascade for structured output generation with fallback and confidence scoring

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors