Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

fix: restore provider typing against the Agents SDK declarations (#15161)

Danny Avilac52ba4efdbcd
diff --git a/packages/api/src/agents/memory.spec.ts b/packages/api/src/agents/memory.spec.ts
index 79d1c94f54..6ecd579422 100644
--- a/packages/api/src/agents/memory.spec.ts
+++ b/packages/api/src/agents/memory.spec.ts
@@ -3,6 +3,7 @@ import { Run, Providers, GraphEvents } from '@librechat/agents';
import { AIMessage, HumanMessage } from '@librechat/agents/langchain/messages';
import { Tools, MemoryScope, EModelEndpoint, AgentCapabilities } from 'librechat-data-provider';
import type { FiltersConfig } from 'librechat-data-provider';
+import type { RuntimeProviderName } from '@librechat/agents';
import type { IUser } from '@librechat/data-schemas';
import type { Response } from 'express';
import type { ServerRequest } from '~/types';
@@ -223,7 +224,7 @@ describe('Memory Agent Header Resolution', () => {
it('should resolve environment variables in custom endpoint headers', async () => {
const llmConfig = {
- provider: 'custom',
+ provider: 'custom' as RuntimeProviderName,
model: 'gpt-4o-mini',
configuration: {
defaultHeaders: {
@@ -258,7 +259,7 @@ describe('Memory Agent Header Resolution', () => {
it('should resolve user placeholders in custom endpoint headers', async () => {
const llmConfig = {
- provider: 'custom',
+ provider: 'custom' as RuntimeProviderName,
model: 'gpt-4o-mini',
configuration: {
defaultHeaders: {
@@ -293,7 +294,7 @@ describe('Memory Agent Header Resolution', () => {
it('should handle mixed environment variables and user placeholders', async () => {
const llmConfig = {
- provider: 'custom',
+ provider: 'custom' as RuntimeProviderName,
model: 'gpt-4o-mini',
configuration: {
defaultHeaders: {
@@ -330,7 +331,7 @@ describe('Memory Agent Header Resolution', () => {
it('should resolve env vars when user is undefined', async () => {
const llmConfig = {
- provider: 'custom',
+ provider: 'custom' as RuntimeProviderName,
model: 'gpt-4o-mini',
configuration: {
defaultHeaders: {
diff --git a/packages/api/src/types/agents.d.ts b/packages/api/src/types/agents.d.ts
new file mode 100644
index 0000000000..26c14e012c
--- /dev/null
+++ b/packages/api/src/types/agents.d.ts
@@ -0,0 +1,16 @@
+/**
+ * `@librechat/agents` publishes its declaration files with its internal `@/*` path aliases
+ * unrewritten, so a consumer cannot resolve them. `types/llm.d.ts` imports `Providers` that
+ * way, which leaves `ProviderOptionsMap`'s computed keys unresolved and collapses
+ * `keyof ProviderOptionsMap` to `number`. Until v3.6.16 that only degraded `LLMConfig`
+ * silently; v3.6.16 made `SharedLLMConfig` generic over that key union, so `provider` became
+ * `number | RuntimeProviderName` and no real provider was assignable to it.
+ *
+ * Declaring the one alias `llm.d.ts` needs restores the enum, and with it the provider key
+ * union. Remove this once the SDK ships declarations with its aliases resolved — note that
+ * mapping every `@/*` alias instead unmasks a large backlog of latent errors elsewhere in
+ * this package, so widening it is a separate cleanup rather than a drop-in improvement.
+ */
+declare module '@/common' {
+ export { Providers } from '@librechat/agents';
+}