Skip to content

OpenRouter models missing from static snapshot silently drop images #45867

@DJjjjhao

Description

@DJjjjhao

Symptom

Using openrouter/healer-alpha (a vision-capable model), sending an image
via Feishu/tool results — the model says "the image is too dark" or "can't see the content"
because it literally never received the image data.

Root cause

When an OpenRouter model is not in the static snapshot
(models.generated.ts), resolveModelWithRegistry falls back to
input: ["text"]. This causes two independent filters to drop images:

  1. detectAndLoadPromptImages checks model.input.includes("image")
    → returns empty, no image loaded into user message
  2. openai-completions.js convertMessages checks
    model.input.includes("image") → strips image blocks from tool results

Both are silent — no error, no warning. The model receives
"Read image file [image/jpeg]" as plain text with no actual image data.

Evidence

Captured the actual API request sent to OpenRouter for the same image,
same query:

With fallback input: ["text"] (current behavior):

{"role":"tool","content":"Read image file [image/jpeg]","tool_call_id":"2e8b1f235"}
// No user message with image_url follows — images silently dropped

With correct input: ["text","image"]:

{"role":"tool","content":"Read image file [image/jpeg]","tool_call_id":"call091c1c3ac38a4c6997ed9998"},
{"role":"user","content":[
  {"type":"text","text":"Attached image(s) from tool result:"},
  {"type":"image_url","image_url":{"url":"data:image/jpeg;base64,..."}}
]}

Why this keeps happening

The built-in model list is a static snapshot baked at build time:

  1. OpenRouter adds a new model
  2. Someone manually runs npm run generate-models in pi-mono
  3. pi-ai publishes to npm
  4. openclaw updates the dependency and releases
  5. User updates openclaw

No step is automated. Until the full chain completes, every new model
is silently broken for vision use.

Proposed fix

OpenRouter provides a public API (/api/v1/models) that returns model
capabilities in real time — ~465KB, under a second, no auth required.
A lightweight runtime lookup with disk + in-memory caching eliminates this
entire dependency chain at minimal cost.

See #45824 for implementation — tested end-to-end with healer-alpha
successfully receiving and describing images after the fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions