oclaw/openclaw/extensions/openai/provider-contract-api.ts
oliver dbbe3add6a 重构主控编排与运行时预热链路,统一工作区提示词/专家调度协议并补齐 wiki 记忆注入与写回闭环。
同时收敛启动与运维脚本默认行为(含 wiki worker)、更新 Admin 可观测性与相关测试,降低首轮时延并提高运行稳定性。

Made-with: Cursor
2026-04-26 08:34:33 +08:00

54 lines
1.3 KiB
TypeScript

import type { ProviderPlugin } from "openclaw/plugin-sdk/provider-model-shared";
const noopAuth = async () => ({ profiles: [] });
export function createOpenAICodexProvider(): ProviderPlugin {
return {
id: "openai-codex",
label: "OpenAI Codex",
docsPath: "/providers/models",
auth: [
{
id: "oauth",
kind: "oauth",
label: "ChatGPT OAuth",
hint: "Browser sign-in",
run: noopAuth,
},
],
wizard: {
setup: {
choiceId: "openai-codex",
choiceLabel: "OpenAI Codex (ChatGPT OAuth)",
choiceHint: "Browser sign-in",
methodId: "oauth",
},
},
};
}
export function createOpenAIProvider(): ProviderPlugin {
return {
id: "openai",
label: "OpenAI",
hookAliases: ["azure-openai", "azure-openai-responses"],
docsPath: "/providers/models",
envVars: ["OPENAI_API_KEY"],
auth: [
{
id: "api-key",
kind: "api_key",
label: "OpenAI API key",
hint: "Direct OpenAI API key",
run: noopAuth,
wizard: {
choiceId: "openai-api-key",
choiceLabel: "OpenAI API key",
groupId: "openai",
groupLabel: "OpenAI",
groupHint: "Codex OAuth + API key",
},
},
],
};
}