Skip to content

[Bug] Console Go gateway rejects OpenAI-compatible client metadata with extra inputs are not permitted (strict schema, extra="forbid") #43089

Closed as not planned

Description

@PeterSongLin

Description

Describe the bug

The OpenCode "Console Go" API gateway (https://opencode.ai/zen/go/v1) validates the messages array with a strict schema (pydantic extra="forbid" behavior). Any non-standard field attached to a message is rejected with HTTP 400:

[invalid_request_error] Extra inputs are not permitted, field: 'messages[1].agent', value: 'cli'

This breaks interoperability with OpenAI-compatible clients that attach extra metadata to messages (e.g. agent, reasoning, messageId, model, traceId, usage, extra_fields, etc.). Standard OpenAI-compatible behavior is to ignore unknown fields, not reject them.

To Reproduce

Send a minimal chat completion, then the same request with one extra field:

# 1) Clean payload -> HTTP 200 (model, key, format all fine)
curl https://opencode.ai/zen/go/v1/chat/completions \
  -H "Authorization: Bearer $OPENCODE_KEY" -H "Content-Type: application/json" \
  -d '{"model":"glm-5.2","messages":[{"role":"user","content":"hi"}],"max_tokens":16,"stream":false}'

# 2) Same request + one extra field on a message -> HTTP 400
curl https://opencode.ai/zen/go/v1/chat/completions \
  -H "Authorization: Bearer $OPENCODE_KEY" -H "Content-Type: application/json" \
  -d '{"model":"glm-5.2","messages":[{"role":"user","content":"hi"},{"role":"assistant","content":"hello","agent":"cli"}],"max_tokens":16,"stream":false}'
# -> 400 {"error":{"message":"Error from provider (Console Go): ... Extra inputs are not permitted, field: 'messages[1].agent', value: 'cli'"}}

Expected behavior

OpenAI-compatible endpoints should tolerate and ignore unknown message fields, so clients that attach metadata (agent ids, tracing, reasoning flags) keep working. The request in step 2 should return 200 like step 1.

Actual behavior

HTTP 400 with Extra inputs are not permitted for any non-standard field on any message.

Environment

  • Gateway: https://opencode.ai/zen/go/v1 (Console Go)
  • Model: glm-5.2
  • Client: WorkBuddy App 5.3.13 (sends requests via its backend, which attaches internal metadata fields)
  • Observed on: macOS

Suggested fix

Relax the messages / message schema at the Console Go gateway to extra="allow" (ignore unknown fields), matching standard OpenAI-compatible server behavior. Optionally document which fields are required vs optional.

Additional context

This is not specific to one client — any OpenAI-compatible proxy/agent that forwards internal metadata will hit the same 400. A clean payload works perfectly (step 1 returns valid reasoning_content too), confirming auth + model + base format are correct; only the strict schema blocks it.

Plugins

No response

OpenCode version

No response

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Activity

  1. wgomg commented on Aug 17, 2026

    @wgomg

    Having this very same issue by passing the apikey as BYOK in other applications. Some models return the extra inputs are not permitted error while others return Your API key does not have permission to access this resource.

  2. github-actions commented on Oct 17, 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