Skip to content

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

Closed as not planned

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

Activity

  1. github-actions commented on May 16, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

  2. mrlunchbox777 commented on May 19, 2026

    @mrlunchbox777

    I've seen this same issue if it doesn't meet the exact schema. It'd be helpful to optionally strip this extra metadata. Specifically, I was able to reproduce with a custom provider (@ai-sdk/openai-compatible with an api, gpt-5 and gpt-5.5, that failed with any extra fields). GET /models and direct POST /chat/completions would work, but once it started using the OpenCode request path it would fail (Invalid request format).

  3. github-actions commented on Jul 19, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions