Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions proxy/src/routes/proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, string> = {};
for (const name of FORWARDED_HEADERS) {
for (const name of forwardHeaders) {
const value = req.headers[name];
if (typeof value === 'string') {
headers[name] = value;
Expand Down
2 changes: 2 additions & 0 deletions proxy/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, VendorConfig> = {
Expand All @@ -47,6 +48,7 @@ const VENDOR_CONFIGS: Record<string, VendorConfig> = {
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',
Expand Down