2026-03-17 00:14:01 -07:00
|
|
|
import { definePluginEntry } from "openclaw/plugin-sdk/core";
|
2026-03-16 21:13:56 -07:00
|
|
|
import { createProviderApiKeyAuthMethod } from "openclaw/plugin-sdk/provider-auth";
|
2026-03-16 21:33:50 -07:00
|
|
|
import { buildSingleProviderApiKeyCatalog } from "openclaw/plugin-sdk/provider-catalog";
|
2026-03-16 21:18:16 -07:00
|
|
|
import { applyQianfanConfig, QIANFAN_DEFAULT_MODEL_REF } from "./onboard.js";
|
2026-03-16 18:33:07 -07:00
|
|
|
import { buildQianfanProvider } from "./provider-catalog.js";
|
2026-03-15 16:09:21 -07:00
|
|
|
|
|
|
|
|
const PROVIDER_ID = "qianfan";
|
|
|
|
|
|
2026-03-17 00:14:01 -07:00
|
|
|
export default definePluginEntry({
|
2026-03-15 16:09:21 -07:00
|
|
|
id: PROVIDER_ID,
|
|
|
|
|
name: "Qianfan Provider",
|
|
|
|
|
description: "Bundled Qianfan provider plugin",
|
2026-03-17 00:14:01 -07:00
|
|
|
register(api) {
|
2026-03-15 16:09:21 -07:00
|
|
|
api.registerProvider({
|
|
|
|
|
id: PROVIDER_ID,
|
|
|
|
|
label: "Qianfan",
|
|
|
|
|
docsPath: "/providers/qianfan",
|
|
|
|
|
envVars: ["QIANFAN_API_KEY"],
|
2026-03-15 23:47:07 -07:00
|
|
|
auth: [
|
|
|
|
|
createProviderApiKeyAuthMethod({
|
|
|
|
|
providerId: PROVIDER_ID,
|
|
|
|
|
methodId: "api-key",
|
|
|
|
|
label: "Qianfan API key",
|
|
|
|
|
hint: "API key",
|
|
|
|
|
optionKey: "qianfanApiKey",
|
|
|
|
|
flagName: "--qianfan-api-key",
|
|
|
|
|
envVar: "QIANFAN_API_KEY",
|
|
|
|
|
promptMessage: "Enter Qianfan API key",
|
|
|
|
|
defaultModel: QIANFAN_DEFAULT_MODEL_REF,
|
|
|
|
|
expectedProviders: ["qianfan"],
|
|
|
|
|
applyConfig: (cfg) => applyQianfanConfig(cfg),
|
|
|
|
|
wizard: {
|
|
|
|
|
choiceId: "qianfan-api-key",
|
|
|
|
|
choiceLabel: "Qianfan API key",
|
|
|
|
|
groupId: "qianfan",
|
|
|
|
|
groupLabel: "Qianfan",
|
|
|
|
|
groupHint: "API key",
|
|
|
|
|
},
|
|
|
|
|
}),
|
|
|
|
|
],
|
2026-03-15 16:09:21 -07:00
|
|
|
catalog: {
|
|
|
|
|
order: "simple",
|
2026-03-17 04:03:07 +00:00
|
|
|
run: (ctx) =>
|
|
|
|
|
buildSingleProviderApiKeyCatalog({
|
|
|
|
|
ctx,
|
|
|
|
|
providerId: PROVIDER_ID,
|
|
|
|
|
buildProvider: buildQianfanProvider,
|
|
|
|
|
}),
|
2026-03-15 16:09:21 -07:00
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
},
|
2026-03-17 00:14:01 -07:00
|
|
|
});
|