






















@@ -27,7 +27,8 @@ const ANTHROPIC_TIMEOUT_MS = 120_000;
2727const LIVE_CACHE_LANE_RETRIES = 1;
2828const LIVE_CACHE_RESPONSE_RETRIES = 2;
2929const OPENAI_CACHE_REASONING = "low" as unknown as never;
30-const CACHE_PROBE_MIN_MAX_TOKENS = 256;
30+const OPENAI_CACHE_PROBE_MIN_MAX_TOKENS = 256;
31+const ANTHROPIC_CACHE_PROBE_MIN_MAX_TOKENS = 1024;
3132const OPENAI_PREFIX = buildStableCachePrefix("openai");
3233const OPENAI_MCP_PREFIX = buildStableCachePrefix("openai-mcp-style");
3334const ANTHROPIC_PREFIX = buildStableCachePrefix("anthropic");
@@ -40,6 +41,7 @@ type ProviderKey = keyof typeof LIVE_CACHE_REGRESSION_BASELINE;
4041type CacheLane = "image" | "mcp" | "stable" | "tool";
4142type CacheUsage = {
4243input?: number;
44+output?: number;
4345cacheRead?: number;
4446cacheWrite?: number;
4547};
@@ -127,6 +129,7 @@ function normalizeCacheUsage(usage: AssistantMessage["usage"] | undefined): Cach
127129typeof value?.[key] === "number" ? value[key] : undefined;
128130return {
129131input: readNumber("input"),
132+output: readNumber("output"),
130133cacheRead: readNumber("cacheRead"),
131134cacheWrite: readNumber("cacheWrite"),
132135};
@@ -163,7 +166,11 @@ function resolveCacheProbeMaxTokens(params: {
163166providerTag: "anthropic" | "openai";
164167}): number {
165168const requested = params.maxTokens ?? 64;
166-return Math.max(requested, CACHE_PROBE_MIN_MAX_TOKENS);
169+const floor =
170+params.providerTag === "anthropic"
171+ ? ANTHROPIC_CACHE_PROBE_MIN_MAX_TOKENS
172+ : OPENAI_CACHE_PROBE_MIN_MAX_TOKENS;
173+return Math.max(requested, floor);
167174}
168175169176function shouldAcceptEmptyCacheProbe(params: {
@@ -301,7 +308,7 @@ async function completeCacheProbe(params: {
301308}
302309if (shouldRetryCacheProbeText({ attempt, suffix: params.suffix, text })) {
303310logLiveCache(
304-`${params.providerTag} cache lane ${params.suffix} response mismatch; retrying: ${JSON.stringify(text)}`,
311+`${params.providerTag} cache lane ${params.suffix} response mismatch; retrying: ${JSON.stringify(text)} stop=${response.stopReason} ${formatUsage(usage)}`,
305312);
306313continue;
307314}
@@ -438,7 +445,7 @@ async function runAnthropicDisabledLane(params: {
438445}
439446440447function formatUsage(usage: CacheUsage | undefined) {
441-return `cacheRead=${usage?.cacheRead ?? 0} cacheWrite=${usage?.cacheWrite ?? 0} input=${usage?.input ?? 0}`;
448+return `cacheRead=${usage?.cacheRead ?? 0} cacheWrite=${usage?.cacheWrite ?? 0} input=${usage?.input ?? 0} output=${usage?.output ?? 0}`;
442449}
443450444451function warmupHasCacheEvidence(params: { floor: LiveCacheFloor; warmup: CacheRun }): boolean {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。