diff --git a/proxy/src/routes/proxy.ts b/proxy/src/routes/proxy.ts index bd4d93c..f03dd79 100644 --- a/proxy/src/routes/proxy.ts +++ b/proxy/src/routes/proxy.ts @@ -73,9 +73,10 @@ export function registerProxyRoutes( keyId = keySelection.keyId; } - const FORWARDED_HEADERS = ['content-type', 'accept', 'user-agent']; + const COMMON_HEADERS = ['content-type', 'accept', 'user-agent']; + const forwardHeaders = [...COMMON_HEADERS, ...(vendorConfig.forwardHeaders ?? [])]; const headers: Record = {}; - for (const name of FORWARDED_HEADERS) { + for (const name of forwardHeaders) { const value = req.headers[name]; if (typeof value === 'string') { headers[name] = value; diff --git a/proxy/src/types.ts b/proxy/src/types.ts index 2d4f087..4c3dbbc 100644 --- a/proxy/src/types.ts +++ b/proxy/src/types.ts @@ -33,6 +33,7 @@ export interface VendorConfig { protocol?: 'http' | 'https'; // default: 'https' noAuth?: boolean; // Skip API key injection (e.g., local Ollama) forceNonStreaming?: boolean; // Strip stream:true, convert response to SSE + forwardHeaders?: string[]; // Extra vendor-specific headers to forward from client } const VENDOR_CONFIGS: Record = { @@ -47,6 +48,7 @@ const VENDOR_CONFIGS: Record = { basePath: '', // OpenClaw's anthropic-messages API includes /v1 in its path authHeader: 'x-api-key', authFormat: (key) => key, + forwardHeaders: ['anthropic-version', 'anthropic-beta'], }, venice: { host: 'api.venice.ai',