Skip to content

fix: keep --effort on the MiniMax API-key request - #461

Merged
hetaoBackend merged 1 commit into
mainfrom
fix/effort-minimax-api
Oct 9, 2026
Merged

hetaoBackend merged 1 commit into
mainfrom
fix/effort-minimax-api

Conversation

@hetaoBackend

@hetaoBackend hetaoBackend commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

On the API-key path (minimax_api, including minimax routed through minimaxModelSource: minimax_api_key), pi-ai builds output_config: { effort } from the selected effort. patchThinkingPayload then replaces thinking with the openplatform variant and deletes output_config for every provider except a custom provider's xhigh/max. So --effort high|low|… never reached the wire. Captured request bodies for M3.1-Flash with high and low effort both had only thinking: {type: "adaptive"}.

Fix

For minimax_api requests with an explicitly selected effort level, keep output_config.effort (and any other output_config fields) set to the selected value. This mirrors patchManagedThinkingPayload on the managed path. The following are unchanged:

  • default: no explicit effort, so nothing is sent and the provider decides;
  • plain on/off models such as M3;
  • custom providers and other providers.

Tests

New local-turn-payload-transform.test.ts. It resolves a real LocalModelResolver model, runs pi-ai streamSimple with the real payload transform, and captures the request body from fetch:

  • M3.1-Flash high/low/xhigh/max on minimax_api puts output_config.effort on the wire, and so does the minimax + API-key source route;
  • default and M3 send no output_config.

The new tests fail on main (5/7) and pass with the fix. pnpm typecheck, the capability suite (215 files, 5393 passed) and check:source pass.

Open question

This assumes the open platform's Anthropic-compatible endpoint accepts output_config.effort (the managed gateway already receives it). Please confirm it accepts xhigh and max before merging.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

pi-ai sets output_config.effort from the selected thinking effort, but
patchThinkingPayload replaced the openplatform thinking variant and then
deleted output_config for every non-custom provider, so --effort never
reached the MiniMax open platform on the API-key path.

For minimax_api requests, keep the explicitly selected effort in
output_config the same way patchManagedThinkingPayload does on the managed
path. 'default', plain on/off models and other providers are unchanged.
@hetaoBackend
hetaoBackend marked this pull request as ready for review October 9, 2026 06:07

@yujiachen-y yujiachen-y left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@hetaoBackend
hetaoBackend merged commit 7682398 into main Oct 9, 2026
13 checks passed
@hetaoBackend
hetaoBackend deleted the fix/effort-minimax-api branch October 9, 2026 06:42
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