openrouter-multimodal
v4.5.1Chat with 300+ LLMs via OpenRouter.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
chat_completion
Send messages to an OpenRouter model and get a text response. Supports provider routing (quantizations / ignore / sort / order / require_parameters / data_collection / allow_fallbacks), model variant suffixes (`:nitro` fastest, `:floor` cheapest, `:exacto` tool-calling accuracy), reasoning token passthrough, web search, and response caching. Fails when: - INVALID_INPUT: messages array is empty - UPSTREAM_REFUSED: provider rejected the request (credits, content policy, or rate limit) - UPSTREAM_TIMEOUT: upstream did not respond within the SDK timeout - MODEL_NOT_FOUND: model slug does not exis…
| Parameter | Type | Description |
|---|---|---|
messages * | array | |
cache | boolean | Enable OpenRouter response caching via `X-OpenRouter-Cache: true`. Server-wide default settable via `OPENROUTER_CACHE_RESPONSES=1`. |
cache_clear | boolean | Bust the cache entry for this exact request. |
cache_ttl | string | Cache TTL (e.g. `"5m"`, `"1h"`, `"24h"`; 1s-24h range). |
include_reasoning | boolean | Surface the model's chain-of-thought on `_meta.reasoning` for R1 / Opus 4.7 / Gemini Thinking. |
max_tokens | number | Max completion tokens. Falls back to `OPENROUTER_MAX_TOKENS` env var if unset. |
model | string | Model ID (optional, uses default). Append `:nitro` for the fastest variant, `:floor` for the cheapest, or `:exacto` for the best tool-calling accuracy. Example: `openai/gpt-4o:nitro`. |
online | boolean | Enable OpenRouter's web-search plugin (Exa-backed, $4 / 1000 results). |
provider | object | OpenRouter provider-routing overrides. Merges on top of `OPENROUTER_PROVIDER_*` env defaults. See https://openrouter.ai/docs/features/provider-routing |
temperature | number | |
web_max_results | number | Max web-search results when `online: true` (default 5). |
analyze_image
Analyze an image with a vision model. Accepts local file paths, http(s) URLs, or base64 data URLs. Output is model-generated and tagged `_meta.content_is_untrusted: true`. Fails when: - INVALID_INPUT: image_path missing or malformed - UNSAFE_PATH: local path escaped the sandbox - RESOURCE_TOO_LARGE: image exceeded configured fetch size cap - UPSTREAM_REFUSED: provider SSRF guard blocked the URL or content policy rejected Works with: search_models (find vision-capable models), generate_image (follow-up creation).
| Parameter | Type | Description |
|---|---|---|
image_path * | string | File path, URL, or data URL |
cache | boolean | |
cache_clear | boolean | |
cache_input | boolean | Attach `cache_control: ephemeral` to the image block so Anthropic / Gemini prompt-cache it. Repeat questions about the same image save ~10x on Anthropic. |
cache_ttl | string | |
model | string | |
question | string | Question about the image |
analyze_audio
Transcribe or analyze an audio file (WAV / MP3 / FLAC / OGG / etc.) using a multimodal model. Output is tagged `_meta.content_is_untrusted: true`. Fails when: - INVALID_INPUT: audio_path missing - UNSUPPORTED_FORMAT: decoder could not identify the file as audio - RESOURCE_TOO_LARGE: input exceeded size cap - UPSTREAM_REFUSED: blocked host or content policy Works with: generate_audio (text-to-speech follow-up).
| Parameter | Type | Description |
|---|---|---|
audio_path * | string | File path, URL, or data URL (base64-encoded audio) |
cache | boolean | |
cache_clear | boolean | |
cache_input | boolean | |
cache_ttl | string | |
model | string | |
question | string | Question or instruction about the audio (default: transcribe) |
analyze_video
Describe or analyze a video (mp4 / mpeg / mov / webm) using a multimodal model. Default model: google/gemini-2.5-flash. Output is tagged `_meta.content_is_untrusted: true`. Fails when: - INVALID_INPUT: video_path missing - UNSUPPORTED_FORMAT: not a recognized video container - RESOURCE_TOO_LARGE: exceeds fetch cap - UPSTREAM_REFUSED: SSRF block or provider refusal Works with: generate_video (text-to-video), get_video_status (poll async jobs).
| Parameter | Type | Description |
|---|---|---|
video_path * | string | File path, HTTP(S) URL, or base64 data URL. Supported: mp4 / mpeg / mov / webm. |
cache | boolean | |
cache_clear | boolean | |
cache_input | boolean | |
cache_ttl | string | |
model | string | |
question | string |
search_models
Search OpenRouter's model catalog by name, provider, or capability. Returns a paginated list; use `offset` / `limit` / `next_offset` to page through. Fails when: - UPSTREAM_HTTP: /models endpoint returned an error - UPSTREAM_REFUSED: invalid API key Works with: validate_model, get_model_info.
| Parameter | Type | Description |
|---|---|---|
capabilities | object | |
limit | number | |
offset | number | |
provider | string | |
query | string |
get_model_info
Get pricing / context-length / capability details for a specific model id. Fails when: - INVALID_INPUT: model not provided - MODEL_NOT_FOUND: model slug does not exist - UPSTREAM_HTTP: model list fetch failed Works with: search_models (discover ids), validate_model (cheap existence check).
| Parameter | Type | Description |
|---|---|---|
model * | string |
validate_model
Check whether a model id exists on OpenRouter. Cheap boolean lookup against the cached catalog. Fails when: - INVALID_INPUT: model not provided - UPSTREAM_HTTP: catalog refresh failed Works with: get_model_info (detailed lookup), chat_completion (pre-flight validation).
| Parameter | Type | Description |
|---|---|---|
model * | string |
generate_image
Generate an image from a text prompt. Optional reference images condition the output for style / identity consistency. Default model: google/gemini-2.5-flash-image. Fails when: - INVALID_INPUT: prompt empty, bad aspect_ratio / image_size, unreadable reference image - UNSAFE_PATH: save_path or input_images path escaped the sandbox - UPSTREAM_REFUSED: provider content policy rejected or insufficient credits - MODEL_NOT_FOUND: model slug invalid Works with: analyze_image (verify the result), generate_video_from_image (next step in workflow).
| Parameter | Type | Description |
|---|---|---|
prompt * | string | |
aspect_ratio | string | |
image_size | string | |
input_images | array | |
max_tokens | number | |
modalities | array | |
model | string | |
save_path | string |
generate_audio
Generate audio (speech / music) from a text prompt. Format auto-detected, extension auto-corrected. Fails when: - INVALID_INPUT: prompt empty - UNSAFE_PATH: save_path escaped the sandbox - UPSTREAM_REFUSED: content policy or credit issues Works with: analyze_audio (verify the result).
| Parameter | Type | Description |
|---|---|---|
prompt * | string | |
format | string | |
model | string | |
save_path | string | |
voice | string |
generate_video
Generate a video from a text prompt (optionally conditioned on first/last-frame or reference images). Submits an async job, polls until completion or max_wait_ms, and downloads the result. Emits MCP progress notifications when the client provides a `progressToken`. Default model: google/veo-3.1. Fails when: - INVALID_INPUT: prompt empty - UNSAFE_PATH: save_path or reference image paths escaped the sandbox - UPSTREAM_REFUSED: content policy, credits, or bad request - JOB_FAILED: provider marked the job as failed - UNSUPPORTED_FORMAT: reference/frame image could not be decoded Returns successf…
| Parameter | Type | Description |
|---|---|---|
prompt * | string | |
aspect_ratio | string | |
duration | number | |
first_frame_image | string | |
last_frame_image | string | |
max_wait_ms | number | |
model | string | |
poll_interval_ms | number | |
provider | object | |
reference_images | array | |
resolution | string | |
save_path | string | |
seed | number |
generate_video_from_image
Narrower convenience wrapper around generate_video for image-to-video workflows. Takes a single `image` argument (used as the first frame) and `prompt`. Per arxiv 2511.03497, narrower tools with fewer parameters improve tool-call hit rate. For last-frame conditioning or reference images, use generate_video directly. Fails when: - INVALID_INPUT: image or prompt missing - UNSAFE_PATH: image path escaped the sandbox - UPSTREAM_REFUSED / JOB_FAILED: same as generate_video Returns successfully with `_meta.code: JOB_STILL_RUNNING` on timeout (resumable via get_video_status). Works with: generate_…
| Parameter | Type | Description |
|---|---|---|
image * | string | First-frame image (path, URL, or data URL). Required. |
prompt * | string | |
aspect_ratio | string | |
duration | number | |
max_wait_ms | number | |
model | string | |
poll_interval_ms | number | |
resolution | string | |
save_path | string | |
seed | number |
get_video_status
Poll an async video-generation job by id. Downloads the result when complete (and saves if save_path given). Fails when: - INVALID_INPUT: video_id missing - UNSAFE_PATH: save_path escaped the sandbox - JOB_FAILED: provider marked the job as failed Returns successfully with `_meta.code: JOB_STILL_RUNNING` (NOT an error) when the job is still in flight — response carries `_meta.last_status` and `_meta.progress` so callers can retry later. Works with: generate_video, generate_video_from_image.
| Parameter | Type | Description |
|---|---|---|
video_id * | string | |
save_path | string |
rerank_documents
Re-order a list of documents by relevance to a query using an OpenRouter reranker. Default model: cohere/rerank-english-v3.0. Fails when: - INVALID_INPUT: query missing, documents empty, non-string document elements - MODEL_NOT_FOUND: reranker model slug does not exist - UPSTREAM_HTTP: provider returned an error Works with: search_models (discover rerankers), chat_completion (answer grounded in top-ranked docs).
| Parameter | Type | Description |
|---|---|---|
documents * | array | |
query * | string | |
model | string | |
return_documents | boolean | |
top_n | number |
health_check
Verify API-key validity, OpenRouter reachability, and return server + protocol versions. No args. Fails when: never returns an error result — always returns `{ ok, api_key_valid, ... }` so ops can programmatically branch on the payload. Works with: every other tool (run once at startup to confirm credentials).