


























@@ -9,6 +9,7 @@ import { describe, expect, it } from "vitest";
99import { streamAnthropic } from "../llm/providers/anthropic.js";
1010import { createAnthropicMessagesTransportStreamFn } from "./anthropic-transport-stream.js";
1111import { isLiveTestEnabled } from "./live-test-helpers.js";
12+import { isLiveBillingDrift } from "./live-test-provider-drift.js";
12131314const LIVE = isLiveTestEnabled(["ANTHROPIC_TRANSPORT_LIVE_TEST"]);
1415const describeLive = LIVE ? describe : describe.skip;
@@ -65,6 +66,17 @@ async function readRequestBody(request: http.IncomingMessage): Promise<string> {
6566return Buffer.concat(chunks).toString("utf8");
6667}
676869+function skipAnthropicBillingDrift(
70+label: string,
71+result: { stopReason: string; errorMessage?: string },
72+): boolean {
73+if (result.stopReason !== "error" || !isLiveBillingDrift(result.errorMessage ?? "")) {
74+return false;
75+}
76+console.warn(`[anthropic:live] skip ${label}: billing drift`);
77+return true;
78+}
79+6880describeLive("anthropic transport stream live", () => {
6981it("cancels an in-flight SSE body read over a real HTTP stream", async () => {
7082const controller = new AbortController();
@@ -198,6 +210,9 @@ describeProviderLive("anthropic transport stream provider live", () => {
198210);
199211200212const result = await stream.result();
213+if (skipAnthropicBillingDrift("forced tool projection", result)) {
214+return;
215+}
201216const toolCall = result.content.find(
202217(block) => block.type === "toolCall" && block.name === "healthy_probe",
203218);
@@ -257,6 +272,9 @@ describeProviderLive("anthropic transport stream provider live", () => {
257272);
258273259274const result = await stream.result();
275+if (skipAnthropicBillingDrift("SDK forced tool projection", result)) {
276+return;
277+}
260278const toolCall = result.content.find(
261279(block) => block.type === "toolCall" && block.name === "healthy_probe",
262280);
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。