Skip to content

Bug: 400 Error (Extra inputs not permitted) when sending 'reasoning' field in chat history for kimi-k2.6 #27852

@totoDoP

Description

@totoDoP

Description

I am encountering a 400 Bad Request error when using the kimi-k2.6 model via the OpenCode Go proxy. The error occurs
specifically on the second or third turn of a conversation (once history is being sent back to the model).

Error Message:
400 Error from provider: Extra inputs are not permitted, field: 'messages[X].reasoning'

Diagnosis:
My client preserves the reasoning/thinking blocks from previous turns and sends them back in the messages array
within a reasoning field to maintain context.

It appears the OpenCode Go API gateway has a strict schema validation that rejects any fields not explicitly defined
in the standard OpenAI Chat Completions schema. I have verified that connecting directly to the Moonshot AI API
(bypassing OpenCode Go) works perfectly, as the Moonshot API ignores the extra reasoning field.

Plugins

N/A

OpenCode version

OpenCode Go API

Steps to reproduce

  1. Use the kimi-k2.6 model via the OpenCode Go proxy.
  2. Start a conversation and let the model generate a reasoning block.
  3. Send a second message to continue the conversation.
  4. The request fails with a 400 error because the history now contains the reasoning field, which is rejected by the
    gateway validation.

Screenshot and/or share link

No response

Operating System

Windows 11

Terminal

pi.dev

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    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