Skip to content

github-copilot/kimi-k2.7-code: reasoning_effort sent to endpoint that rejects it #37728

Description

@onlyonec

Copilot advertises reasoning_effort support for kimi-k2.7-code via its live /models API. OpenCode builds a high reasoning variant from that data and sends reasoning_effort on every chat/completions request to the Kimi endpoint. The endpoint rejects it:

reasoning_effort "high" was provided, but model kimi-k2.7-code does not support reasoning effort

What's happening

The variant builder in packages/opencode/src/plugin/github-copilot/models.ts creates a high variant unconditionally from the live API advertisement:

const efforts = remote.capabilities.supports.reasoning_effort; // ["high"] — non-empty
if (!isMsgApi && efforts?.length) {
  efforts.forEach(effort => variants[effort] = {reasoningEffort: effort, ...});
}

Copilot's metadata endpoint says the model supports reasoning, but its own chat endpoint rejects it. That's a data inconsistency on Copilot's side. OpenCode can't fix that. What it can do is respect its own configured constraints.

Two things prevent a config-level fix:

  1. Variant generation ignores capabilities.reasoning. Setting "reasoning": false or "capabilities": { "reasoning": false } in opencode.json changes the model's capabilities.reasoning field but doesn't stop the variant from being built — the variant loop reads the live API, not the resolved capabilities object.

  2. The copilot send path doesn't gate on capabilities.reasoning. Unlike the generic OpenAI transform (OpenAIChat.lowerOptions), which checks capabilities.reasoning and returns early if false, the copilot chat/completions path sends reasoning_effort regardless. So even if the capability is correctly set to false, the parameter still goes out.

To reproduce

opencode run --model github-copilot/kimi-k2.7-code "reply with OK"

Suggested fix

Gate variant generation on the resolved capabilities.reasoning in the model builder. If the model's (possibly user-overridden) capabilities.reasoning is false, skip building effort variants — even if the live API advertises them.

Alternatively (or additionally), gate the copilot send path on capabilities.reasoning like the generic path already does.

Related

Models.dev lists reasoning: true with reasoning_options: [] for this model. That's worth correcting too, but even after fixing models.dev, OpenCode would still read the live Copilot API and rebuild the variant — so this needs a code fix.

OpenCode version: 1.18.1
OS: macOS

Workaround: a chat.params hook plugin that deletes reasoningEffort from the outgoing options for this model.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

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