mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-24 08:21:39 +00:00
33 lines
829 B
TypeScript
33 lines
829 B
TypeScript
import {
|
|
applyAgentDefaultModelPrimary,
|
|
type OpenClawConfig,
|
|
} from "openclaw/plugin-sdk/provider-onboard";
|
|
|
|
export const OPENROUTER_DEFAULT_MODEL_REF = "openrouter/auto";
|
|
|
|
export function applyOpenrouterProviderConfig(cfg: OpenClawConfig): OpenClawConfig {
|
|
const models = { ...cfg.agents?.defaults?.models };
|
|
models[OPENROUTER_DEFAULT_MODEL_REF] = {
|
|
...models[OPENROUTER_DEFAULT_MODEL_REF],
|
|
alias: models[OPENROUTER_DEFAULT_MODEL_REF]?.alias ?? "OpenRouter",
|
|
};
|
|
|
|
return {
|
|
...cfg,
|
|
agents: {
|
|
...cfg.agents,
|
|
defaults: {
|
|
...cfg.agents?.defaults,
|
|
models,
|
|
},
|
|
},
|
|
};
|
|
}
|
|
|
|
export function applyOpenrouterConfig(cfg: OpenClawConfig): OpenClawConfig {
|
|
return applyAgentDefaultModelPrimary(
|
|
applyOpenrouterProviderConfig(cfg),
|
|
OPENROUTER_DEFAULT_MODEL_REF,
|
|
);
|
|
}
|