Skip to content

fix(glm): one Mac serves a JSON response_format with image or video input - #2006

Closed
jonathan308 wants to merge 2 commits into
devfrom
fix/glm-json-with-media
Closed

jonathan308 wants to merge 2 commits into
devfrom
fix/glm-json-with-media

Conversation

@jonathan308

@jonathan308 jonathan308 commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

Superseded by #2009.

jonathan308 and others added 2 commits November 11, 2026 09:25
…input (red)

A GLM-5.3-Flash Mac refuses every request that combines an image or
video with a JSON response_format: "GLM5: JSON response_format is not
supported with image or video input" (400 invalid_request). On 11-11 an
OpenRouter extraction client sent ~11.4k such requests (json_object
11,109, json_schema 287) and got 99.6 % 400s.

The refusal came with JSON mode (2d65e06, #1561), as scoping: GLM's
JSON answer is not constrained decoding (the native engine refuses
sampler constraints), it is the service's instruction plus a withheld,
validated answer, and only the text path routed reasoning to the typed
channel and recorded withheld output. Nothing in the media prefill
(vision spans, MTP) depends on the format.

Red here, green on the next commit:

- GLM5NextMediaRoutingTests: image + json_object and image + json_schema
  on one Mac stream the reasoning on its typed channel, withhold the
  answer and expose it once validated, and record the withheld output
  for the pre-content interval; an answer that is not the JSON asked
  for is the same typed 422 as on text, with no content.
- GLMSlotParityTests (through the OpenAI service, so the instruction
  turn is rendered): image + json_schema and image + json_object answer
  on one Mac.

Guards that pass here and must keep passing: required/named tool_choice
with media stays refused with its message, and the cluster pair keeps
refusing JSON with media with the same 400 before any media work.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nput

GLM-5.3-Flash refused every JSON response_format with image or video
input with 400 invalid_request, before any media work. The refusal was
scoping from when JSON mode landed (2d65e06, #1561), not a limit of
the model or engine: GLM's JSON answer is not constrained decoding (the
native engine refuses sampler constraints, so no grammar meets the
vision spans and MTP drafting is unchanged); it is the service's
instruction turn plus an answer withheld and validated after generation
(GLM5NextResponseFormat). The media prompt already renders the
instruction turn (glm5NextUserInput normalizes the same prepared
request), and the shared event stream already builds the withheld
answer from the prepared format. Only two wires were missing on the
media branch:

- reasoning is routed to the typed native channel when the output is
  withheld (as the text path does), so only the answer is withheld and
  validated, never the reasoning or its markers;
- the withheld answer is recorded on the usage signal, so the relay's
  pre-content interval and TTFT see the first generated token.

Still refused with the same 400 and message, before any media decode:

- required/named tool_choice with media, on any slot (only the text
  path withholds and validates a forced call);
- JSON with media on a cluster pair (servesDistributedPair, or either
  pair media route): prepareClusterGLMMedia and prepareClusterGLMImage
  withhold neither, the image route refuses JSON outright, and no GPU
  run has covered a pair with this shape.

withholdsGLMOutput is now named once at the top of prepareCompletion
and read by the refusal, the media branch and the text path.

Docs: inference.md (GLM JSON and the slot-parity rule), cli-reference
(unsupported response format); changelog fragment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
d-inference-landing Ready Ready Preview Nov 11, 2026 5:30pm UTC
darkbloom-status Ready Ready Preview Nov 11, 2026 5:30pm UTC
eigen-homepages-darkbloom Ready Ready Preview Nov 11, 2026 5:30pm UTC

Request Review

@jonathan308 jonathan308 changed the title fix(glm): one Mac serves a JSON response_format with image or video input (OpenRouter vision 400s) fix(glm): one Mac serves a JSON response_format with image or video input Nov 11, 2026
@jonathan308

Copy link
Copy Markdown
Collaborator Author

Superseded by #2009.

@jonathan308
jonathan308 deleted the fix/glm-json-with-media branch November 11, 2026 18:38

This branch was successfully deployed

3 active deployments
Preview – d-inference-landing — 1c576b37 Deployed Nov 11, 2026 by vercel[bot]
Preview – eigen-homepages-darkbloom — 1c576b37 Deployed Nov 11, 2026 by vercel[bot]
Preview – darkbloom-status — 1c576b37 Deployed Nov 11, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant