Skip to content

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

@graham33

Description

@graham33

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingnix

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions