Edge-native parallel LLM orchestration on Cloudflare Workers. Run multiple AI models in parallel, merge their outputs with consensus, and get back typed results.
Built on Cloudflare Durable Objects for extreme durability and idempotency. Each job orchestrates parallel model calls using Effect for true concurrency at the edge.
This repository contains:
packages/ditto-ai/- npm package for LLM orchestrationsrc/- SvelteKit demo & docs deployed toditto.coey.dev
bun add ditto-ai
npm install ditto-aiimport { dittoClient } from "ditto-ai";
const ditto = dittoClient({
endpoint: "https://your-worker.workers.dev/llm",
});
const response = await ditto({
prompt: "Summarize this email…",
models: [
"@cf/meta/llama-3.1-8b-instruct",
"@cf/mistral/mistral-7b-instruct"
],
strategy: "consensus",
});
console.log(response.result); // merged output
console.log(response.structured); // intent, confidence, supporting models- Parallel RPC orchestration – Effect.all with unbounded concurrency for true parallelism
- Durable Object orchestration – per-job state management with idempotency
- Unlimited concurrency – scale to 100+ concurrent models per request
- Consensus merging – intelligent combination with confidence scoring
- Structured analysis – intent classification, hallucination detection
- Performance timings – track total, fanout, slowest model, and merge time
- Type safety – full TypeScript support
- Individual responses – inspect each model's output
- Error handling – typed
DittoErrorwith HTTP status codes
- Full API Reference: Visit
/docson the demo site - Package README: See packages/ditto-ai/README.md
- Examples: In packages/ditto-ai/README.md
# Install dependencies
bun install
# Run dev server
bun run dev
# Build package
bun run -f packages/ditto-ai build
# Build & deploy
bun run deployThis project uses Alchemy for Cloudflare deployment.
bun run deployThe demo app is deployed to ditto.coey.dev (see alchemy.run.ts).
MIT