OpenRouter Chat icon

OpenRouter Chat

Send chat completion requests to OpenRouter. Supports multimodal content (images, video URLs), reasoning control, provider preferences, plugins (web search, web fetch), structured outputs, and full conversation history.

OpenRouter Chat

AI-generated

Summary

Send a chat completion request to OpenRouter using the selected model and configured conversation messages. Optionally add images or video, tune generation and reasoning, control provider routing and plugins, request a fallback model, and choose how much of the response to return.

Inputs

  • Model (required) — OpenRouter model ID for the request.
  • Messages (required) — One or more conversation messages with a system, user, assistant, developer, or tool role. Text supports expressions; user and assistant messages can include an image URL, and user messages can include a video URL. Tool messages use a tool call ID and response content.
  • Generation Options — Optional sampling controls, token limit, seed, stop sequences, service tier, or constrained response format (text, JSON object, JSON Schema, or grammar).
  • Reasoning — Optional reasoning effort and summary settings for supported models.
  • Provider Preferences — Optional provider order, sorting, fallback, data handling, quantization, parameter support, and prompt or completion price limits.
  • Plugins — Optional OpenRouter web search, web fetch, PDF parsing, context compression, auto-router, or response healing plugins.
  • Output Options — Choose the full API response or a simplified result, and whether to include usage statistics or reasoning.
  • Fallback Options — Optionally retry with a fallback model if the primary request or its response fails.

Output shape

One output item per input item, each containing a JSON object.

By default, each object includes content, model, and finish_reason, with tool_calls when present; fallback use is marked, and usage or reasoning is included only when selected and available. Return Full API Response instead returns the API response object, adding fallback metadata when applicable. If Continue On Fail is enabled, a failed item yields {"error": "..."}; otherwise the operation throws. At least one message is required.

Links

Discussion