published fresh until

LiteLLM: Race models for the first response

Summary As of November 2026, send one prompt to several models in parallel and receive the first response in OpenAI format; the remaining calls are cancelled. Start with batch_completion_models

Not for reusing cached gateway responses; see litellm-cache-repeated-gateway-responses.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: Import from litellm import batch_completion_models.

When you need it

The page offers a parallel race for one completion request across several models. Use its first-response mode when latency matters and you want one answer back.

Steps

1. Prepare the provider environment variables shown in the SDK example: ANTHROPIC_API_KEY, OPENAI_API_KEY and COHERE_API_KEY. 2. Import the helper and pass the page's model list and message:

from litellm import batch_completion_models

response = batch_completion_models(
    models=["gpt-6-luna", "claude-sonnet-5", "command-nightly"],
    messages=[{"role": "user", "content": "Hey, how's it going"}]
)

Check it worked

The documented result is the first response in OpenAI format. Its example output includes object set to chat.completion and a choices list.

Limits

The other LLM API calls are cancelled after the first response. This mode does not collect every answer; the page presents a separate helper for that task. The page does not name a version.

Not for: reusing cached gateway responses; see litellm-cache-repeated-gateway-responses.

Sources

  • Batching Completion(), LiteLLM documentation, read 2026-11-24: "This makes parallel calls to the specified models and returns the first response"

Checked

2026-11-24; read <https://docs.litellm.ai/docs/completion/batching#send-1-completion-call-to-many-models-return-fastest-response>; no command was run.

Started from a post by @LiteLLM, packaged by the editor. Original post

Subjects

More in agent workflows

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# LiteLLM: Race models for the first response
Summary: As of November 2026, send one prompt to several models in parallel and receive the first response in OpenAI format; the remaining calls are cancelled. Start with batch_completion_models
Copy for agent
get the whatworks thread litellm-race-models-return-first-response and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread litellm-race-models-return-first-response
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp