feat: raise max output tokens to 128K (documented upstream ceiling)
Aliyun Model Studio (the upstream behind Qoder's CN catalog) documents Max Output Length = 131072 for every model we expose, in both normal and thinking modes (thinking chain alone goes to 262144): qwen3.8-max/flash, qwen3.7-max/plus/flash — all 131072. The previous 32768 default (copied from qodercli's conservative 32e3) used only 1/4 of the supported output budget. That truncates reasoning chains in thinking mode (where the chain counts against output) and risks cutting long generations / compaction summaries. qodercli caps its own UI at 65536, still below the documented ceiling. - models.ts: introduce MAX_OUTPUT_TOKENS = 131072 as the single source of truth; all 24 staticModels entries + the lazy-loaded CN entry now reference it. Remove the dead max_output_tokens field from the CN placeholder entry. - stream.ts: maxTokens defaults to MAX_OUTPUT_TOKENS; still capped lower by options.maxTokens (e.g. pi compaction passes 40000). Verified against the real CN endpoint: max_tokens=131072 returns 200 / stop (accepted, not rejected); an xhigh reasoning run completes with finish_reason=stop (not truncated). Field placement + reasoning_effort send also confirmed working in the same request.
This commit is contained in:
+7
-5
@@ -20,7 +20,7 @@ import {
|
||||
getQoderUserEmailFallback,
|
||||
isQoderCNMode,
|
||||
} from "./cosy.js";
|
||||
import { getCachedModelConfig } from "./models.js";
|
||||
import { getCachedModelConfig, MAX_OUTPUT_TOKENS } from "./models.js";
|
||||
import { getCachedCredentials } from "./oauth.js";
|
||||
import { qoderEncodeBody } from "./qoder-encoding.js";
|
||||
import { stripThinkingTags, ThinkingTagParser } from "./thinking-parser.js";
|
||||
@@ -161,10 +161,12 @@ export function streamQoder(
|
||||
? `${stablePart}-${options.sessionId}`
|
||||
: `${stablePart}-${crypto.randomUUID()}`;
|
||||
|
||||
// Qoder's catalog exposes no per-model output cap (no max_output_tokens),
|
||||
// so we default to 32K (matches qodercli's 32e3 fallback) and let pi cap it
|
||||
// lower when the caller sets options.maxTokens (e.g. compaction at 40K).
|
||||
let maxTokens = 32768;
|
||||
// Qoder's catalog exposes no per-model output cap, so we use the
|
||||
// documented upstream ceiling (MAX_OUTPUT_TOKENS = 131072, see models.ts)
|
||||
// and let pi cap it lower when the caller sets options.maxTokens (e.g.
|
||||
// compaction at 40K). This avoids truncating reasoning chains / long
|
||||
// generations that the 32K default would cut off.
|
||||
let maxTokens = MAX_OUTPUT_TOKENS;
|
||||
if (options?.maxTokens && options.maxTokens < maxTokens) {
|
||||
maxTokens = options.maxTokens;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user