Streaming API returns empty role string in delta chunks, breaking OpenAI-compatible clients
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 25/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Domain
- api
Research direction
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.
Written by the indexing model from the issue text.
Description
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:
- Set
role: "assistant"in the first delta chunk and omit it from subsequent chunks (matching OpenAI behavior) - Or omit the
rolefield 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
- Dominant language
- No language data
- Stars
- 588
- Forks
- 83
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from MiniMax-AI/MiniMax-M2.5
-
Difficulty 4/5 3-5 days Newbie friendliness 38/100
MiniMax-AI/MiniMax-M2.5#41 · 1 comment ·
-
Difficulty 1/5 Under an hour Newbie friendliness 48/100
MiniMax-AI/MiniMax-M2.5#39 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
MiniMax-AI/MiniMax-M2.5#38 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
MiniMax-AI/MiniMax-M2.5#37 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
MiniMax-AI/MiniMax-M2.5#36 · 3 comments ·
All issues in MiniMax-AI/MiniMax-M2.5
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 86/100
dsavransky/EXOSIMS#497 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
dginev/latexml-oxide#1132 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
EricZimmerman/evtx#281 ·
-
bugfix
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 3 days
-
ClickHouse: quantile is read as the exact Quantile, though ClickHouse's quantile is approximateOpen
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day