The OpenRouter vision API accepts images and PDFs through compatible models. This guide covers request structure, document evidence, privacy, and checks for misread charts or tables.

One gateway for multimodal inputs

OpenRouter can send image and document inputs to compatible vision-capable models. The API shape is familiar, but support, file limits, pricing, and provider behavior vary. Choose a model by required modality and validate the live catalog before processing a real workload.

Checked October 15, 2026: review the current image-input and PDF documentation.

Analyze an image URL

{
 "model":"google/gemini-2.5-pro",
 "messages":[{
  "role":"user",
  "content":[
   {"type":"text","text":"Describe the chart and list any uncertainty."},
   {"type":"image_url","image_url":{"url":"https://example.com/chart.png"}}
  ]
 }],
 "max_tokens":400
}

Use a stable HTTPS URL the provider can fetch, or follow current docs for supported inline/data formats. Never place a private URL in a prompt unless access and retention have been reviewed.

Python request

import os, requests, json
payload = json.loads(r'''
{
 "model":"google/gemini-2.5-pro",
 "messages":[{
  "role":"user",
  "content":[
   {"type":"text","text":"Describe the chart and list any uncertainty."},
   {"type":"image_url","image_url":{"url":"https://example.com/chart.png"}}
  ]
 }],
 "max_tokens":400
}
''')
r=requests.post(
 "https://openrouter.ai/api/v1/chat/completions",
 headers={"Authorization":f"Bearer {os.environ['OPENROUTER_API_KEY']}",
          "Content-Type":"application/json"},
 json=payload,timeout=(10,90))
r.raise_for_status()
data=r.json()
print(data["choices"][0]["message"]["content"])
print(data.get("usage"))

PDF workflow

For a PDF, first decide whether you need page text, visual layout, tables, handwriting, or charts. Text-only extraction is cheaper and more deterministic when layout is irrelevant. Use multimodal PDF understanding when page structure and visuals affect the answer.

  1. Validate file type, size, page count, and malware policy.
  2. Choose a compatible model and provider.
  3. State the task and expected output clearly.
  4. Ask for page references or evidence.
  5. Validate the response against extracted text or known fields.
  6. Store only the minimum required source and result.

Prompts that reduce hallucination

Use only the attached document.
For every claim, include the page number.
If a value is unreadable, return null and explain why.
Return JSON with: summary, claims[], uncertainties[].

A model can still misread a small label or merge table rows. For invoices, contracts, or compliance records, validate critical fields with deterministic extraction or human review.

Image detail and token cost

Large or high-detail images can increase latency and cost. Crop to the relevant region, resize responsibly, and avoid sending repeated pages across turns. Track prompt tokens and cost from the response rather than estimating from file size alone.

Privacy checklist

  • Remove unnecessary personal data.
  • Use approved providers and data policies.
  • Do not expose private file URLs.
  • Set retention and deletion rules.
  • Keep the API key server-side.
  • Log metadata, not document contents.

Troubleshooting

Problem Likely cause Fix
Unsupported content type Model/provider lacks modality Use the catalog capability filter
Fetch failed URL inaccessible or expired Use a stable supported upload method
Wrong table values Complex layout or low resolution Crop pages and validate fields
Context too large Too many pages/images Chunk by section and aggregate

OpenRouter vision API FAQ

Can every OpenRouter model see images?

No. Filter by modality and test the exact provider route.

Should I send the whole PDF?

Only when the task requires global context. Otherwise select relevant pages or extract text first.

Read next

See structured outputs, routing, and the complete guide.

Official references

Documentation reviewed 15 October 2026. Examples illustrate the request pattern; confirm model availability and account settings before use. No uptime or performance benchmark is claimed.

Similar Posts