opencode icon indicating copy to clipboard operation
opencode copied to clipboard

Kimi-K2 via OpenRouter fails with tool call tokens inside thinking block

Open graham33 opened this issue 1 day ago • 1 comments

Description

When using Kimi-K2 via OpenRouter with a recent OpenCode (1.1.21), I see tool call tokens in thinking sections, and the tool stops before I get a useful response.

kimi-k2-session.txt

Plugins

No response

OpenCode version

1.1.21

Steps to reproduce

Given the following prompt:

what is the tech stack of this project?

I get this thinking output in the UI:

Thinking: I'll analyze the tech stack of this project by examining the configuration files and codebase structure. <|tool_calls_section_begin|> <|tool_call_begin|> functions.bash:0 <|tool_call_argument_begin|> {"command": "ls -la", "description": "List files in current directory"} <|tool_call_end|> <|tool_call_begin|> functions.glob:1 <|tool_call_argument_begin|> {"pattern": "/.json"} <|tool_call_end|> <|tool_call_begin|> functions.glob:2 <|tool_call_argument_begin|> {"pattern": "/.{js,ts,jsx,tsx}"} <|tool_call_end|> <|tool_call_begin|> functions.glob:3 <|tool_call_argument_begin|> {"pattern": "/*.{py,java,go,rs,c,cpp}"} <|tool_call_end|> <|tool_calls_section_end|

Screenshot and/or share link

Image

Operating System

NixOS unstable

Terminal

kitty

graham33 avatar Jan 16 '26 09:01 graham33