fix(model): claw-x header (#198)

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Haze <hazeone@users.noreply.github.com>
This commit is contained in:
Haze
2026-02-26 22:57:59 +08:00
committed by GitHub
Unverified
parent 2a50aea448
commit 87616b4250
4 changed files with 21 additions and 13 deletions

View File

@@ -34,6 +34,7 @@ interface ProviderBackendMeta {
api: string;
apiKeyEnv: string;
models?: ProviderModelEntry[];
headers?: Record<string, string>;
};
}
@@ -65,6 +66,10 @@ const REGISTRY: Record<string, ProviderBackendMeta> = {
baseUrl: 'https://openrouter.ai/api/v1',
api: 'openai-completions',
apiKeyEnv: 'OPENROUTER_API_KEY',
headers: {
'HTTP-Referer': 'https://claw-x.com',
'X-Title': 'ClawX',
},
},
},
moonshot: {
@@ -135,10 +140,10 @@ export function getProviderDefaultModel(type: string): string | undefined {
return REGISTRY[type]?.defaultModel;
}
/** Get the OpenClaw provider config (baseUrl, api, apiKeyEnv, models) */
/** Get the OpenClaw provider config (baseUrl, api, apiKeyEnv, models, headers) */
export function getProviderConfig(
type: string
): { baseUrl: string; api: string; apiKeyEnv: string; models?: ProviderModelEntry[] } | undefined {
): { baseUrl: string; api: string; apiKeyEnv: string; models?: ProviderModelEntry[]; headers?: Record<string, string> } | undefined {
return REGISTRY[type]?.providerConfig;
}