Streaming API returns empty role string in delta chunks, breaking OpenAI-compatible clients

Offen
#2 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
25/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Bereich
api

Rechercherichtung

The report concerns streaming responses from https://api.minimax.io/v1/chat/completions, but names no repository files or tests, so begin by locating the streaming chat completion response implementation. Check how delta role fields are produced and whether a streaming response test covers empty roles. Done means empty role values are omitted or validly set to assistant, with a test confirming the response.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Problem

When using the MiniMax M2.5 streaming chat completion API (https://api.minimax.io/v1/chat/completions with stream: true), some chunks contain "role": "" (empty string) in the delta object. This breaks OpenAI-compatible SDK clients that validate role against the expected value "assistant".

Expected behavior

Per the OpenAI streaming spec, the role field in delta objects should either be "assistant" (typically in the first chunk) or omitted entirely in subsequent chunks. An empty string "" is neither.

Actual behavior

MiniMax returns chunks like:

{
  "choices": [{
    "index": 0,
    "delta": {
      "role": "",
      "reasoning_content": ""
    }
  }],
  "created": 1771279826,
  "object": "chat.completion.chunk",
  "usage": {"total_tokens": 0, "total_characters": 0},
  "input_sensitive": false,
  "output_sensitive": false
}

The "role": "" fails validation in clients that expect "assistant" as the only valid value (e.g., Vercel AI SDK's @ai-sdk/openai-compatible).

Error from client

AI_TypeValidationError: Type validation failed
Invalid input: expected "assistant" at choices[0].delta.role

Suggested fix

Either:

  1. Set role: "assistant" in the first delta chunk and omit it from subsequent chunks (matching OpenAI behavior)
  2. Or omit the role field entirely when it would be empty

Environment

  • API endpoint: https://api.minimax.io/v1/chat/completions
  • Model: MiniMax-M2.5
  • Streaming: enabled
  • Client: @ai-sdk/openai-compatible (Vercel AI SDK) via OpenCode
Vorherrschende Sprache
Keine Sprachdaten
Sterne
588
Forks
83
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Entwicklungsumgebung

Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus MiniMax-AI/MiniMax-M2.5

Alle Issues in MiniMax-AI/MiniMax-M2.5

Ähnliche Issues

Weitere Issues zu Backend & API Design

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.