Compare (Multi-model)

View as Markdown

Compare (Multi-model Fanout)

Fire one prompt at several models and stream their replies in parallel.

1const stream = client.compare.create({
2 models: [
3 "openai/gpt-4o-mini",
4 "anthropic/claude-sonnet-4.5",
5 "google/gemini-2.5-flash",
6 ],
7 messages: [{ role: "user", content: "Summarize this paragraph in one sentence: ..." }],
8 stream: true,
9});
10
11for await (const event of stream) {
12 if (event.event === "delta") {
13 console.log(event.data);
14 }
15}

Use non-streaming compare with an optional judge-model comparison via comparison_model.