Skip to main content
A minimal example showing cascadeflow’s speculative cascade with two OpenAI models.

Setup

Code

How It Works

  1. gpt-4o-mini (draft model) handles the query first
  2. Quality validation checks the response
  3. If quality passes, the draft response is returned (60-70% of queries)
  4. If quality fails, gpt-4o (verifier model) handles the query
  5. Cost tracking reports per-query and aggregate metrics

TypeScript

Source

examples/basic_usage.py