mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-17 04:31:42 +00:00
* fix(xai): align current model catalog and tools * chore(xai): defer release note to release closeout * docs: refresh xai documentation map
29 lines
859 B
TypeScript
29 lines
859 B
TypeScript
// Xai provider module implements model/runtime integration.
|
|
import type { ProviderPlugin } from "openclaw/plugin-sdk/provider-model-shared";
|
|
import { readProviderEnvValue } from "openclaw/plugin-sdk/provider-web-search";
|
|
import { resolveFallbackXaiAuth } from "./src/tool-auth-shared.js";
|
|
|
|
const PROVIDER_ID = "xai";
|
|
|
|
function resolveXaiSyntheticAuth(config: unknown) {
|
|
const apiKey =
|
|
resolveFallbackXaiAuth(config as never)?.apiKey || readProviderEnvValue(["XAI_API_KEY"]);
|
|
return apiKey
|
|
? {
|
|
apiKey,
|
|
source: "xAI plugin config",
|
|
mode: "api-key" as const,
|
|
}
|
|
: undefined;
|
|
}
|
|
|
|
const xaiProviderDiscovery: ProviderPlugin = {
|
|
id: PROVIDER_ID,
|
|
label: "xAI",
|
|
docsPath: "/providers/xai",
|
|
auth: [],
|
|
resolveSyntheticAuth: ({ config }) => resolveXaiSyntheticAuth(config),
|
|
};
|
|
|
|
export default xaiProviderDiscovery;
|