Skip to content

bug: unable to use glm-5.2 via openrouter with ai gateway #26469

@DanielleMaywood

Description

@DanielleMaywood

I tried setting up glm-5.2 as a model via the openrouter provider but was unable to get it to work.

Steps to reproduce

  1. Launch coder with CODER_AI_GATEWAY_DUMP_DIR=/tmp/aibridge-dumps
  2. Configure an OpenRouter provider
  3. Configure z-ai/glm-5.2 as a model with the OpenRouter provider
  4. Enable experimental chat debug logging for deployment
  5. Enable experimental chat debug logging for user
  6. Attempt to send a message via Coder Agents
  7. Observe a somewhat useless error message from Coder Agents
  8. Click into "Debug" tab
  9. Click into one of the failed steps
  10. Observe error bad gateway: unknown stream error: unexpected end of JSON input
  11. Also observe the dump from AI Gateway

(some fields removed for brevity)

HTTP/2.0 200 OK
Content-Type: text/event-stream

: OPENROUTER PROCESSING

Possible Root cause

Based on the AI Gateway dump, we can assume the follow steps occur:

Impact

Any provider that emits SSE comment-only events (comment lines followed by blank lines with no data: field) will trigger this bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    communityPull Requests and issues created by the community.

    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