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

推荐订阅源

Google DeepMind News
Google DeepMind News
aimingoo的专栏
aimingoo的专栏
爱范儿
爱范儿
D
Docker
I
InfoQ
Microsoft Security Blog
Microsoft Security Blog
G
Google Developers Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Vercel News
Vercel News
H
Hackread – Cybersecurity News, Data Breaches, AI and More
T
Tailwind CSS Blog
D
DataBreaches.Net
月光博客
月光博客
N
Netflix TechBlog - Medium
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
V
Visual Studio Blog
MyScale Blog
MyScale Blog
B
Blog
阮一峰的网络日志
阮一峰的网络日志
L
LangChain Blog
Recent Announcements
Recent Announcements
Microsoft Azure Blog
Microsoft Azure Blog
WordPress大学
WordPress大学

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(ci): require billable Anthropic release key · opencla...
vincentkoc · 2026-06-16 · via Recent Commits to openclaw:main
11

#!/usr/bin/env node

22

/**

3-

* Release preflight helper that verifies required provider API keys can reach

4-

* their model-list endpoints without printing secret values.

3+

* Release preflight helper that verifies required provider API keys without

4+

* printing secret values. Anthropic must complete a prompt because model-list

5+

* access does not prove billing or inference entitlement.

56

*/

67

import process from "node:process";

7889

const args = new Map();

910

for (let index = 2; index < process.argv.length; index += 1) {

1011

const arg = process.argv[index];

11-

if (!arg.startsWith("--")) continue;

12+

if (!arg.startsWith("--")) {

13+

continue;

14+

}

1215

const [key, inlineValue] = arg.slice(2).split("=", 2);

1316

const value = inlineValue ?? process.argv[index + 1];

14-

if (inlineValue === undefined) index += 1;

17+

if (inlineValue === undefined) {

18+

index += 1;

19+

}

1520

args.set(key, value);

1621

}

1722

@@ -28,7 +33,9 @@ const timeoutMs = Number(args.get("timeout-ms") ?? 10_000);

2833

function envFirst(names) {

2934

for (const name of names) {

3035

const value = process.env[name]?.trim();

31-

if (value) return { name, value };

36+

if (value) {

37+

return { name, value };

38+

}

3239

}

3340

return undefined;

3441

}

@@ -42,15 +49,21 @@ async function checkProvider(id, config) {

4249

const controller = new AbortController();

4350

const timer = setTimeout(() => controller.abort(), timeoutMs);

4451

try {

45-

const headers = config.headers(secret);

52+

const headers = config.headers(secret.value);

4653

const response = await fetch(config.url, {

54+

body: config.body,

4755

headers,

56+

method: config.method,

4857

signal: controller.signal,

4958

});

59+

const responseBody = config.validateResponse

60+

? await response.json().catch(() => undefined)

61+

: undefined;

62+

const ok = response.ok && (!config.validateResponse || config.validateResponse(responseBody));

5063

return {

5164

id,

52-

ok: response.ok,

53-

status: response.ok ? "ok" : `http_${response.status}`,

65+

ok,

66+

status: response.ok ? (ok ? "ok" : "invalid_response") : `http_${response.status}`,

5467

env: secret.name,

5568

};

5669

} catch (error) {

@@ -69,32 +82,35 @@ const providers = {

6982

openai: {

7083

env: ["OPENAI_API_KEY"],

7184

url: "https://api.openai.com/v1/models",

72-

headers: ({ value }) => ({ authorization: `Bearer ${value}` }),

85+

headers: (token) => ({ authorization: `Bearer ${token}` }),

7386

},

7487

anthropic: {

75-

env: ["ANTHROPIC_OAUTH_TOKEN", "ANTHROPIC_API_KEY", "ANTHROPIC_API_TOKEN"],

76-

url: "https://api.anthropic.com/v1/models",

77-

headers: ({ name, value }) =>

78-

name === "ANTHROPIC_OAUTH_TOKEN"

79-

? {

80-

"anthropic-beta": "oauth-2025-04-20",

81-

"anthropic-version": "2023-06-01",

82-

authorization: `Bearer ${value}`,

83-

}

84-

: {

85-

"anthropic-version": "2023-06-01",

86-

"x-api-key": value,

87-

},

88+

env: ["ANTHROPIC_API_KEY", "ANTHROPIC_API_TOKEN"],

89+

url: "https://api.anthropic.com/v1/messages",

90+

method: "POST",

91+

body: JSON.stringify({

92+

max_tokens: 8,

93+

messages: [{ role: "user", content: "Reply with OK." }],

94+

model: "claude-haiku-4-5",

95+

}),

96+

headers: (token) => ({

97+

"anthropic-version": "2023-06-01",

98+

"content-type": "application/json",

99+

"x-api-key": token,

100+

}),

101+

validateResponse: (body) =>

102+

Array.isArray(body?.content) &&

103+

body.content.some((part) => typeof part?.text === "string" && part.text.trim()),

88104

},

89105

fireworks: {

90106

env: ["FIREWORKS_API_KEY"],

91107

url: "https://api.fireworks.ai/inference/v1/models",

92-

headers: ({ value }) => ({ authorization: `Bearer ${value}` }),

108+

headers: (token) => ({ authorization: `Bearer ${token}` }),

93109

},

94110

openrouter: {

95111

env: ["OPENROUTER_API_KEY"],

96112

url: "https://openrouter.ai/api/v1/models",

97-

headers: ({ value }) => ({ authorization: `Bearer ${value}` }),

113+

headers: (token) => ({ authorization: `Bearer ${token}` }),

98114

},

99115

};

100116

@@ -115,7 +131,9 @@ let failed = false;

115131

for (const result of results) {

116132

const requiredLabel = required.has(result.id) ? "required" : "optional";

117133

console.log(`${result.id}: ${result.status} env=${result.env} ${requiredLabel}`);

118-

if (required.has(result.id) && !result.ok) failed = true;

134+

if (required.has(result.id) && !result.ok) {

135+

failed = true;

136+

}

119137

}

120138121139

if (failed) {