Skip to content

[Bug] 使用 Ollama 本地模型时,所有请求都会失败并报错:"模型名称 does not support thinking"。即使将 think 路由设置为空字符串或禁用也无法解决。Ollama models fail with "does not support thinking" error in v2.0.58 #1046

Description

@wusunzu

Bug Report: Ollama Models Failing with "does not support thinking" Error

Environment

  • OS: Windows 11
  • CCR Version: v2.0.58
  • Node Version: (run node -v to get this)
  • Ollama Version: Latest
  • Models: qwen2.5:14b, qwen2.5-coder:7b, deepseek-r1:7b

Description

When using Ollama local models with claude-code-router, all requests fail with error: "model_name does not support thinking". This happens even when the think router is set to empty string or disabled.

使用 Ollama 本地模型时,所有请求都会失败并报错:"模型名称 does not support thinking"。即使将 think 路由设置为空字符串或禁用也无法解决。

Steps to Reproduce

  1. Install claude-code-router v2.0.58:

    npm install -g @musistudio/claude-code-router@2.0.58
  2. Configure ~/.claude-code-router/config.json:

    {
      "Providers": [
        {
          "name": "ollama",
          "api_base_url": "http://localhost:11434/v1/chat/completions",
          "api_key": "ollama",
          "models": ["qwen2.5:14b"],
          "request_overrides": {
            "tool_choice": "none"
          }
        }
      ],
      "Router": {
        "default": "ollama,qwen2.5:14b",
        "think": ""
      }
    }
  3. Start the service:

    ccr start
    ccr code
  4. Send any message (e.g., "Hello")

Expected Behavior

The model should respond normally, as Ollama models work fine with direct API calls and other tools like Continue VSCode extension.

模型应该正常响应,因为 Ollama 模型在直接 API 调用和其他工具(如 Continue VSCode 扩展)中都能正常工作。

Actual Behavior

Every request fails with:

API Error: 400 {"error":{"message":"Error from provider(ollama,qwen2.5:14b: 400): 
{\"error\":{\"message\":\"\\\"qwen2.5:14b\\\" does not support thinking\",
\"type\":\"api_error\",\"param\":null,\"code\":null}}"}}

Additional Context

  • Tested with multiple models: qwen2.5:14b, qwen2.5-coder:7b, deepseek-r1:7b - all fail
  • Direct Ollama API calls work fine: ollama run qwen2.5:14b works normally
  • Tried various config options:
    • Setting "think": "" (empty string)
    • Setting "think": "ollama,qwen2.5:14b" (same model)
    • Adding "thinking": {"type": "disabled"} to request_overrides
    • Adding "tools": null to request_overrides
    • None of these resolve the issue

尝试了多种配置选项均无法解决:

  • think 设为空字符串
  • request_overrides 中添加各种禁用选项
  • 所有配置都无法解决问题

Root Cause Analysis

It appears that v2.0.58 force-enables the extended thinking feature for all requests, even when:

  1. The think router is empty
  2. The provider explicitly disables it
  3. The model doesn't support Claude's extended thinking API

看起来 v2.0.58 版本强制启用了 extended thinking 功能,即使在以下情况下也会尝试使用:

  1. think 路由为空
  2. Provider 明确禁用
  3. 模型不支持 Claude 的 extended thinking API

Suggested Fix

Add a global flag to completely disable extended thinking for providers that don't support it:

建议添加全局标志来完全禁用不支持的功能:

{
  "Providers": [
    {
      "name": "ollama",
      "capabilities": {
        "thinking": false,
        "tools": false
      }
    }
  ]
}

Or detect provider capabilities automatically and skip unsupported features.

或者自动检测 Provider 的能力并跳过不支持的功能。

Workaround

Currently no workaround exists. Users with Ollama models cannot use v2.0.58.

目前没有可用的解决方法。使用 Ollama 模型的用户无法使用 v2.0.58 版本。

Potential temporary solution: Downgrade to an earlier version (if available).

可能的临时解决方案:降级到早期版本(如果可用)。


Hardware: Lenovo Y9000P, RTX 4060 (8GB VRAM)
Use Case: Local AI development without API costs

Thank you for this amazing project! Looking forward to Ollama support being fixed. 🙏

感谢这个出色的项目!期待 Ollama 支持问题能够得到修复。🙏

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions