🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
feat(llm-connections): allow extraHeaders for anthropic adapter (#12284)
Hassieb Pakzad90974e772c48
diff --git a/packages/shared/src/server/llm/fetchLLMCompletion.ts b/packages/shared/src/server/llm/fetchLLMCompletion.tsindex 3f950ce6ae..d4592cf8b0 100644--- a/packages/shared/src/server/llm/fetchLLMCompletion.ts+++ b/packages/shared/src/server/llm/fetchLLMCompletion.ts@@ -1,6 +1,6 @@import { type ZodSchema, z } from "zod/v4";-import { ChatAnthropic } from "@langchain/anthropic";+import { ChatAnthropic, ChatAnthropicInput } from "@langchain/anthropic";import { ChatVertexAI } from "@langchain/google-vertexai";import { ChatBedrockConverse } from "@langchain/aws";import { ChatGoogleGenerativeAI } from "@langchain/google-genai";@@ -260,7 +260,7 @@ export async function fetchLLMCompletion(modelParams.model?.includes("claude-opus-4-6") ||modelParams.model?.includes("claude-haiku-4-5");- const chatOptions: Record<string, any> = {+ const chatOptions: ChatAnthropicInput = {anthropicApiKey: apiKey,anthropicApiUrl: baseURL ?? undefined,model: modelParams.model,@@ -268,6 +268,7 @@ export async function fetchLLMCompletion(callbacks: finalCallbacks,clientOptions: {maxRetries,+ defaultHeaders: extraHeaders,timeout: timeoutMs,...(proxyDispatcher && {fetchOptions: { dispatcher: proxyDispatcher },@@ -276,7 +277,6 @@ export async function fetchLLMCompletion(temperature: modelParams.temperature,topP: modelParams.top_p,invocationKwargs: modelParams.providerOptions,- timeout: timeoutMs,};chatModel = new ChatAnthropic(chatOptions);diff --git a/web/src/features/public-api/components/CreateLLMApiKeyForm.tsx b/web/src/features/public-api/components/CreateLLMApiKeyForm.tsxindex be9c99d2fb..554edf3e4a 100644--- a/web/src/features/public-api/components/CreateLLMApiKeyForm.tsx+++ b/web/src/features/public-api/components/CreateLLMApiKeyForm.tsx@@ -1027,8 +1027,9 @@ export function CreateLLMApiKeyForm({)}{/* Extra Headers */}- {currentAdapter === LLMAdapter.OpenAI &&- renderExtraHeadersField()}+ {[LLMAdapter.OpenAI, LLMAdapter.Anthropic].includes(+ currentAdapter,+ ) && renderExtraHeadersField()}{/* With default models */}<FormField