Skip to content

fix streamSupportedChannels - #2909

Merged
Calcium-Ion merged 1 commit into
QuantumNous:mainfrom
seefs001:fix/stream-supported-channel
Feb 10, 2026
Merged

Calcium-Ion merged 1 commit into
QuantumNous:mainfrom
seefs001:fix/stream-supported-channel

Conversation

@seefs001

@seefs001 seefs001 commented Feb 10, 2026 •

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features

    • Added streaming options support for Moonshot, MiniMax, and SiliconFlow channels.
  • Documentation

    • Added guidelines for implementing new channels with streaming options support.

@coderabbitai

coderabbitai Bot commented Feb 10, 2026 •

Copy link
Copy Markdown
Contributor

Walkthrough

The pull request adds Rule 4 documentation across configuration files establishing guidance for implementing new channels with StreamOptions support, and updates the relay configuration to include three new channel providers (Moonshot, MiniMax, SiliconFlow) in the streamSupportedChannels list.

Changes

Cohort / File(s) Summary
Documentation Rules
.cursor/rules/project.mdc, AGENTS.md, CLAUDE.md
Added Rule 4 guidance requiring verification of provider StreamOptions support and conditional addition to streamSupportedChannels when implementing new channels.
Relay Configuration
relay/common/relay_info.go
Extended streamSupportedChannels map to include three new providers: Moonshot, MiniMax, and SiliconFlow.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Poem

🐰 Three new channels join the stream,
Moonshot, MiniMax, SiliconFlow's gleam,
With rules now written, clear and bright,
The relay configuration shines just right!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix streamSupportedChannels' is directly related to the main changes in the pull request, which adds three new channels (Moonshot, MiniMax, SiliconFlow) to the streamSupportedChannels map and adds documentation for Rule 4 about StreamOptions support.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@relay/common/relay_info.go`:
- Around line 308-310: The streamSupportedChannels map currently marks
ChannelTypeMiniMax and ChannelTypeSiliconFlow as supporting
stream_options.include_usage; remove those two entries so only
ChannelTypeMoonshot remains true. Locate the map named streamSupportedChannels
in relay/common/relay_info.go and delete the entries referencing
constant.ChannelTypeMiniMax and constant.ChannelTypeSiliconFlow, leaving
constant.ChannelTypeMoonshot set to true; keep surrounding map structure and
comments intact.

Comment on lines +308 to +310
constant.ChannelTypeMoonshot: true,
constant.ChannelTypeMiniMax: true,
constant.ChannelTypeSiliconFlow: true,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🌐 Web query:

Moonshot AI API stream_options include_usage parameter documentation

💡 Result:

Moonshot(Kimi)API 的流式请求支持与 OpenAI 一致的参数:

  • 在请求体里设置 stream: true 时,如需在流的最后一个 chunk里拿到 token 用量统计,需要额外传 stream_options: { include_usage: true }。[1][2]
  • Moonshot 还会出于兼容/历史原因,在每个 choice 的结束点保留 choice.usage;如果 n > 1,最终**顶层 usage**会把各个 choice 的 completion tokens 汇总后返回。[1][2]

示例(请求体片段):

{
  "stream": true,
  "stream_options": { "include_usage": true }
}

参考来源:Kimi Forum 关于兼容性说明(官方人员回复)[1];迁移教程中对 stream_options.include_usage 与 usage 返回位置的说明[2]。


🌐 Web query:

MiniMax API stream_options include_usage support OpenAI compatible

💡 Result:

MiniMax’s OpenAI-compatible endpoint (OPENAI_BASE_URL=https://api.minimax.io/v1) is documented as supporting basic OpenAI SDK usage and streaming, but it does not document support for OpenAI’s stream_options: { "include_usage": true } anywhere in the OpenAI-compatible docs/examples. In their OpenAI-compatible streaming example they only set stream=True (no stream_options). [1]

MiniMax does use a stream_options object for MiniMax-specific streaming features (e.g., speech_output for text+audio streaming in /v1/chat/completions examples), not for include_usage. [2]

If you need token usage, MiniMax’s non-stream responses include a usage object (shown in their standard text chat API reference). For OpenAI-compatible streaming, don’t rely on stream_options.include_usage; remove it if your OpenAI client/framework adds it automatically, and compute usage another way (e.g., post-hoc, or via a non-stream call). [3]

Sources: [1] [2] [3]


🌐 Web query:

SiliconFlow API stream_options include_usage parameter

💡 Result:

SiliconFlow’s OpenAI-compatible POST /v1/chat/completions API currently documents a stream: boolean flag, but does not document or expose an OpenAI-style stream_options object (and therefore no stream_options.include_usage) in its request body schema. [1]

Their streaming guide likewise only shows enabling streaming via stream=True, with no stream_options usage described. [2]

Implication: stream_options: { include_usage: true } is likely not supported on SiliconFlow (it may be ignored or rejected, depending on their backend validation), similar to other OpenAI-compatible providers that reject stream_options.include_usage as an unknown field. [3]

Workaround: If you need token usage, use non-streaming responses (where usage is returned) per the normal response format in the API reference. [1]

Sources:
[1] SiliconFlow API Reference – Chat completions (request fields; no stream_options) (docs.siliconflow.cn)
[2] SiliconFlow FAQ – Stream Mode (examples only use stream) (docs.siliconflow.cn)
[3] Example of an OpenAI-compatible provider rejecting stream_options.include_usage (github.com)

Citations:


Remove MiniMax and SiliconFlow from streamSupportedChannels—they do not support stream_options.include_usage.

API verification reveals:

  • Moonshot: ✅ Supports stream_options: { include_usage: true } per official docs
  • MiniMax: ❌ OpenAI-compatible endpoint does not document or support stream_options.include_usage; only non-streaming responses include usage data
  • SiliconFlow: ❌ API documentation does not expose stream_options parameter at all; may reject it as an unknown field

Only Moonshot should remain in the map.

🤖 Prompt for AI Agents
In `@relay/common/relay_info.go` around lines 308 - 310, The
streamSupportedChannels map currently marks ChannelTypeMiniMax and
ChannelTypeSiliconFlow as supporting stream_options.include_usage; remove those
two entries so only ChannelTypeMoonshot remains true. Locate the map named
streamSupportedChannels in relay/common/relay_info.go and delete the entries
referencing constant.ChannelTypeMiniMax and constant.ChannelTypeSiliconFlow,
leaving constant.ChannelTypeMoonshot set to true; keep surrounding map structure
and comments intact.

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.

2 participants