Skip to content

feat(minimax): route /fast to MiniMax's faster paid lanes with correct pricing - #107378

Closed
jzakirov wants to merge 1 commit into
openclaw:mainfrom
jzakirov:minimax-fast-lane-pricing
Closed

jzakirov wants to merge 1 commit into
openclaw:mainfrom
jzakirov:minimax-fast-lane-pricing

Conversation

@jzakirov

@jzakirov jzakirov commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

Supersedes #95802
Related: #88868

AI-assisted.

What Problem This Solves

Two MiniMax fast-lane defects, one of them a live billing misreport:

  • MiniMax-M2.7 is billed wrong today. /fast already rewrites MiniMax-M2.7 to MiniMax-M2.7-highspeed, but OpenClaw keeps recording the standard M2.7 rate. Highspeed costs $0.6/$2.4 per million input/output tokens against M2.7's $0.3/$1.2, so every /fast M2.7 turn is reported at half its real input and output price.
  • MiniMax-M3 has no fast lane at all, even though /fast already means "opt into the provider's faster paid lane" everywhere else in OpenClaw.

Why This Change Was Made

Root cause of the mispricing. Fast mode was a core stream wrapper (createMinimaxFastModeWrapper) that swapped the request model.id after model.cost had already been resolved, while MiniMax pricing lives in the plugin (resolveMinimaxApiCost). Id and cost drifted, and the swapped request was billed at the original model's rate. No amount of core-side patching fixes that without a cross-boundary cost callback.

The fix moves ownership to the boundary that has the prices. The wrapper now lives in the MiniMax plugin's own wrapStreamFn (extensions/minimax/stream-wrappers.ts), which is exactly the shape extensions/anthropic/stream-wrappers.ts already uses:

  • M2.7 → swap to MiniMax-M2.7-highspeed together with its catalog cost. A plain name→price lookup, identical to selecting any other model.
  • M3 → inject service_tier: "priority" and scale model.cost by 1.5x, the same construction as ANTHROPIC_FAST_MODE_COST_MULTIPLIER = 2 on main. A service_tier set upstream is preserved.

Fast mode is resolved plugin-locally through the public normalizeFastMode, mirroring resolveAnthropicFastMode, so this PR adds no plugin SDK export. It deletes the orphaned core createMinimaxFastModeWrapper, the minimax-fast-mode stream family, its MINIMAX_FAST_MODE_STREAM_HOOKS shortcut, and the then-unused resolveBooleanFastMode.

Responses to the previous review

The branch is rebased onto current main, and the three P1 findings were re-checked against it rather than restated.

1. "Preserve the shipped MiniMax SDK adapter." These are not live SDK contracts being retired; they were already retirement debt before this PR. createMinimaxFastModeWrapper and MINIMAX_FAST_MODE_STREAM_HOOKS carry @deprecated ... do not use from third-party plugins on main, and main has itself already dropped MINIMAX_FAST_MODE_STREAM_HOOKS from the public openclaw/plugin-sdk/provider-stream-family re-export list — the bundled plugin reached it via buildProviderStreamFamilyHooks("minimax-fast-mode"). The only in-repo reader was the bundled MiniMax plugin, which this PR migrates in the same change, per extensions/AGENTS.md ("ALL bundled plugins must move to modern SDK seams in the same change"). That matches the precedent set by #112915, which removed reader-free deprecated SDK declarations outright rather than adding adapters. Keeping a deprecated compatibility adapter here would mean keeping a second, knowingly mispriced fast-mode path alive. If maintainers want the packaged-corpus reader scan that #112915 ran before removal, that gate is yours to run — I verified in-repo readers only.

2. "Do not redefine M3 fast mode without approval." /fast opting into a faster, more expensive provider lane is the established product semantic on main, not a new one this PR invents:

  • docs/providers/anthropic.md:497 — native fast mode "is billed at $10/$50 per million input/output tokens. OpenClaw applies the same 2x multiplier to cache pricing in its cost estimate."
  • docs/concepts/model-providers.md:115 — "/fast and params.fastMode map direct openai/* Responses requests to service_tier=priority".

MiniMax-M3 was the outlier. This PR also does the thing the OpenAI path still does not: it records the premium in the cost estimate instead of silently under-reporting it. Note also that #88869, the competing implementation of the M3-unchanged direction, was closed unmerged on 2026-06-14, so there is no longer a competing branch to consolidate against. The /fast semantics remain opt-in; nothing changes when fast mode is off. If maintainers still prefer M3-unchanged, say so and I will drop the M3 half — the M2.7 accounting repair stands on its own.

3. "Use tier-aware M3 cost before multiplying." Not reachable at this seam, and not made worse here. The runtime Model.cost handed to a StreamFn is four flat numbers (packages/llm-core/src/types.ts:631) with no tier information; tieredPricing exists only in the catalog layer (packages/model-catalog-core/src/model-catalog-types.ts:217), and the MiniMax catalog declares no tieredPricing for M3 (extensions/minimax/model-definitions.ts). Long-context M3 is therefore under-reported on main identically with and without this PR. Making M3 tier-aware is catalog work owned by #88868, and it composes cleanly with this change: once the catalog carries tiers, the multiplier applies on top of whatever base cost the catalog resolved.

User Impact

With /fast enabled on a MiniMax model: M2.7 runs on the highspeed model and is finally reported at the highspeed rate instead of half of it, and M3 runs on MiniMax's priority tier reported at 1.5x. No behavior change when fast mode is off, and no plugin SDK surface is added.

Cost accounting follows automatically: calculateCost(model, usage) (packages/ai/src/model-utils.ts:9) derives usage.cost from the exact model object the wrapper hands down the stream, which is the routed/repriced one. The live test below captures that object directly.

The inline per-reply usage bar still shows the base rate — it recomputes from the model ref and cannot see a tier, the same limitation OpenAI's priority tier has today.

Evidence

Live OpenClaw run on this branch (extensions/minimax/minimax.live.test.ts, new minimax fast lane live block, MiniMax API key redacted). Each case registers the real MiniMax plugin, takes the provider's own wrapStreamFn, and drives a real turn against https://api.minimax.io/anthropic through streamSimple, capturing both the request body MiniMax receives and the model OpenClaw bills:

$ node scripts/test-live.mjs --no-quiet -- extensions/minimax/minimax.live.test.ts -t "minimax fast lane live"

MiniMax-M2.7 fastMode=true  -> requested=MiniMax-M2.7-highspeed  service_tier=undefined
                               billedCost={"input":0.6,"output":2.4,"cacheRead":0.06,"cacheWrite":0.375}
MiniMax-M3   fastMode=true  -> requested=MiniMax-M3              service_tier=priority
                               billedCost={"input":0.8999999999999999,"output":3.5999999999999996,"cacheRead":0.18,"cacheWrite":0}
MiniMax-M3   fastMode=false -> requested=MiniMax-M3              service_tier=undefined
                               billedCost={"input":0.6,"output":2.4,"cacheRead":0.12,"cacheWrite":0}

Test Files  1 passed (1)
     Tests  3 passed | 4 skipped (7)

The first line is the defect and the fix in one: the request goes to MiniMax-M2.7-highspeed and the recorded cost is now that model's own 0.6/2.4 rate. Before this change it stayed at M2.7's 0.3/1.2.

Live endpoint re-confirmation (today, current API — the earlier review flagged that MiniMax's Anthropic-compat docs claim service_tier is ignored):

# control - no service_tier
  {"model":"MiniMax-M3","max_tokens":16,"messages":[{"role":"user","content":"ping"}]}
  HTTP 200 -> usage.service_tier = "standard"

# with the flag this PR sets
  {"model":"MiniMax-M3","max_tokens":16,"messages":[...],"service_tier":"priority"}
  HTTP 200 -> usage.service_tier = "priority"

The endpoint honors the flag and reports the served lane back.

Focused unit proof: extensions/minimax/stream-wrappers.test.ts (11), extensions/minimax/index.test.ts (12), src/plugin-sdk/provider-stream.test.ts + src/llm/providers/stream-wrappers/minimax.test.ts (26), src/plugins/contracts/provider-family-plugin-tests.test.ts (3), src/agents/embedded-agent-runner-extraparams.test.ts (138) — all passing. The new extension test covers the M2.7 id+cost swap, the M3 service_tier: "priority" + 1.5x cost ({0.6,2.4,0.12,0} → {0.9,3.6,0.18,0}), upstream-tier preservation, the /fast function and string spellings, /fast auto staying unresolved, fast-off no-op, and non-MiniMax passthrough.

Static gates: tsgo:core, tsgo:extensions, tsgo:test:src, tsgo:test:extensions, check:deprecated-api-usage, check:deprecated-jsdoc, check:import-cycles, plugin-sdk:surface:check, both extension plugin-SDK boundary lints, format:check, and git diff --check all clean. plugin-sdk:api:gen produces no baseline change (the removed symbols are outside the 142 curated baseline modules), so the generated baseline edit from the pre-rebase revision is gone.

Rebase notes: rebased onto main at f1538c6d6c1. Three surfaces that moved under the branch since it was opened are updated here: provider-registration.ts now composes wrapStreamFn directly instead of buildProviderStreamFamilyHooks("minimax-fast-mode"), the minimax sentinel in src/plugins/contracts/provider-family-plugin-tests.test.ts drops its streamFamilies entry, and src/agents/embedded-agent-runner-extraparams.test.ts uses a local createTestMinimaxFastModeWrapper (matching the existing xAI test helper) instead of importing the deleted core wrapper. That file also had two byte-identical it(...) cases for the M2.7 highspeed mapping; one is removed.

Prod LOC is net +31, which is the M3 lane itself — new behavior rather than refactor churn. The core deletions offset most of the wrapper move.

🤖 Generated with Claude Code

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation extensions: minimax size: M labels Jul 14, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. labels Jul 14, 2026
@clawsweeper

clawsweeper Bot commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 26, 2026, 8:35 PM ET / September 27, 2026, 00:35 UTC (Revision 12).

ClawSweeper review

What this changes

The branch moves MiniMax fast-mode routing into its provider plugin, records the highspeed price for M2.7, adds priority-tier routing and pricing for M3, and removes the former shared stream hooks.

Merge readiness

⛔ Blocked before merge - 7 items remain

This PR remains useful: current main still records the standard M2.7 price after routing /fast to highspeed. The branch addresses that defect, but its M3 paid-lane change, tier-dependent cost accounting, and removal of shipped Plugin SDK exports remain blockers.

Priority: P2
Reviewed head: 0d520a0e4658782d5b0975cb37097defaf64d893
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Strong live proof supports the main routing claims, but the patch still has a billing defect and unresolved product and SDK compatibility blockers.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The contributor's recorded live run uses the registered MiniMax provider hook and real endpoint to show after-change M2.7 highspeed routing with its model cost, M3 priority routing, and M3 fast-off behavior. It does not settle the separate preserved-tier defect or upgrade decision; no stored-data format changes.
Patch quality 🦐 gold shrimp (3/6) 3 actionable review findings remain.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The contributor's recorded live run uses the registered MiniMax provider hook and real endpoint to show after-change M2.7 highspeed routing with its model cost, M3 priority routing, and M3 fast-off behavior. It does not settle the separate preserved-tier defect or upgrade decision; no stored-data format changes.
Evidence reviewed 10 items Introduced routing and pricing: The new plugin wrapper swaps M2.7 model ID and cost together, but constructs the M3 priority-priced model before its payload hook checks whether an existing service tier must be preserved.
Preserved-tier test gap: The standard-tier preservation test asserts the outbound tier but does not assert that the recorded model cost remains standard.
Final payload and billing path: The transport applies onPayload before sending the request, then calculates usage cost from the stream's model. A preserved standard tier can therefore be sent with the PR's priority-priced model.
Findings 3 actionable findings [P1] Price M3 from the final outbound service tier
[P1] Keep M3 fast-mode behavior until its paid mapping is approved
[P1] Preserve the shipped MiniMax Plugin SDK transition
Security None None.

How this fits together

An agent turn passes its selected model and fast-mode setting to the MiniMax provider plugin. The plugin shapes the outbound request, while the model cost passed to the stream is used to estimate usage charges.

flowchart LR
A[Agent model and fast setting] --> B[MiniMax provider plugin]
B --> C{Model and fast mode}
C -->|M2.7 fast| D[Highspeed model and price]
C -->|M3 fast| E[Priority request and price]
C -->|Other| F[Original model]
D --> G[MiniMax request and usage]
E --> G
F --> G
Loading

Decision needed

Question Recommendation
Should existing MiniMax-M3 /fast settings begin selecting MiniMax's paid priority tier despite the open follow-up requesting that M3 stay unchanged? Keep M3 unchanged: Narrow this branch to the M2.7 price repair and decide M3 priority through a separate sponsored change.

Why: The mapping changes spend for existing preferences, and the related issue records a conflicting intended behavior; code and live endpoint proof cannot decide product intent.

Before merge

  • Price M3 from the final outbound service tier (P1) - When an earlier hook supplies service_tier: "standard", this wrapper preserves that outbound tier but has already multiplied the model cost by 1.5. The transport then calculates usage from the multiplied model. Resolve the effective tier before applying its price and assert standard cost in the preservation case.
  • Keep M3 fast-mode behavior until its paid mapping is approved (P1) - Existing M3 fast-mode preferences are inert on current main, while this branch makes them select a paid priority lane. The open M3 follow-up requests unchanged fast-mode behavior. Narrow the branch to M2.7 or obtain an explicit maintainer decision and document the upgrade effect.
  • Preserve the shipped MiniMax Plugin SDK transition (P1) - The public provider-stream subpath in v2026.9.6 exports the MiniMax wrapper and hook constant and accepts the family value. Removing them can break third-party plugins at import or build time. Deprecation and an in-repository reader check do not establish a safe external transition.
  • Resolve merge risk (P1) - Existing saved or configured M3 fast-mode settings would begin selecting a paid priority lane; the open MiniMax follow-up requests the opposite behavior, and no maintainer decision resolves that upgrade change.
  • Resolve merge risk (P1) - The branch removes MiniMax names from a shipped public Plugin SDK subpath without demonstrated third-party reader compatibility or an approved transition.
  • Complete next step (P2) - Resolve the final-tier pricing defect and shipped SDK compatibility, then obtain a maintainer decision on the M3 paid mapping or narrow the PR to M2.7.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.

Findings

  • [P1] Price M3 from the final outbound service tier — extensions/minimax/stream-wrappers.ts:72-80
  • [P1] Keep M3 fast-mode behavior until its paid mapping is approved — extensions/minimax/stream-wrappers.ts:70-74
  • [P1] Preserve the shipped MiniMax Plugin SDK transition — src/plugin-sdk/provider-stream.ts:52-53
Agent review details

Security

None.

PR surface

Source +31, Tests +165, Docs -1. Total +195 across 12 files.

View PR surface stats
Area Files Added Removed Net
Source 4 91 60 +31
Tests 6 253 88 +165
Docs 2 2 3 -1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 12 346 151 +195

Review metrics

Metric Value Why it matters
Plugin SDK transition 2 exported names and 1 stream family removed Those surfaces are present in the latest release and need an explicit compatibility decision.
Fast-mode mappings 1 existing route repriced, 1 paid route added The M3 addition changes the effect of existing fast-mode settings.

Merge-risk options

Maintainer options:

  1. Narrow and preserve the SDK (recommended)
    Keep the M2.7 accounting repair, retain the shipped SDK names pending a supported transition, and leave M3 routing unchanged.
  2. Approve the paid M3 mapping
    A maintainer can adopt that direction after the final-tier billing defect and SDK compatibility path are resolved.

Technical review

Best possible solution:

Land the M2.7 accounting repair at the MiniMax plugin boundary, retain shipped SDK compatibility until its transition is approved, and add M3 priority only after a clear product decision with final-tier pricing coverage.

Do we have a high-confidence way to reproduce the issue?

Yes for the M2.7 defect and the preserved-tier mismatch: current-main routing retains standard cost, and the branch's wrapper always multiplies M3 cost before inspecting the final tier. The supplied live trace covers the ordinary routes, not the preserved-standard case.

Is this the best way to solve the issue?

No as submitted. Plugin-local pricing is the right owner boundary for M2.7, but the M3 paid mapping needs product approval and the SDK removal needs a supported transition.

Full review comments:

  • [P1] Price M3 from the final outbound service tier — extensions/minimax/stream-wrappers.ts:72-80
    When an earlier hook supplies service_tier: "standard", this wrapper preserves that outbound tier but has already multiplied the model cost by 1.5. The transport then calculates usage from the multiplied model. Resolve the effective tier before applying its price and assert standard cost in the preservation case.
    Confidence: 0.98
  • [P1] Keep M3 fast-mode behavior until its paid mapping is approved — extensions/minimax/stream-wrappers.ts:70-74
    Existing M3 fast-mode preferences are inert on current main, while this branch makes them select a paid priority lane. The open M3 follow-up requests unchanged fast-mode behavior. Narrow the branch to M2.7 or obtain an explicit maintainer decision and document the upgrade effect.
    Confidence: 0.94
  • [P1] Preserve the shipped MiniMax Plugin SDK transition — src/plugin-sdk/provider-stream.ts:52-53
    The public provider-stream subpath in v2026.9.6 exports the MiniMax wrapper and hook constant and accepts the family value. Removing them can break third-party plugins at import or build time. Deprecation and an in-repository reader check do not establish a safe external transition.
    Confidence: 0.91

Overall correctness: patch is incorrect
Overall confidence: 0.91

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against d06b334112a2.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: The branch repairs a limited MiniMax accounting defect, while its remaining blockers are bounded provider and compatibility decisions.
  • merge-risk: 🚨 compatibility: Removing shipped SDK exports and changing the meaning of existing M3 fast-mode settings can affect upgrades.
  • merge-risk: 🚨 auth-provider: The new M3 mapping changes provider request tier and estimated charges, and preserved tiers can be priced incorrectly.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (terminal): The contributor's recorded live run uses the registered MiniMax provider hook and real endpoint to show after-change M2.7 highspeed routing with its model cost, M3 priority routing, and M3 fast-off behavior. It does not settle the separate preserved-tier defect or upgrade decision; no stored-data format changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The contributor's recorded live run uses the registered MiniMax provider hook and real endpoint to show after-change M2.7 highspeed routing with its model cost, M3 priority routing, and M3 fast-off behavior. It does not settle the separate preserved-tier defect or upgrade decision; no stored-data format changes.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Make M3 cost match the final outbound tier, including a preserved-standard regression case.
  • Obtain the M3 paid-lane decision or narrow the branch to M2.7 accounting.
  • Preserve the shipped Plugin SDK surface or establish an approved compatibility transition.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (11 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-01T06:55:18.652Z sha 0d520a0 :: needs changes before merge. :: [P1] Price M3 from the final service tier
  • reviewed 2026-08-07T11:24:09.425Z sha 0d520a0 :: found issues before merge. :: [P1] Price M3 from the final service tier | [P1] Preserve the shipped MiniMax SDK compatibility exports
  • reviewed 2026-08-07T11:55:09.303Z sha 0d520a0 :: found issues before merge. :: [P1] Align M3 cost with the final service tier | [P1] Keep existing M3 fast-mode behavior until it is approved | [P1] Preserve the exported MiniMax stream API or deprecate it safely
  • reviewed 2026-08-15T13:18:45.855Z sha 0d520a0 :: found issues before merge. :: [P1] Align M3 cost with the final service tier | [P1] Preserve the shipped MiniMax stream compatibility exports | [P1] Keep M3 fast mode unchanged until it is approved
  • reviewed 2026-08-16T22:19:49.285Z sha 0d520a0 :: found issues before merge. :: [P1] Derive M3 pricing from the final service tier | [P1] Preserve the shipped MiniMax stream SDK contract | [P1] Do not repurpose existing M3 fast-mode settings without approval
  • reviewed 2026-08-18T12:34:34.168Z sha 0d520a0 :: found issues before merge. :: [P1] Derive M3 pricing from the final service tier | [P1] Keep MiniMax M3 fast mode unchanged until approved | [P1] Preserve the public MiniMax stream SDK transition
  • reviewed August 25, 2026, 3:11 AM ET / 07:11 UTC sha unknown :: found issues before merge. :: [P1] Price M3 from the final service tier | [P1] Gate M3 priority mode behind an approved contract
  • reviewed 2026-09-02T04:09:21.080Z sha 0d520a0 :: found issues before merge. :: [P1] Derive M3 cost from the final service tier | [P1] Require direction before rerouting M3 fast mode

@jzakirov
jzakirov force-pushed the minimax-fast-lane-pricing branch from fd567d3 to 7bf614c Compare July 25, 2026 15:58
@openclaw-barnacle openclaw-barnacle Bot added the agents Agent runtime and tooling label Jul 25, 2026
…t pricing

MiniMax-M2.7 `/fast` already routed to the highspeed model but recorded the
standard M2.7 rate, so the one fast lane that existed was billed at half its
real input/output price. MiniMax-M3 had no `/fast` behavior at all, unlike
Anthropic and OpenAI where `/fast` already opts into the provider's faster
paid lane.

Root cause of the mispricing: fast mode was a core stream wrapper that swapped
`model.id` after `model.cost` had been resolved, while MiniMax pricing lives in
the plugin. Id and cost drifted.

Move the wrapper into the MiniMax plugin's own `wrapStreamFn`, next to
`resolveMinimaxApiCost`, matching `extensions/anthropic/stream-wrappers.ts`:
- M2.7 -> swap to MiniMax-M2.7-highspeed together with its catalog cost.
- M3   -> inject `service_tier: "priority"` and scale `model.cost` 1.5x, the
  same shape as ANTHROPIC_FAST_MODE_COST_MULTIPLIER. An upstream service_tier
  is preserved.

Fast mode is resolved plugin-locally through the public `normalizeFastMode`,
so no new SDK export is needed. This deletes the orphaned core
`createMinimaxFastModeWrapper`, the `minimax-fast-mode` stream family, its
`MINIMAX_FAST_MODE_STREAM_HOOKS` shortcut, and the now-unused
`resolveBooleanFastMode`; all were already `@deprecated` and have no remaining
reader.
@jzakirov
jzakirov force-pushed the minimax-fast-lane-pricing branch from 7bf614c to 0d520a0 Compare July 25, 2026 16:02
@jzakirov

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (f1538c6d6c1) and reworked against it. The PR body has the full detail; summary of what changed since the last review:

  • Live OpenClaw proof added (the P1 ask). New minimax fast lane live block in extensions/minimax/minimax.live.test.ts registers the real plugin, takes the provider's own wrapStreamFn, and drives real turns against api.minimax.io, capturing both the request body and the model OpenClaw bills. It shows M2.7 /fast now recorded at the highspeed 0.6/2.4 rate instead of M2.7's 0.3/1.2, M3 /fast at service_tier: priority with 1.5x cost, and M3 fast-off unchanged. usage.service_tier was also re-confirmed live today as priority vs standard, which addresses the noted conflict with MiniMax's docs.
  • No new plugin SDK export. Fast mode is now resolved plugin-locally through the public normalizeFastMode, mirroring resolveAnthropicFastMode. The previously proposed resolveBooleanFastMode export is gone; the PR only removes already-@deprecated symbols.
  • On the M3 /fast contract: /fast meaning "opt into the provider's faster paid lane" is already the shipped semantic — extensions/anthropic/stream-wrappers.ts carries ANTHROPIC_FAST_MODE_COST_MULTIPLIER = 2 with the same model.cost construction, and /fast maps openai/* to service_tier=priority. M3 was the outlier. Follow up MiniMax M3 pricing and PDF extraction defaults #88869, the competing M3-unchanged implementation, was closed unmerged on 2026-06-14. Still happy to drop the M3 half if maintainers prefer it; the M2.7 accounting repair stands alone.
  • On tier-aware M3 cost: not reachable at this seam. Runtime Model.cost is four flat numbers (packages/llm-core/src/types.ts:631); tieredPricing exists only in the catalog layer and the MiniMax catalog declares none for M3, so long-context M3 is under-reported on main identically with and without this PR. That work is owned by Follow up MiniMax M3 pricing and PDF extraction defaults #88868 and composes on top of the multiplier.
  • Three surfaces that moved under the branch are updated: provider-registration.ts, the minimax sentinel in src/plugins/contracts/provider-family-plugin-tests.test.ts, and src/agents/embedded-agent-runner-extraparams.test.ts (local test helper instead of the deleted core wrapper; two byte-identical cases deduped). The generated SDK API baseline edit is gone — plugin-sdk:api:gen produces no diff.

CI is green on 0d520a0e4658782d5b0975cb37097defaf64d893 (openclaw/ci-gate: success).

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. proof: sufficient ClawSweeper judged the real behavior proof convincing. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 25, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 7, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 25, 2026
obviyus added a commit that referenced this pull request Sep 9, 2026
Related: #136257, #141852

## What Problem This Solves

Fixes an issue where users could enable a Fast choice that has no effect for a selected OpenAI, xAI, or MiniMax request. Models without a Fast alias and OpenAI requests controlled by an explicit service tier still fell back to provider-wide support.

## Why This Change Was Made

Provider metadata shares the existing alias and service-tier rules with request construction. The existing selected-model capability field carries the result to controls. Explicit-tier precedence, unknown native capability, and saved-preference clearing stay intact.

The rules use existing lightweight internal entries. MiniMax pricing and its proposed M3 paid lane remain separate work in #107378.

## User Impact

Known no-op Fast choices are disabled, while supported requests keep their current mapping. Typed `/fast` commands continue to set or clear preferences. The capability describes local request mapping; it makes no speed, pricing, entitlement, or native-runtime claim.

## Evidence

The real compiled Gateway and its authenticated client produced these results:

| Selected non-native request | Baseline capability | Candidate capability |
| --- | --- | --- |
| xAI `grok-4.3` | absent | false |
| xAI `grok-3` | absent | true |
| MiniMax `MiniMax-M2.5` | absent | false |
| MiniMax `MiniMax-M2.7` | absent | true |
| OpenAI Responses with explicit `flex` | absent | false |
| OpenAI Responses without an explicit tier | absent | true |

- All six rows remain available under the selected OpenClaw runtime. Public output excludes credentials, endpoints and private parameter records.
- Fresh independent acceptance passed all six metadata clauses after its own nonce command. Both Gateway runs stopped; the independent service recorded no remaining processes and enforced memory, CPU and swap limits.
- 43 focused checks pass: provider rules, selected-model/agent parameters, dynamic aliases, composed OpenAI/ChatGPT tier precedence, and the corrected auth-refresh expectation. Formatting and lint pass; the changed assertion and normal hooks were verified on Testbox.
- Baseline source is `127e3ffa3080841cef31927c57071c7ae9ae52ae`, exercised through source-equivalent build `1b284af37e091fab9fc58297e4478a0f701ed6fd`. Candidate proof uses actual CI build `d85807c2b634c885fd1d5caa2d17c99cf5601d9f` from run [34291602461](https://github.com/openclaw/openclaw/actions/runs/34291602461). The later commit changes only the expected metadata in one test, so production proof remains valid at its original build identity.
- The earlier CI run caught that expected-row mismatch and two channel test timeouts before their injected reply callbacks. Full history is retained; those timeouts are not claimed fixed. Current results are in [PR checks](https://github.com/openclaw/openclaw/pull/142682/checks).
- Generic control, unknown-case and preference-clearing proof from #141852 is retained for unchanged consumers. Fresh acceptance covers the new public metadata; it does not claim browser clicks or vendor inference.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 9, 2026
…#142682)

Related: openclaw#136257, openclaw#141852

## What Problem This Solves

Fixes an issue where users could enable a Fast choice that has no effect for a selected OpenAI, xAI, or MiniMax request. Models without a Fast alias and OpenAI requests controlled by an explicit service tier still fell back to provider-wide support.

## Why This Change Was Made

Provider metadata shares the existing alias and service-tier rules with request construction. The existing selected-model capability field carries the result to controls. Explicit-tier precedence, unknown native capability, and saved-preference clearing stay intact.

The rules use existing lightweight internal entries. MiniMax pricing and its proposed M3 paid lane remain separate work in openclaw#107378.

## User Impact

Known no-op Fast choices are disabled, while supported requests keep their current mapping. Typed `/fast` commands continue to set or clear preferences. The capability describes local request mapping; it makes no speed, pricing, entitlement, or native-runtime claim.

## Evidence

The real compiled Gateway and its authenticated client produced these results:

| Selected non-native request | Baseline capability | Candidate capability |
| --- | --- | --- |
| xAI `grok-4.3` | absent | false |
| xAI `grok-3` | absent | true |
| MiniMax `MiniMax-M2.5` | absent | false |
| MiniMax `MiniMax-M2.7` | absent | true |
| OpenAI Responses with explicit `flex` | absent | false |
| OpenAI Responses without an explicit tier | absent | true |

- All six rows remain available under the selected OpenClaw runtime. Public output excludes credentials, endpoints and private parameter records.
- Fresh independent acceptance passed all six metadata clauses after its own nonce command. Both Gateway runs stopped; the independent service recorded no remaining processes and enforced memory, CPU and swap limits.
- 43 focused checks pass: provider rules, selected-model/agent parameters, dynamic aliases, composed OpenAI/ChatGPT tier precedence, and the corrected auth-refresh expectation. Formatting and lint pass; the changed assertion and normal hooks were verified on Testbox.
- Baseline source is `beca6a1c05d9dad59a9abbe6de226ac350f3a3ec`, exercised through source-equivalent build `1b284af37e091fab9fc58297e4478a0f701ed6fd`. Candidate proof uses actual CI build `d85807c2b634c885fd1d5caa2d17c99cf5601d9f` from run [34291602461](https://github.com/openclaw/openclaw/actions/runs/34291602461). The later commit changes only the expected metadata in one test, so production proof remains valid at its original build identity.
- The earlier CI run caught that expected-row mismatch and two channel test timeouts before their injected reply callbacks. Full history is retained; those timeouts are not claimed fixed. Current results are in [PR checks](https://github.com/openclaw/openclaw/pull/142682/checks).
- Generic control, unknown-case and preference-clearing proof from openclaw#141852 is retained for unchanged consumers. Fresh acceptance covers the new public metadata; it does not claim browser clicks or vendor inference.

Co-authored-by: Ayaan Zaidi <[email protected]>
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Sep 17, 2026
@jzakirov jzakirov closed this Sep 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation extensions: minimax merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M stale Marked as stale due to inactivity status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant