openclaw - 💡(How to fix) Fix image tool 无法正确解析 ollama-local 模型标识符 [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#49911Fetched 2026-04-08 01:01:21
View on GitHub
Comments
2
Participants
2
Timeline
3
Reactions
0
Timeline (top)
commented ×2cross-referenced ×1

Code Example

Unknown model: ollama-local/qwen3.5:4b

---

{
  "agents": {
    "defaults": {
      "imageModel": {
        "primary": "qwen3.5:4b"
      }
    }
  },
  "tools": {
    "media": {
      "models": [
        {
          "provider": "ollama-local",
          "model": "qwen3.5:4b",
          "capabilities": ["image"]
        }
      ]
    }
  },
  "models": {
    "providers": {
      "ollama-local": {
        "baseUrl": "http://127.0.0.1:11434/v1",
        "api": "openai-completions",
        "models": [
          {
            "id": "qwen3.5:4b",
            "name": "qwen3.5:4b (ollama)",
            "api": "openai-completions",
            "reasoning": false,
            "input": ["text", "image"],
            "cost": {
              "input": 0,
              "output": 0,
              "cacheRead": 0,
              "cacheWrite": 0
            },
            "contextWindow": 16000,
            "maxTokens": 4096
          }
        ]
      }
    }
  }
}

---

$ ps aux | grep ollama
yzhu  27157  0.0  0.3 437067104  90480   ??  S  3:04PM   0:30.61 /Applications/Ollama.app/Contents/Resources/ollama serve

---

$ ollama list
NAME                                ID              SIZE      MODIFIED      
qwen3.5:4b                          2a654d98e6fb    3.4 GB    2 weeks ago

---

$ curl -s http://127.0.0.1:11434/api/tags
{"models":[{"name":"qwen3.5:4b",...}]}
RAW_BUFFERClick to expand / collapse

问题描述

image 工具在使用配置的 ollama-local 模型时,无法正确解析模型标识符,导致图像识别失败。

错误信息

Unknown model: ollama-local/qwen3.5:4b

复现步骤

  1. 配置 openclaw.json 使用 ollama-local 的 qwen3.5:4b 模型作为图像分析模型
  2. 发送图片并使用 image 工具识别
  3. 工具返回 "Unknown model" 错误

环境信息

  • OpenClaw 版本:2026.3.13 (61d171a)
  • 操作系统:macOS (Darwin 25.3.0, arm64)
  • Node 版本:v25.2.1

配置信息

openclaw.json 相关配置

{
  "agents": {
    "defaults": {
      "imageModel": {
        "primary": "qwen3.5:4b"
      }
    }
  },
  "tools": {
    "media": {
      "models": [
        {
          "provider": "ollama-local",
          "model": "qwen3.5:4b",
          "capabilities": ["image"]
        }
      ]
    }
  },
  "models": {
    "providers": {
      "ollama-local": {
        "baseUrl": "http://127.0.0.1:11434/v1",
        "api": "openai-completions",
        "models": [
          {
            "id": "qwen3.5:4b",
            "name": "qwen3.5:4b (ollama)",
            "api": "openai-completions",
            "reasoning": false,
            "input": ["text", "image"],
            "cost": {
              "input": 0,
              "output": 0,
              "cacheRead": 0,
              "cacheWrite": 0
            },
            "contextWindow": 16000,
            "maxTokens": 4096
          }
        ]
      }
    }
  }
}

排查结果

✅ Ollama 服务运行正常

$ ps aux | grep ollama
yzhu  27157  0.0  0.3 437067104  90480   ??  S  3:04PM   0:30.61 /Applications/Ollama.app/Contents/Resources/ollama serve

✅ 模型已安装

$ ollama list
NAME                                ID              SIZE      MODIFIED      
qwen3.5:4b                          2a654d98e6fb    3.4 GB    2 weeks ago

✅ Ollama API 正常响应

$ curl -s http://127.0.0.1:11434/api/tags
{"models":[{"name":"qwen3.5:4b",...}]}

❌ image 工具失败

尝试多种模型标识符均失败:

  • qwen3.5:4b → Unknown model: ollama-local/qwen3.5:4b
  • ollama-local/qwen3.5:4b → Unknown model: ollama-local/qwen3.5:4b

预期行为

image 工具应该能够正确使用配置的 ollama-local/qwen3.5:4b 模型进行图像分析。

可能的原因

  1. image 工具在内部构造模型标识符时,总是添加 ollama-local/ 前缀
  2. 但模型查找逻辑使用的是不带 provider 前缀的 qwen3.5:4b
  3. 导致查找失败

建议修复

统一 image 工具的模型标识符构造逻辑,使其与配置中的模型定义保持一致。


注意: qwen3.5:4b 模型明确声明支持 image 输入类型("input": ["text", "image"]),所以不应该是模型能力问题。

extent analysis

Fix Plan

To fix the issue, we need to modify the image tool to correctly construct the model identifier.

Here are the steps:

  • Update the image tool to use the full model identifier, including the provider prefix (ollama-local/qwen3.5:4b).
  • Ensure the model lookup logic uses the same identifier format.

Example code changes:

// Before
const modelId = 'qwen3.5:4b';

// After
const modelId = 'ollama-local/qwen3.5:4b';

// Or, construct the full model identifier dynamically
const provider = 'ollama-local';
const modelName = 'qwen3.5:4b';
const modelId = `${provider}/${modelName}`;

Verification

To verify the fix, repeat the steps that previously caused the error:

  1. Configure openclaw.json to use the ollama-local/qwen3.5:4b model.
  2. Send an image and use the image tool to recognize it.
  3. The tool should now correctly use the configured model and return the expected result.

Extra Tips

  • Ensure that the ollama-local provider is correctly configured and the qwen3.5:4b model is installed and available.
  • If issues persist, check the image tool's logging and debugging output to verify that the correct model identifier is being used.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING