Skip to content

Conversation

@badbye
Copy link

@badbye badbye commented Oct 30, 2025

Kimi-cli raises an error when using Minimax:

kimi-cli/lib/python3.13/site-packages/kosong/chat_provider/openai_legacy.py", line 168, in _convert_stream_response
    if delta.content:
       ^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'content'

Because MiniMax-M2 returns Choice(delta=None, finish_reason='stop', index=0, logprobs=None, message={'content': '', 'role': 'assistant', 'name': 'MiniMax AI', 'audio_content': '', 'reasoning_content': ''}) in the end.

MiniMax-M2 returns `Choice(delta=None, finish_reason='stop', index=0, logprobs=None, message={'content': '', 'role': 'assistant', 'name': 'MiniMax AI',
'audio_content': '', 'reasoning_content': ''})` in the end. Kimi-cli raise an error: kimi-cli/lib/python3.13/site-packages/kosong/chat_provider/openai_legacy.py", line 168, in _convert_stream_response
    if delta.content:
       ^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'content'

Signed-off-by: yalei <[email protected]>
@stdrc
Copy link
Collaborator

stdrc commented Oct 31, 2025

Because MiniMax-M2 returns Choice(delta=None, finish_reason='stop', index=0, logprobs=None, message={'content': '', 'role': 'assistant', 'name': 'MiniMax AI', 'audio_content': '', 'reasoning_content': ''}) in the end.

MiniMax should fix their API to be OpenAI-compatible🤣. delta is not possible to be None according to OpenAI SDK:

截屏2025-10-31 14 53 38

@stdrc
Copy link
Collaborator

stdrc commented Nov 9, 2025

Closing if not further comment

@stdrc stdrc closed this Nov 9, 2025
@stdrc
Copy link
Collaborator

stdrc commented Nov 16, 2025

OK I changed my mind. We are planning to make OpenAILegacy chat provider a general OpenAI-compatible API provider, which means, we now accept special logic for specific platforms that are slightly incompatible with OpenAI.

@stdrc stdrc reopened this Nov 16, 2025
@stdrc
Copy link
Collaborator

stdrc commented Nov 16, 2025

If you are still interested, please resolve the conflict and test locally again :). Now OpenAILegacy has been moved to kosong/contrib/chat_provider.

@pvzheroes125
Copy link
Contributor

@badbye I think that it's the fault of deprecated endpoint https://api.minimaxi.com/v1/text/chatcompletion_v2, this endpoint will append a non-stream event without delta field in stream response, which is not standard behavior. To avoid this problem, please refer to https://platform.minimaxi.com/docs/api-reference/text-openai-api and use the new openai-compatible openai api

@badbye badbye closed this Nov 24, 2025
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.

3 participants