Skip to content

OpenAI-compatible endpoint rejects standard \ efusal\ field and \image_url\ content blocks #43467

Closed as not planned

Description

@Cokedog320

Summary

The OpenAI-compatible endpoint (OpenCode Go) returns HTTP 400 on messages that conform to the standard OpenAI Chat Completions schema, specifically:

\\ ext
invalid_request_error:
Extra inputs are not permitted,
field: \messages[N].refusal,
value: None
\\

and:

\\ ext
Failed to deserialize the JSON body into the target type:
messages[N]: unknown variant \image_url, expected \ ext
\\

Root cause (analysis)


  1. efusal\ field
    — the OpenAI SDK automatically attaches
    efusal: None\ to every \�ssistant\ message. This is part of the standard OpenAI Chat Completions schema and is accepted by OpenAI's API and most compatible endpoints. The endpoint rejects it because its message deserializer does not permit unknown fields.

  2. \image_url\ content variant — a message \content\ can be either a plain string or an array of content blocks ({"type": "text", "text": ...}\ or {"type": "image_url", "image_url": ...}) per the standard OpenAI multimodal schema. The endpoint models \content\ as an enum with only a \ ext\ variant, so it rejects \image_url\ blocks.

Expected behavior

The endpoint should tolerate the standard OpenAI message schema:

  • Accept (and ignore) the
    efusal\ field on assistant messages.
  • Support the \image_url\ content-block variant, or at minimum degrade gracefully rather than failing the whole request.

Impact

Standard OpenAI-compatible clients (e.g. GitHub Copilot App BYOK) cannot be used against this endpoint without errors, even though the same request works against the official OpenAI API and other compatible endpoints.

Suggested fix

  • Relax message deserialization to ignore unknown fields (remove \deny_unknown_fields, or explicitly allow
    efusal: Option).
  • Model \content\ as a string-or-blocks union supporting \ ext\ and \image_url\ variants.

Reproduction

Configure the endpoint as an OpenAI-compatible BYOK provider in a standard client, then send any multi-turn conversation (triggers
efusal) or any message containing an image (triggers \image_url).

Related report on the Copilot App side: github/app#2903

Activity

  1. github-actions commented on Aug 19, 2026

    @github-actions
    Contributor

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

    If your report covers both issues together (the refusal field + image_url variant), it may still be worth keeping open as a combined tracking issue — but please check whether commenting on or subscribing to the above covers your needs.

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

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