惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
酷 壳 – CoolShell
酷 壳 – CoolShell
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
腾讯CDC
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Jina AI
Jina AI
N
Netflix TechBlog - Medium
有赞技术团队
有赞技术团队
博客园 - 【当耐特】
MongoDB | Blog
MongoDB | Blog
P
Proofpoint News Feed
L
LangChain Blog
aimingoo的专栏
aimingoo的专栏
GbyAI
GbyAI
B
Blog
F
Fortinet All Blogs
T
Tailwind CSS Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
G
Google Developers Blog
A
About on SuperTechFans
C
Check Point Blog
Microsoft Security Blog
Microsoft Security Blog
MyScale Blog
MyScale Blog
B
Blog RSS Feed

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(openai): honor streaming usage compat · openclaw/open...
xuruiray · 2026-05-16 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -27,6 +27,16 @@ describe("resolveOpenAICompletionsCompatDefaults", () => {

2727

).toBe(true);

2828

});

2929
30+

it("keeps streaming usage enabled for local OpenAI-compatible endpoints", () => {

31+

expect(

32+

resolveOpenAICompletionsCompatDefaults({

33+

provider: "llama-cpp",

34+

endpointClass: "local",

35+

knownProviderFamily: "llama-cpp",

36+

}).supportsUsageInStreaming,

37+

).toBe(true);

38+

});

39+
3040

it("does not broaden streaming usage for generic custom providers", () => {

3141

expect(

3242

resolveOpenAICompletionsCompatDefaults({

Original file line numberDiff line numberDiff line change

@@ -72,6 +72,7 @@ export function resolveOpenAICompletionsCompatDefaults(

7272

(isDefaultRoute &&

7373

isDefaultRouteProvider(input.provider, "cerebras", "chutes", "deepseek", "opencode", "xai"));

7474

const isOpenRouterLike = input.provider === "openrouter" || endpointClass === "openrouter";

75+

const isLocalEndpoint = endpointClass === "local";

7576

const usesMaxTokens =

7677

endpointClass === "chutes-native" ||

7778

endpointClass === "mistral-public" ||

@@ -88,7 +89,8 @@ export function resolveOpenAICompletionsCompatDefaults(

8889

!usesExplicitProxyLikeEndpoint,

8990

supportsUsageInStreaming:

9091

supportsOpenAICompletionsStreamingUsageCompat ||

91-

(!isNonStandard && (!usesConfiguredNonOpenAIEndpoint || supportsNativeStreamingUsageCompat)),

92+

(!isNonStandard &&

93+

(isLocalEndpoint || !usesConfiguredNonOpenAIEndpoint || supportsNativeStreamingUsageCompat)),

9294

maxTokensField: usesMaxTokens ? "max_tokens" : "max_completion_tokens",

9395

thinkingFormat:

9496

isDeepSeek || isXiaomi

Original file line numberDiff line numberDiff line change

@@ -3151,7 +3151,34 @@ describe("openai transport stream", () => {

31513151

expect(params.stream_options?.include_usage).toBe(true);

31523152

});

31533153
3154-

it("always includes stream_options.include_usage for known local backends like llama-cpp", () => {

3154+

it("omits streaming usage options for Volcengine CodingPlan by default", () => {

3155+

const params = buildOpenAICompletionsParams(

3156+

{

3157+

id: "ark-code-latest",

3158+

name: "Ark Coding Plan",

3159+

api: "openai-completions",

3160+

provider: "volcengine-plan",

3161+

baseUrl: "https://ark.cn-beijing.volces.com/api/coding/v3",

3162+

reasoning: false,

3163+

input: ["text"],

3164+

cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },

3165+

contextWindow: 256000,

3166+

maxTokens: 4096,

3167+

} satisfies Model<"openai-completions">,

3168+

{

3169+

systemPrompt: "system",

3170+

messages: [],

3171+

tools: [],

3172+

} as never,

3173+

undefined,

3174+

) as {

3175+

stream_options?: unknown;

3176+

};

3177+
3178+

expect(params).not.toHaveProperty("stream_options");

3179+

});

3180+
3181+

it("includes stream_options.include_usage for known local backends like llama-cpp", () => {

31553182

const params = buildOpenAICompletionsParams(

31563183

{

31573184

id: "llama-3",

@@ -3277,7 +3304,7 @@ describe("openai transport stream", () => {

32773304
32783305

expect(params.messages?.[0]?.role).toBe("system");

32793306

expect(params).not.toHaveProperty("reasoning_effort");

3280-

expect(params.stream_options).toEqual({ include_usage: true });

3307+

expect(params).not.toHaveProperty("stream_options");

32813308

expect(params).not.toHaveProperty("store");

32823309

expect(params.tools?.[0]?.function).not.toHaveProperty("strict");

32833310

});

Original file line numberDiff line numberDiff line change

@@ -2583,8 +2583,10 @@ export function buildOpenAICompletionsParams(

25832583

? flattenCompletionMessagesToStringContent(messages)

25842584

: messages,

25852585

stream: true,

2586-

stream_options: { include_usage: true },

25872586

};

2587+

if (compat.supportsUsageInStreaming) {

2588+

params.stream_options = { include_usage: true };

2589+

}

25882590

if (compat.supportsStore) {

25892591

params.store = false;

25902592

}