MiMo Anthropic-compatible 请求在启用 thinking.type = "enabled" 时,AI SDK 会把请求层的 maxOutputTokens 与固定 thinking.budgetTokens 一起计入最终 provider 可见的 max_tokens。当模型 metadata 的 maxOutputTokens 已经等于 provider 最大输出上限时,继续叠加 thinking budget 会让最终 max_tokens 超过 provider 支持范围。
现场失败请求:
default-mimo/mimo-v2.5-prod19aedba-9da4-477a-9765-696c9cb5eb00maxOutputTokens: 131072thinking.budgetTokens: 1024max_tokens 132096 is out of supported range (0, 131072]maxOutputTokens 是 thinking 与可见输出共享的总预算,最终 provider max_tokens 不得超过该值。fixed thinking budget 必须小于最终 max_tokens,即限制为 min(configuredBudget, max_tokens - 1)。
ZCode 通过 AI SDK 发送请求,而 AI SDK 会把 maxOutputTokens 与 thinking budget 相加,因此在
adapter 请求选项构造阶段统一投影两个请求值:
effectiveThinkingBudget = min(configuredThinkingBudget, requestedMaxOutputTokens - 1)
aiSdkMaxOutputTokens = requestedMaxOutputTokens - effectiveThinkingBudget
归一化后的总预算小于 2 时,fixed thinking 与可见输出无法同时获得至少 1 token。adapter
必须在网络请求前抛出 InvalidModelRequest,不得合成零或负的 thinking budget,也不得静默关闭
用户配置的 thinking。这里不引入 Anthropic 官方的 1,024 token 下限;大于等于 2 的预算继续
按上述公式投影,保留 Anthropic-compatible BYOK endpoint 的协议空间。
例如 Compact 总预算为 20,000、fixed thinking 为 32,000 时,本次请求使用
thinking.budgetTokens=19,999 和 maxOutputTokens=1,AI SDK 最终发送
max_tokens=20,000。投影必须克隆当前请求的 Anthropic options,后续主请求仍使用原始 32K
thinking 配置。
其中 requestedMaxOutputTokens 仍遵循现有规则:
maxOutputTokens 优先。32000。不修改 preflight 的 candidate/baseline 选择,不关闭 Compact thinking,也不增加 minimum、重试、 fallback 或 side-request 特例。
generateText 与 streamText 在固定 thinking budget 下扣减预算。InvalidModelRequest,总预算 2 仍可投影为
1 token thinking 与 1 token 可见输出。max_tokens=20000 与 thinking.budget_tokens=19999。pnpm typecheck 与 pnpm lint。