Skip to content

fix(alibaba): gate thinking_budget to qwen models, declare reasoningMaxTokens for kimi-k2.5 - #3100

Closed
AmineAce wants to merge 4 commits into
theopenco:mainfrom
AmineAce:feat/reasoning-moonshot-alibaba
Closed

AmineAce wants to merge 4 commits into
theopenco:mainfrom
AmineAce:feat/reasoning-moonshot-alibaba

Conversation

@AmineAce

@AmineAce AmineAce commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Declares reasoningMaxTokens: true for kimi-k2.5 on providerId: "alibaba" — a mapping left unverified in #3075 (cn-beijing region access issue).

Why a code change too

Just adding the catalog field wasn't safe on its own. DashScope's docs show enable_thinking works for Kimi, but thinking_budget is Qwen-only — sending it to Kimi is undocumented and untested. So thinking_budget is now gated to Qwen models only; enable_thinking stays unconditional.

Changes

  • moonshot.ts: kimi-k2.5 (alibaba) → reasoningMaxTokens: true
  • prepare-request-body.ts: thinking_budget only sent when externalId starts with qwen

Source

DashScope API reference (Chinese docs):

  • enable_thinking: supports Kimi-K2.6/K2.5, Qwen, DeepSeek-V4, GLM
  • thinking_budget: Qwen-only

Not changed

Testing

  • pnpm exec turbo run build --filter=gateway — 10/10 pass
  • pnpm format — clean

Summary by CodeRabbit

  • Bug Fixes
    • Improved support for advanced reasoning with the Kimi K2.5 model through Alibaba.
    • High reasoning effort now correctly enables thinking mode and applies the appropriate token budget.

@coderabbitai

coderabbitai Bot commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: a441612a-050f-4558-a5fd-13ba52e8f322

📥 Commits

Reviewing files that changed from the base of the PR and between a0bae80 and 82d48cb.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (1)
  • packages/actions/src/prepare-request-body.spec.ts

Walkthrough

Alibaba’s Kimi K2.5 metadata now enables reasoning max-token handling, and the corresponding request-body test expects enable_thinking: true with a thinking_budget of 24576.

Changes

Alibaba reasoning configuration

Layer / File(s) Summary
Reasoning budget mapping and model configuration
packages/models/src/models/moonshot.ts, packages/actions/src/prepare-request-body.spec.ts
Alibaba’s Kimi K2.5 provider configuration adds reasoningMaxTokens: true, and the reasoning-effort test expects thinking enabled with a budget of 24576.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

Suggested reviewers: steebchen, ratchaw

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main change by calling out kimi-k2.5 reasoningMaxTokens, and the thinking_budget note is still relevant to the Alibaba behavior update.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

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.

1 participant