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

🌞 feat: Add GPT-6 Sol and Luna Support (#16221)

lia-by-librechat[bot]feba26360b14
diff --git a/.env.example b/.env.example
index a85ba4c923..454f846030 100644
--- a/.env.example
+++ b/.env.example
@@ -595,7 +595,7 @@ GOOGLE_KEY=user_provided
#============#
OPENAI_API_KEY=user_provided
-# OPENAI_MODELS=gpt-6-astra,gpt-5.6,gpt-5.6-terra,gpt-5.6-luna,gpt-5.5,gpt-5.5-pro,chat-latest,gpt-5.4,gpt-5.4-pro,gpt-5.4-mini,gpt-5.4-nano,gpt-5.3-codex,gpt-5.2,gpt-5,gpt-5-codex,gpt-5-mini,gpt-5-nano,o3-pro,o3,o4-mini,gpt-4.1,gpt-4.1-mini,gpt-4.1-nano,o3-mini,o1-pro,o1,gpt-4o,gpt-4o-mini
+# OPENAI_MODELS=gpt-6-astra,gpt-6-sol,gpt-6-luna,gpt-5.6,gpt-5.6-terra,gpt-5.6-luna,gpt-5.5,gpt-5.5-pro,chat-latest,gpt-5.4,gpt-5.4-pro,gpt-5.4-mini,gpt-5.4-nano,gpt-5.3-codex,gpt-5.2,gpt-5,gpt-5-codex,gpt-5-mini,gpt-5-nano,o3-pro,o3,o4-mini,gpt-4.1,gpt-4.1-mini,gpt-4.1-nano,o3-mini,o1-pro,o1,gpt-4o,gpt-4o-mini
DEBUG_OPENAI=false
diff --git a/client/src/Providers/__tests__/DragDropContext.spec.tsx b/client/src/Providers/__tests__/DragDropContext.spec.tsx
index 946ced7de2..3c7e18811b 100644
--- a/client/src/Providers/__tests__/DragDropContext.spec.tsx
+++ b/client/src/Providers/__tests__/DragDropContext.spec.tsx
@@ -5,7 +5,21 @@ import type { TEndpointsConfig, Agent } from 'librechat-data-provider';
import { DragDropProvider, useDragDropContext } from '../DragDropContext';
const mockEndpointsConfig: TEndpointsConfig = {
- [EModelEndpoint.openAI]: { userProvide: false, order: 0 },
+ [EModelEndpoint.openAI]: {
+ userProvide: false,
+ order: 0,
+ responsesApiRouting: {
+ 'gpt-6-sol': { default: true, on: true, off: false },
+ 'gpt-6-luna': { default: true, on: true, off: false },
+ },
+ },
+ [EModelEndpoint.azureOpenAI]: {
+ order: 2,
+ responsesApiRouting: {
+ 'gpt-6-sol': { default: true, on: true, off: false },
+ 'gpt-6-luna': { default: true, on: true, off: false },
+ },
+ },
[EModelEndpoint.agents]: { userProvide: false, order: 1 },
[EModelEndpoint.anthropic]: { userProvide: false, order: 6 },
Moonshot: { type: EModelEndpoint.custom, userProvide: false, order: 9999 },
@@ -34,6 +48,64 @@ function wrapper({ children }: { children: React.ReactNode }) {
}
describe('DragDropContext endpointType resolution', () => {
+ it('uses the environment Azure wildcard for a discovered snapshot and carries saved web search through a proxy', () => {
+ const entry = mockEndpointsConfig![EModelEndpoint.azureOpenAI]!;
+ const previous = entry.responsesApiRouting;
+ entry.responsesApiRouting = {
+ 'gpt-6-sol-*': {
+ default: false,
+ on: true,
+ off: false,
+ withWebSearch: { default: true, on: true, off: true },
+ },
+ };
+ try {
+ mockConversation = { endpoint: EModelEndpoint.agents, agent_id: 'agent-1' };
+ mockAgentQueryData = {
+ provider: EModelEndpoint.azureOpenAI,
+ model: 'gpt-6-sol-2026-09-22',
+ model_parameters: { web_search: true },
+ } as Partial<Agent>;
+ const { result, rerender } = renderHook(() => useDragDropContext(), { wrapper });
+ expect(result.current.useResponsesApi).toBe(true);
+ mockAgentQueryData = {
+ ...mockAgentQueryData,
+ model_parameters: { web_search: false },
+ } as Partial<Agent>;
+ rerender();
+ expect(result.current.useResponsesApi).toBe(false);
+ } finally {
+ entry.responsesApiRouting = previous;
+ }
+ });
+
+ it.each([EModelEndpoint.openAI, EModelEndpoint.azureOpenAI])(
+ 'honors server opt-outs on %s across direct and saved-agent uploads',
+ (endpoint) => {
+ const entry = mockEndpointsConfig![endpoint]!;
+ const previous = entry.responsesApiRouting;
+ entry.responsesApiRouting = { 'gpt-6-sol': { default: false, on: false, off: false } };
+ try {
+ mockConversation = { endpoint, model: 'gpt-6-sol', useResponsesApi: true };
+ const { result, rerender } = renderHook(() => useDragDropContext(), { wrapper });
+ expect(result.current.useResponsesApi).toBe(false);
+ mockConversation = { endpoint: EModelEndpoint.agents, agent_id: 'agent-1' };
+ mockAgentQueryData = {
+ provider: endpoint,
+ model: 'gpt-6-sol',
+ model_parameters: {},
+ } as Partial<Agent>;
+ rerender();
+ expect(result.current.useResponsesApi).toBe(false);
+ entry.responsesApiRouting = undefined;
+ rerender();
+ expect(result.current.useResponsesApi).not.toBe(true);
+ } finally {
+ entry.responsesApiRouting = previous;
+ }
+ },
+ );
+
beforeEach(() => {
mockConversation = null;
mockAgentsMap = {};
@@ -47,6 +119,18 @@ describe('DragDropContext endpointType resolution', () => {
expect(result.current.endpointType).toBe(EModelEndpoint.custom);
});
+ it.each([EModelEndpoint.openAI, EModelEndpoint.azureOpenAI])(
+ 'derives Responses for a direct %s Sol conversation but preserves false',
+ (endpoint) => {
+ mockConversation = { endpoint, model: 'gpt-6-sol' };
+ const { result, rerender } = renderHook(() => useDragDropContext(), { wrapper });
+ expect(result.current.useResponsesApi).toBe(true);
+ mockConversation = { endpoint, model: 'gpt-6-sol', useResponsesApi: false };
+ rerender();
+ expect(result.current.useResponsesApi).toBe(false);
+ },
+ );
+
it('resolves endpoint name for a standard endpoint', () => {
mockConversation = { endpoint: EModelEndpoint.openAI };
const { result } = renderHook(() => useDragDropContext(), { wrapper });
@@ -152,6 +236,32 @@ describe('DragDropContext endpointType resolution', () => {
expect(result.current.useResponsesApi).toBe(true);
});
+ it.each(['gpt-6-sol', 'gpt-6-luna'])(
+ 'derives Responses for an unset Azure %s agent without mutating its setting',
+ (model) => {
+ mockConversation = { endpoint: EModelEndpoint.agents, agent_id: 'agent-1' };
+ mockAgentQueryData = {
+ provider: EModelEndpoint.azureOpenAI,
+ model,
+ model_parameters: {},
+ } as Partial<Agent>;
+ const { result } = renderHook(() => useDragDropContext(), { wrapper });
+ expect(result.current.useResponsesApi).toBe(true);
+ expect(mockAgentQueryData.model_parameters?.useResponsesApi).toBeUndefined();
+ },
+ );
+
+ it('preserves an explicit false for an Azure Sol agent', () => {
+ mockConversation = { endpoint: EModelEndpoint.agents, agent_id: 'agent-1' };
+ mockAgentQueryData = {
+ provider: EModelEndpoint.azureOpenAI,
+ model: 'gpt-6-sol',
+ model_parameters: { useResponsesApi: false },
+ } as Partial<Agent>;
+ const { result } = renderHook(() => useDragDropContext(), { wrapper });
+ expect(result.current.useResponsesApi).toBe(false);
+ });
+
it('keeps the conversation setting when the agent states none', () => {
mockConversation = {
endpoint: EModelEndpoint.agents,
diff --git a/client/src/components/Endpoints/Settings/OpenAI.tsx b/client/src/components/Endpoints/Settings/OpenAI.tsx
index db0afbe47d..dff953d79d 100644
--- a/client/src/components/Endpoints/Settings/OpenAI.tsx
+++ b/client/src/components/Endpoints/Settings/OpenAI.tsx
@@ -1,9 +1,9 @@
import { useMemo } from 'react';
-import { getSettingsKeys } from 'librechat-data-provider';
+import { presetSettings, getSettingsKeys, applyModelAwareDefaults } from 'librechat-data-provider';
import type { SettingDefinition } from 'librechat-data-provider';
import type { TModelSelectProps } from '~/common';
import { componentMapping } from '~/components/SidePanel/Parameters/components';
-import { presetSettings } from 'librechat-data-provider';
+import { useGetEndpointsQuery } from '~/data-provider';
export default function OpenAISettings({
conversation,
@@ -11,13 +11,31 @@ export default function OpenAISettings({
models,
readonly,
}: TModelSelectProps) {
+ const { data: endpointsConfig } = useGetEndpointsQuery();
const parameters = useMemo(() => {
const [combinedKey, endpointKey] = getSettingsKeys(
conversation?.endpointType ?? conversation?.endpoint ?? '',
conversation?.model ?? '',
);
- return presetSettings[combinedKey] ?? presetSettings[endpointKey];
- }, [conversation]);
+ const settings = presetSettings[combinedKey] ?? presetSettings[endpointKey];
+ if (!settings) {
+ return undefined;
+ }
+ return {
+ col1: applyModelAwareDefaults(
+ settings.col1,
+ endpointKey,
+ conversation?.model ?? undefined,
+ endpointsConfig?.[conversation?.endpoint ?? '']?.responsesApiRouting,
+ ),
+ col2: applyModelAwareDefaults(
+ settings.col2,
+ endpointKey,
+ conversation?.model ?? undefined,
+ endpointsConfig?.[conversation?.endpoint ?? '']?.responsesApiRouting,
+ ),
+ };
+ }, [conversation, endpointsConfig]);
if (!parameters) {
return null;
@@ -34,7 +52,6 @@ export default function OpenAISettings({
const { key, default: defaultValue, ...rest } = setting;
const props = {
- key,
settingKey: key,
defaultValue,
...rest,
@@ -44,10 +61,10 @@ export default function OpenAISettings({
};
if (key === 'model') {
- return <Component {...props} options={models} />;
+ return <Component key={key} {...props} options={models} />;
}
- return <Component {...props} />;
+ return <Component key={key} {...props} />;
};
return (
diff --git a/client/src/components/Endpoints/Settings/__tests__/OpenAI.spec.tsx b/client/src/components/Endpoints/Settings/__tests__/OpenAI.spec.tsx
new file mode 100644
index 0000000000..3c6382a3f9
--- /dev/null
+++ b/client/src/components/Endpoints/Settings/__tests__/OpenAI.spec.tsx
@@ -0,0 +1,139 @@
+import React from 'react';
+import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
+import { EModelEndpoint, ReasoningEffort, QueryKeys } from 'librechat-data-provider';
+import type { TSetOption } from 'librechat-data-provider';
+import type { TModelSelectProps } from '~/common';
+import {
+ pruneAgentModelParameters,
+ resolveAgentParameterSettings,
+} from '~/components/SidePanel/Agents/parameters';
+import { render, screen, fireEvent, waitFor } from 'test/layout-test-utils';
+import { ChatContext } from '~/Providers';
+import OpenAISettings from '../OpenAI';
+
+const context = { preset: null } as React.ContextType<typeof ChatContext>;
+describe.each([EModelEndpoint.openAI, EModelEndpoint.azureOpenAI])(
+ '%s Sol/Luna settings',
+ (endpoint) => {
+ it.each(['gpt-6-sol', 'gpt-6-luna'])(
+ 'preserves stored effort when switching to %s and back',
+ async (model) => {
+ const commit = jest.fn();
+ const setOption: TSetOption = jest.fn(() => commit);
+ const saved = {
+ endpoint,
+ model: 'gpt-5.6',
+ reasoning_effort: ReasoningEffort.minimal,
+ temperature: 0.7,
+ } as TModelSelectProps['conversation'];
+ const queryClient = new QueryClient();
+ queryClient.setQueryData([QueryKeys.endpoints], {});
+ const view = (model: string) => (
+ <QueryClientProvider client={queryClient}>
+ <ChatContext.Provider value={context}>
+ <OpenAISettings
+ conversation={{ ...saved, model } as TModelSelectProps['conversation']}
+ setOption={setOption}
+ models={['gpt-5.6', model]}
+ />
+ </ChatContext.Provider>
+ </QueryClientProvider>
+ );
+ const { rerender } = render(view('gpt-5.6'));
+ const slider = () => screen.getByRole('slider', { name: 'Reasoning Effort' });
+ expect(slider()).toHaveAttribute('aria-valuemax', '7');
+ rerender(view(model));
+ expect(slider()).toHaveAttribute('aria-valuemax', '6');
+ expect(saved?.reasoning_effort).toBe(ReasoningEffort.minimal);
+ fireEvent.keyDown(slider(), { key: 'End' });
+ await waitFor(() => expect(commit).toHaveBeenLastCalledWith(ReasoningEffort.max));
+ expect(setOption).toHaveBeenCalledWith('reasoning_effort');
+ rerender(view('gpt-5.6'));
+ expect(slider()).toHaveAttribute('aria-valuemax', '7');
+ expect(saved?.temperature).toBe(0.7);
+ },
+ );
+ it.each(['gpt-6-sol', 'gpt-6-luna'])(
+ 'shows effective Responses routing for unset %s while preserving explicit false',
+ (model) => {
+ const setOption: TSetOption = jest.fn(() => jest.fn());
+ const queryClient = new QueryClient();
+ queryClient.setQueryData([QueryKeys.endpoints], {
+ [endpoint]: { responsesApiRouting: { [model]: { default: true, on: true, off: false } } },
+ });
+ const view = (useResponsesApi?: boolean) => (
+ <QueryClientProvider client={queryClient}>
+ <ChatContext.Provider value={context}>
+ <OpenAISettings
+ conversation={
+ { endpoint, model, useResponsesApi } as TModelSelectProps['conversation']
+ }
+ setOption={setOption}
+ models={[model]}
+ />
+ </ChatContext.Provider>
+ </QueryClientProvider>
+ );
+ const { rerender } = render(view());
+ expect(screen.getByRole('switch', { name: 'Use Responses API' })).toBeChecked();
+ rerender(view(false));
+ expect(screen.getByRole('switch', { name: 'Use Responses API' })).not.toBeChecked();
+ },
+ );
+
+ it.each([false, true])(
+ 'displays an admin-forced route %s without replacing a saved opposite toggle',
+ (effective) => {
+ const queryClient = new QueryClient();
+ const model = 'gpt-6-sol';
+ queryClient.setQueryData([QueryKeys.endpoints], {
+ [endpoint]: {
+ responsesApiRouting: {
+ [model]: { default: effective, on: effective, off: effective },
+ },
+ },
+ });
+ const setOption: TSetOption = jest.fn(() => jest.fn());
+ const conversation = {
+ endpoint,
+ model,
+ useResponsesApi: !effective,
+ } as TModelSelectProps['conversation'];
+ render(
+ <QueryClientProvider client={queryClient}>
+ <ChatContext.Provider value={context}>
+ <OpenAISettings conversation={conversation} setOption={setOption} models={[model]} />
+ </ChatContext.Provider>
+ </QueryClientProvider>,
+ );
+ const toggle = screen.getByRole('switch', { name: 'Use Responses API' });
+ expect(toggle).toHaveAttribute('aria-checked', String(effective));
+ expect(toggle).toBeDisabled();
+ expect(conversation?.useResponsesApi).toBe(!effective);
+ expect(setOption).not.toHaveBeenCalled();
+ },
+ );
+
+ it('keeps unsupported saved effort through the agent pruning boundary', () => {
+ const settings = resolveAgentParameterSettings({
+ provider: endpoint,
+ model: 'gpt-6-sol',
+ webSearchAllowed: true,
+ });
+ const saved = {
+ temperature: 0.7,
+ maxContextTokens: null,
+ max_context_tokens: null,
+ max_output_tokens: null,
+ top_p: null,
+ frequency_penalty: null,
+ presence_penalty: null,
+ reasoning_effort: ReasoningEffort.minimal,
+ };
+ expect(pruneAgentModelParameters(saved, settings)).toBe(saved);
+ expect(
+ settings.visibleParameters.find(({ key }) => key === 'reasoning_effort')?.options,
+ ).not.toContain(ReasoningEffort.minimal);
+ });
+ },
+);
diff --git a/client/src/components/SidePanel/Agents/parameters.ts b/client/src/components/SidePanel/Agents/parameters.ts
index 10dde09445..a9a59ac39f 100644
--- a/client/src/components/SidePanel/Agents/parameters.ts
+++ b/client/src/components/SidePanel/Agents/parameters.ts
@@ -75,7 +75,12 @@ export function resolveAgentParameterSettings({
const applyOverride = (param: SettingDefinition) =>
(overriddenParamsMap[param.key] as SettingDefinition) ?? param;
const parameters = endpointParams.map(applyOverride);
- const visibleParameters = applyModelAwareDefaults(endpointParams, overriddenEndpointKey, model)
+ const visibleParameters = applyModelAwareDefaults(
+ endpointParams,
+ overriddenEndpointKey,
+ model,
+ resolvedEndpointsConfig[provider]?.responsesApiRouting,
+ )
.map(applyOverride)
.filter((param) => param.key !== 'web_search' || webSearchAllowed);
diff --git a/client/src/components/SidePanel/Parameters/DynamicSlider.tsx b/client/src/components/SidePanel/Parameters/DynamicSlider.tsx
index 665c5055ed..d4979e04b4 100644
--- a/client/src/components/SidePanel/Parameters/DynamicSlider.tsx
+++ b/client/src/components/SidePanel/Parameters/DynamicSlider.tsx
@@ -228,7 +228,11 @@ function DynamicSlider({
disabled={readonly}
value={[
isEnum
- ? enumToNumeric[(selectedValue as number) ?? '']
+ ? // A model switch may hide a saved enum value. Keep its stored value
+ // but retain a valid thumb so keyboard users can choose a supported one.
+ (enumToNumeric[String(selectedValue ?? '')] ??
+ enumToNumeric[String(defaultValue)] ??
+ 0)
: ((inputValue as number) ?? (defaultValue as number)),
]}
onValueChange={(value) => handleValueChange(value[0])}
diff --git a/client/src/components/SidePanel/Parameters/DynamicSwitch.tsx b/client/src/components/SidePanel/Parameters/DynamicSwitch.tsx
index 07d2a7b3db..c9772dc20a 100644
--- a/client/src/components/SidePanel/Parameters/DynamicSwitch.tsx
+++ b/client/src/components/SidePanel/Parameters/DynamicSwitch.tsx
@@ -10,6 +10,7 @@ function DynamicSwitch({
label = '',
settingKey,
defaultValue,
+ enumMappings,
description = '',
columnSpan,
setOption,
@@ -32,7 +33,11 @@ function DynamicSwitch({
preventDelayedUpdate: true,
});
- const selectedValue = conversation?.[settingKey] ?? defaultValue;
+ const savedValue = conversation?.[settingKey] ?? defaultValue;
+ const effectiveValue = enumMappings?.[String(savedValue)];
+ const selectedValue = typeof effectiveValue === 'boolean' ? effectiveValue : savedValue;
+ const routeIsForced =
+ typeof enumMappings?.true === 'boolean' && enumMappings.true === enumMappings.false;
const handleCheckedChange = (checked: boolean) => {
setInputValue(checked);
@@ -65,7 +70,7 @@ function DynamicSwitch({
id={`${settingKey}-dynamic-switch`}
checked={selectedValue}
onCheckedChange={handleCheckedChange}
- disabled={readonly}
+ disabled={readonly || routeIsForced}
className="flex"
aria-label={
labelCode ? (localize(label as TranslationKeys) ?? label) : label || settingKey
diff --git a/client/src/components/SidePanel/Parameters/Panel.tsx b/client/src/components/SidePanel/Parameters/Panel.tsx
index f35155c127..a9b7b0cf6b 100644
--- a/client/src/components/SidePanel/Parameters/Panel.tsx
+++ b/client/src/components/SidePanel/Parameters/Panel.tsx
@@ -68,9 +68,12 @@ export default function Parameters() {
const parameters = defaultParams.filter(
(param) => param != null && !dropParamsSet.has(param.key),
);
- const visibleParameters = applyModelAwareDefaults(parameters, overriddenEndpointKey, model).map(
- (param) => (overriddenParamsMap[param.key] as SettingDefinition) ?? param,
- );
+ const visibleParameters = applyModelAwareDefaults(
+ parameters,
+ overriddenEndpointKey,
+ model,
+ endpointsConfig?.[provider ?? '']?.responsesApiRouting,
+ ).map((param) => (overriddenParamsMap[param.key] as SettingDefinition) ?? param);
return { parameters, visibleParameters };
}, [endpointType, endpointsConfig, model, provider, startupConfig]);
diff --git a/client/src/components/SidePanel/Parameters/__tests__/DynamicSlider.spec.tsx b/client/src/components/SidePanel/Parameters/__tests__/DynamicSlider.spec.tsx
index 936e3e4e92..dff9725dbd 100644
--- a/client/src/components/SidePanel/Parameters/__tests__/DynamicSlider.spec.tsx
+++ b/client/src/components/SidePanel/Parameters/__tests__/DynamicSlider.spec.tsx
@@ -1,5 +1,6 @@
import React from 'react';
-import { render, screen, act, fireEvent } from '@testing-library/react';
+import { ReasoningEffort } from 'librechat-data-provider';
+import { render, screen, act, fireEvent, waitFor } from '@testing-library/react';
import type { TSetOption, SettingRange } from 'librechat-data-provider';
import DynamicSlider from '../DynamicSlider';
import { ChatContext } from '~/Providers';
@@ -51,6 +52,27 @@ function setupSentinel(conversationValue: number) {
}
describe('DynamicSlider', () => {
+ it('keeps a valid keyboard thumb when a saved enum value is no longer offered', async () => {
+ const commit = jest.fn();
+ const setOption = jest.fn(() => commit);
+ render(
+ <ChatContext.Provider value={chatContextValue}>
+ <DynamicSlider
+ settingKey="reasoning_effort"
+ label="Reasoning Effort"
+ defaultValue=""
+ options={['', 'none', 'low', 'medium', 'high', 'xhigh', 'max']}
+ conversation={{ reasoning_effort: ReasoningEffort.minimal }}
+ setOption={setOption}
+ />
+ </ChatContext.Provider>,
+ );
+ const slider = screen.getByRole('slider', { name: 'Reasoning Effort' });
+ expect(slider).toHaveAttribute('aria-valuenow', '0');
+ fireEvent.keyDown(slider, { key: 'End' });
+ await waitFor(() => expect(commit).toHaveBeenLastCalledWith('max'));
+ });
+
beforeEach(() => {
jest.useFakeTimers();
});
diff --git a/client/src/hooks/Agents/useAgentUploadTarget.ts b/client/src/hooks/Agents/useAgentUploadTarget.ts
index f57d74ddb9..be1f5f1d88 100644
--- a/client/src/hooks/Agents/useAgentUploadTarget.ts
+++ b/client/src/hooks/Agents/useAgentUploadTarget.ts
@@ -1,6 +1,7 @@
import { useMemo } from 'react';
import {
isAgentsEndpoint,
+ resolveEffectiveUseResponsesApi,
resolveEndpointType,
resolveUseResponsesApi,
} from 'librechat-data-provider';
@@ -55,15 +56,43 @@ export default function useAgentUploadTarget(
);
const useResponsesApi = useMemo(() => {
- if (!isAgents || agentId == null || agentId === '') {
- return conversation?.useResponsesApi;
- }
- return resolveUseResponsesApi(
- agentData?.model_parameters?.useResponsesApi ??
- agentsMap?.[agentId]?.model_parameters?.useResponsesApi,
- conversation?.useResponsesApi,
- );
- }, [isAgents, agentId, conversation?.useResponsesApi, agentData, agentsMap]);
+ const mappedAgent = agentId ? agentsMap?.[agentId] : undefined;
+ const savedValue =
+ isAgents && agentId != null && agentId !== ''
+ ? resolveUseResponsesApi(
+ agentData?.model_parameters?.useResponsesApi ??
+ mappedAgent?.model_parameters?.useResponsesApi,
+ conversation?.useResponsesApi,
+ )
+ : conversation?.useResponsesApi;
+ const model = isAgents
+ ? (agentData?.model_parameters?.model ??
+ mappedAgent?.model_parameters?.model ??
+ agentData?.model ??
+ mappedAgent?.model)
+ : conversation?.model;
+ return resolveEffectiveUseResponsesApi({
+ value: savedValue,
+ endpoint: endpointType,
+ model,
+ webSearch: isAgents
+ ? (agentData?.model_parameters?.web_search ?? mappedAgent?.model_parameters?.web_search)
+ : conversation?.web_search,
+ routing: endpointsConfig?.[agentProvider ?? endpoint ?? '']?.responsesApiRouting,
+ });
+ }, [
+ isAgents,
+ agentId,
+ endpointType,
+ endpoint,
+ agentProvider,
+ endpointsConfig,
+ conversation?.model,
+ conversation?.useResponsesApi,
+ conversation?.web_search,
+ agentData,
+ agentsMap,
+ ]);
return { agentProvider, endpointType, useResponsesApi };
}
diff --git a/client/src/hooks/Files/__tests__/useFileHandling.test.ts b/client/src/hooks/Files/__tests__/useFileHandling.test.ts
index 564b7279f6..898d8eb0d4 100644
--- a/client/src/hooks/Files/__tests__/useFileHandling.test.ts
+++ b/client/src/hooks/Files/__tests__/useFileHandling.test.ts
@@ -1145,6 +1145,69 @@ describe('useFileHandling', () => {
);
});
+ it.each([true, false])(
+ 'sends server-effective Responses %s rather than guessing from the Azure model',
+ async (effective) => {
+ mockConversation = { conversationId: 'convo-1', endpoint: 'agents', agent_id: 'agent_a1' };
+ mockAgentsMap = {
+ agent_a1: {
+ provider: EModelEndpoint.azureOpenAI,
+ model: 'gpt-6-sol',
+ model_parameters: {},
+ },
+ };
+ mockEndpointsConfig = {
+ [EModelEndpoint.azureOpenAI]: {
+ order: 0,
+ responsesApiRouting: {
+ 'gpt-6-sol': { default: effective, on: effective, off: false },
+ },
+ },
+ };
+ const useFileHandling = await loadHook();
+ const { result } = renderHook(() => useFileHandling());
+ await act(async () => {
+ await result.current.handleFiles([new File(['hi'], 'a.txt', { type: 'text/plain' })]);
+ });
+ const formData: FormData = mockMutate.mock.calls[0][0];
+ expect(formData.get('useResponsesApi')).toBe(effective ? 'true' : null);
+ },
+ );
+
+ it.each([false, true])(
+ 'uploads a snapshot with server policy and provider web search=%s',
+ async (webSearch) => {
+ mockConversation = { conversationId: 'convo-1', endpoint: 'agents', agent_id: 'agent_a1' };
+ mockAgentsMap = {
+ agent_a1: {
+ provider: EModelEndpoint.azureOpenAI,
+ model: 'gpt-6-sol-2026-09-22',
+ model_parameters: { web_search: webSearch },
+ },
+ };
+ mockEndpointsConfig = {
+ [EModelEndpoint.azureOpenAI]: {
+ order: 0,
+ responsesApiRouting: {
+ 'gpt-6-sol-*': {
+ default: false,
+ on: true,
+ off: false,
+ withWebSearch: { default: true, on: true, off: true },
+ },
+ },
+ },
+ };
+ const useFileHandling = await loadHook();
+ const { result } = renderHook(() => useFileHandling());
+ await act(async () => {
+ await result.current.handleFiles([new File(['hi'], 'a.txt', { type: 'text/plain' })]);
+ });
+ const formData: FormData = mockMutate.mock.calls[0][0];
+ expect(formData.get('useResponsesApi')).toBe(webSearch ? 'true' : null);
+ },
+ );
+
it('sends the Responses flag a saved agent holds on its own record', async () => {
/* A saved Azure agent keeps the setting in model_parameters, and without it the
* server routes a natively supported PDF to extracted text. */
diff --git a/packages/api/src/endpoints/config/endpoints.ts b/packages/api/src/endpoints/config/endpoints.ts
index 4e2cf87a3e..4578261044 100644
--- a/packages/api/src/endpoints/config/endpoints.ts
+++ b/packages/api/src/endpoints/config/endpoints.ts
@@ -12,6 +12,7 @@ import type { ServerRequest, TCustomEndpointsConfig } from '~/types';
import type { GetAppConfigOptions } from '~/app/service';
import { loadCustomEndpointsConfig as defaultLoadCustomEndpoints } from '~/endpoints/custom';
import { getAppConfigOptionsFromUser } from '~/app/service';
+import { getResponsesApiRouting } from './responses';
type PartialEndpointEntry = Partial<TConfig> & Record<string, unknown>;
type DefaultEndpointsResult = Record<string, PartialEndpointEntry | false | null>;
@@ -47,6 +48,15 @@ export function createEndpointsConfigService(deps: EndpointsConfigDeps): {
mergedConfig[EModelEndpoint.azureOpenAI] = { userProvide: false };
}
+ for (const endpoint of [EModelEndpoint.openAI, EModelEndpoint.azureOpenAI] as const) {
+ const entry = mergedConfig[endpoint];
+ if (entry)
+ mergedConfig[endpoint] = {
+ ...entry,
+ responsesApiRouting: getResponsesApiRouting(appConfig, endpoint),
+ };
+ }
+
if (appConfig.endpoints?.[EModelEndpoint.anthropic]?.vertexConfig?.enabled) {
mergedConfig[EModelEndpoint.anthropic] = { userProvide: false };
}
diff --git a/packages/api/src/endpoints/config/responses.spec.ts b/packages/api/src/endpoints/config/responses.spec.ts
new file mode 100644
index 0000000000..6455924c7d
--- /dev/null
+++ b/packages/api/src/endpoints/config/responses.spec.ts
@@ -0,0 +1,215 @@
+import {
+ EModelEndpoint,
+ resolveEffectiveUseResponsesApi,
+ validateAzureGroups,
+} from 'librechat-data-provider';
+import type { OpenAIClientOptions } from '@librechat/agents';
+import type { TAzureGroup } from 'librechat-data-provider';
+import type { AppConfig } from '@librechat/data-schemas';
+import { createEndpointsConfigService } from './endpoints';
+import { initializeOpenAI } from '../openai/initialize';
+import { getResponsesApiRouting } from './responses';
+
+// Only DNS/URL validation is stubbed. Actual credential resolution, group
+// selection, parameter precedence and getOpenAIConfig all execute below.
+jest.mock('~/auth', () => ({
+ ...jest.requireActual('~/auth'),
+ validateEndpointURL: jest.fn().mockResolvedValue(undefined),
+}));
+const config = (endpoints: Record<string, unknown> = {}) => ({ endpoints }) as AppConfig;
+const env = { ...process.env };
+const enabled = { default: true, on: true, off: false };
+const disabled = { default: false, on: false, off: false };
+const optIn = { default: false, on: true, off: false };
+const models = ['gpt-6-sol', 'gpt-6-luna', 'gpt-6-astra'];
+function grouped(overrides: Partial<TAzureGroup> = {}) {
+ const azure = validateAzureGroups([
+ {
+ group: 'test',
+ apiKey: 'test-key',
+ instanceName: 'test-instance',
+ deploymentName: 'deployment',
+ version: '2025-04-01-preview',
+ models: Object.fromEntries(models.map((m) => [m, true])),
+ ...overrides,
+ },
+ ]);
+ expect(azure.isValid).toBe(true);
+ return config({ azureOpenAI: azure });
+}
+const db = {
+ getUserKey: jest.fn().mockResolvedValue('test-key'),
+ getUserKeyValues: jest
+ .fn()
+ .mockResolvedValue({ apiKey: 'test-key', baseURL: 'https://user-gateway.example/v1' }),
+};
+async function runtime(
+ appConfig: AppConfig,
+ endpoint: EModelEndpoint,
+ model: string,
+ value?: boolean,
+ webSearch?: boolean,
+) {
+ return (
+ (
+ (
+ await initializeOpenAI({
+ endpoint,
+ model_parameters: { model, useResponsesApi: value, web_search: webSearch },
+ db,
+ runtime: { appConfig, requestBody: { key: '2099-01-01' } },
+ })
+ ).llmConfig as OpenAIClientOptions
+ ).useResponsesApi === true
+ );
+}
+async function expectParity(appConfig: AppConfig, endpoint: EModelEndpoint, model: string) {
+ const routing = getResponsesApiRouting(appConfig, endpoint as EModelEndpoint.openAI);
+ for (const value of [undefined, false, true]) {
+ for (const webSearch of [false, true]) {
+ const actual = await runtime(appConfig, endpoint, model, value, webSearch);
+ expect(resolveEffectiveUseResponsesApi({ endpoint, model, value, webSearch, routing })).toBe(
+ actual,
+ );
+ }
+ }
+ return routing;
+}
+
+beforeEach(() => {
+ jest.clearAllMocks();
+ delete process.env.OPENAI_REVERSE_PROXY;
+ delete process.env.AZURE_OPENAI_BASEURL;
+ delete process.env.AZURE_OPENAI_DEFAULT_MODEL;
+ process.env.OPENAI_API_KEY = 'test-key';
+ process.env.AZURE_API_KEY = 'test-key';
+ process.env.AZURE_OPENAI_API_INSTANCE_NAME = 'test-instance';
+ process.env.AZURE_OPENAI_API_DEPLOYMENT_NAME = 'deployment';
+ process.env.AZURE_OPENAI_API_VERSION = '2025-04-01-preview';
+});
+afterEach(() => {
+ process.env = { ...env };
+});
+
+describe.each([EModelEndpoint.openAI, EModelEndpoint.azureOpenAI])(
+ '%s routing parity',
+ (endpoint) => {
+ it.each(models)(
+ 'matches every stored toggle and web-search state for native %s',
+ async (model) => {
+ const routing = await expectParity(config(), endpoint, model);
+ expect(routing[model]).toMatchObject(enabled);
+ },
+ );
+ it.each(models)(
+ 'matches environment/discovered snapshot %s without guessing Azure group members',
+ async (model) => {
+ const routing = await expectParity(config(), endpoint, `${model}-2026-09-22`);
+ expect(routing[`${model}-*`]).toMatchObject(enabled);
+ },
+ );
+ it('does not apply unsupported global parameter drops', async () => {
+ const appConfig = config({ all: { dropParams: ['useResponsesApi'] } });
+ const routing = await expectParity(appConfig, endpoint, 'gpt-6-sol');
+ expect(routing['gpt-6-sol']).toMatchObject(enabled);
+ });
+ it('matches a noncanonical reverse proxy without advertising its URL', async () => {
+ process.env[
+ endpoint === EModelEndpoint.openAI ? 'OPENAI_REVERSE_PROXY' : 'AZURE_OPENAI_BASEURL'
+ ] = 'https://gateway.example/v1';
+ const routing = await expectParity(config(), endpoint, 'gpt-6-sol');
+ expect(routing['gpt-6-sol']).toMatchObject(optIn);
+ expect(JSON.stringify(routing)).not.toMatch(/gateway|https|apiKey|api-key/);
+ });
+ it('handles a user-provided URL conservatively but retains forced routing by web search', async () => {
+ process.env[
+ endpoint === EModelEndpoint.openAI ? 'OPENAI_REVERSE_PROXY' : 'AZURE_OPENAI_BASEURL'
+ ] = 'user_provided';
+ const routing = await expectParity(config(), endpoint, 'gpt-6-sol');
+ expect(routing['gpt-6-sol']).toMatchObject(optIn);
+ expect(db.getUserKeyValues).toHaveBeenCalled();
+ });
+ },
+);
+
+describe('Azure group parity', () => {
+ it.each([
+ {},
+ { serverless: true, baseURL: 'https://inference.example/v1' },
+ { baseURL: 'https://gateway.example/v1' },
+ ])('matches initialization without forcing serverless or gateway routes: %j', async (group) => {
+ expect.hasAssertions();
+ const appConfig = grouped(group);
+ for (const model of models) await expectParity(appConfig, EModelEndpoint.azureOpenAI, model);
+ });
+ it.each([
+ { dropParams: ['useResponsesApi'] },
+ { addParams: { useResponsesApi: true } },
+ { addParams: { useResponsesApi: false } },
+ { addParams: { web_search: true } },
+ { addParams: { model: 'gpt-4.1' } },
+ { addParams: { web_search: true }, dropParams: ['useResponsesApi', 'web_search'] },
+ ])('matches group parameter precedence: %j', async (group) => {
+ expect.hasAssertions();
+ await expectParity(grouped(group), EModelEndpoint.azureOpenAI, 'gpt-6-sol');
+ });
+ it.each([{ useResponsesApi: true }, { web_search: true }])(
+ 'preserves admin-forced routing with an unknown user URL: %j',
+ async (addParams) => {
+ process.env.AZURE_OPENAI_BASEURL = 'user_provided';
+ const routing = await expectParity(
+ grouped({ addParams }),
+ EModelEndpoint.azureOpenAI,
+ 'gpt-6-sol',
+ );
+ expect(routing['gpt-6-sol'].default).toBe(true);
+ },
+ );
+ it('never inherits snapshot capabilities for unconfigured deployments', () => {
+ const routing = getResponsesApiRouting(grouped(), EModelEndpoint.azureOpenAI);
+ expect(
+ resolveEffectiveUseResponsesApi({
+ endpoint: EModelEndpoint.azureOpenAI,
+ model: 'gpt-6-sol-2026-09-22',
+ routing,
+ }),
+ ).toBe(false);
+ expect(routing['gpt-6-sol-*']).toBeUndefined();
+ });
+});
+
+it('does not invent native add/drop support outside the native endpoint schema', async () => {
+ expect.hasAssertions();
+ await expectParity(
+ config({ openAI: { addParams: { useResponsesApi: true }, dropParams: ['useResponsesApi'] } }),
+ EModelEndpoint.openAI,
+ 'gpt-6-sol',
+ );
+});
+it('leaves custom endpoints and old servers without model-inferred upload permissions', () => {
+ expect(
+ resolveEffectiveUseResponsesApi({ endpoint: EModelEndpoint.azureOpenAI, model: 'gpt-6-sol' }),
+ ).toBeUndefined();
+ expect(
+ resolveEffectiveUseResponsesApi({
+ endpoint: EModelEndpoint.custom,
+ model: 'gpt-6-sol',
+ routing: { 'gpt-6-sol': enabled },
+ }),
+ ).toBeUndefined();
+});
+it('serves sanitized policy without mutating cached endpoint entries across requests', async () => {
+ const defaults = { azureOpenAI: { order: 0 } };
+ const service = createEndpointsConfigService({
+ getAppConfig: async () => grouped(),
+ loadDefaultEndpointsConfig: async () => defaults,
+ });
+ const a = await service.getEndpointsConfig({
+ config: grouped({ dropParams: ['useResponsesApi'] }),
+ } as never);
+ const b = await service.getEndpointsConfig({ config: grouped() } as never);
+ expect(a?.azureOpenAI?.responsesApiRouting?.['gpt-6-sol']).toMatchObject(disabled);
+ expect(b?.azureOpenAI?.responsesApiRouting?.['gpt-6-sol']).toMatchObject(enabled);
+ expect(defaults.azureOpenAI).not.toHaveProperty('responsesApiRouting');
+ expect(JSON.stringify(b)).not.toMatch(/test-key|test-instance|deployment|apiKey|api-key/);
+});
diff --git a/packages/api/src/endpoints/config/responses.ts b/packages/api/src/endpoints/config/responses.ts
new file mode 100644
index 0000000000..d12b9b8f1d
--- /dev/null
+++ b/packages/api/src/endpoints/config/responses.ts
@@ -0,0 +1,84 @@
+import { EModelEndpoint, mapModelToAzureConfig } from 'librechat-data-provider';
+import type { ResponsesApiRouting } from 'librechat-data-provider';
+import type { AppConfig } from '@librechat/data-schemas';
+import { getOpenAIEndpointParameters } from '../openai/parameters';
+import { getBuiltInBaseURL } from '../openai/initialize';
+import { getAzureCredentials } from '~/utils/azure';
+import { getOpenAIConfig } from '../openai/config';
+import { isUserProvided } from '~/utils/common';
+
+/** Publish only routing booleans, never URLs, credentials, headers or addParams.
+ * Uses the same request shaper as execution, so parameter precedence is not
+ * reimplemented in the browser. No inference requests or database reads. */
+export function getResponsesApiRouting(
+ appConfig: AppConfig,
+ endpoint: EModelEndpoint.openAI | EModelEndpoint.azureOpenAI,
+): ResponsesApiRouting {
+ const isAzure = endpoint === EModelEndpoint.azureOpenAI;
+ const azureConfig = appConfig.endpoints?.azureOpenAI;
+ const models =
+ isAzure && azureConfig
+ ? Object.keys(azureConfig.modelGroupMap ?? {})
+ : ['gpt-6-astra', 'gpt-6-sol', 'gpt-6-luna'];
+ const result: ResponsesApiRouting = {};
+ for (const model of ['*', ...models]) {
+ try {
+ let baseURL = getBuiltInBaseURL(endpoint);
+ let azure: NonNullable<Parameters<typeof getOpenAIConfig>[1]>['azure'];
+ const { addParams, dropParams } = getOpenAIEndpointParameters(appConfig, endpoint, model);
+ if (isAzure && azureConfig) {
+ // Unknown deployments must not acquire a guessed Responses capability.
+ if (model === '*') {
+ result[model] = { default: false, on: false, off: false };
+ continue;
+ }
+ const mapped = mapModelToAzureConfig({ modelName: model, ...azureConfig });
+ baseURL = mapped.baseURL ?? baseURL;
+ azure = mapped.serverless ? undefined : mapped.azureOptions;
+ } else if (isAzure) {
+ azure = getAzureCredentials();
+ }
+ // A user URL is unavailable without a credential read. Evaluate the
+ // noncanonical case: explicit/admin-forced routes still survive, whereas
+ // automatic model inference is conservatively withheld.
+ if (isUserProvided(baseURL)) baseURL = 'https://user-url.invalid/v1';
+ const route = (value?: boolean, webSearch?: boolean) =>
+ getOpenAIConfig(
+ 'route-policy',
+ {
+ streaming: true,
+ reverseProxyUrl: baseURL,
+ azure,
+ addParams,
+ dropParams,
+ modelOptions: {
+ model: model === '*' ? '' : model,
+ ...(value == null ? {} : { useResponsesApi: value }),
+ ...(webSearch ? { web_search: true } : {}),
+ },
+ },
+ endpoint,
+ ).llmConfig.useResponsesApi === true;
+ result[model] = {
+ default: route(),
+ on: route(true),
+ off: route(false),
+ withWebSearch: {
+ default: route(undefined, true),
+ on: route(true, true),
+ off: route(false, true),
+ },
+ };
+ } catch {
+ // Incomplete configuration must not break /api/endpoints or advertise
+ // uploads for a route that execution cannot construct.
+ result[model] = { default: false, on: false, off: false };
+ }
+ }
+ if (!azureConfig || !isAzure) {
+ // Only environment-based routes accept discovered snapshots. Configured
+ // Azure deployments are an exact allowlist and must never inherit this.
+ for (const model of models) result[`${model}-*`] = result[model];
+ }
+ return result;
+}
diff --git a/packages/api/src/endpoints/openai/initialize.ts b/packages/api/src/endpoints/openai/initialize.ts
index f7e9acf80d..49d15520b9 100644
--- a/packages/api/src/endpoints/openai/initialize.ts
+++ b/packages/api/src/endpoints/openai/initialize.ts
@@ -13,6 +13,7 @@ import {
getAzureCredentials,
} from '~/utils';
import { resolveModelTransportTimeouts } from '~/agents/config';
+import { getOpenAIEndpointParameters } from './parameters';
import { resolveEndpointRuntime } from '~/types';
import { validateEndpointURL } from '~/auth';
import { getOpenAIConfig } from './config';
@@ -97,6 +98,7 @@ export async function initializeOpenAI(
allowedAddresses: appConfig?.endpoints?.allowedAddresses,
transportTimeouts: resolveModelTransportTimeouts(appConfig?.endpoints?.agents),
streaming: true,
+ ...getOpenAIEndpointParameters(appConfig, endpoint, modelName),
};
/**
@@ -114,7 +116,6 @@ export async function initializeOpenAI(
let isServerless = false;
if (isAzureOpenAI && azureConfig && mappedAzureConfig) {
- const { modelGroupMap, groupMap } = azureConfig;
const { azureOptions, baseURL: configBaseURL, headers = {}, serverless } = mappedAzureConfig;
isServerless = serverless === true;
@@ -134,12 +135,6 @@ export async function initializeOpenAI(
clientOptions.headers = mergeHeaders(globalHeaders, clientOptions.headers);
}
- const groupName = modelGroupMap[modelName || '']?.group;
- if (groupName && groupMap[groupName]) {
- clientOptions.addParams = groupMap[groupName]?.addParams;
- clientOptions.dropParams = groupMap[groupName]?.dropParams;
- }
-
apiKey = azureOptions.azureOpenAIApiKey;
clientOptions.azure = !isServerless ? azureOptions : undefined;
diff --git a/packages/api/src/endpoints/openai/llm.ts b/packages/api/src/endpoints/openai/llm.ts
index 9aa23258dd..2f790d5205 100644
--- a/packages/api/src/endpoints/openai/llm.ts
+++ b/packages/api/src/endpoints/openai/llm.ts
@@ -4,6 +4,7 @@ import {
ReasoningEffort,
ReasoningParameterFormat,
removeNullishValues,
+ prefersResponsesApiByModel,
supportsAdaptiveThinking,
} from 'librechat-data-provider';
import type { BindToolsInput } from '@librechat/agents/langchain/language_models/chat_models';
@@ -137,24 +138,8 @@ function isOpenAIEndpoint(endpoint?: EModelEndpoint | string | null): boolean {
*/
const responsesApiRequiredPattern = /\bgpt-5\.6\b/;
-/**
- * Models that take the Responses API for every turn, not only reasoning ones.
- * OpenAI's guidance for GPT-6 Astra is to use Responses, and tool calls require
- * it outright.
- *
- * Decided here rather than in the agents SDK at invocation time: the max-tokens
- * field below is shaped from `useResponsesApi`, so a later switch would send
- * `max_completion_tokens` to an endpoint expecting `max_output_tokens`. Config
- * time is also where Azure decides whether the model keeps its identity, with
- * the deployment as the wire model, or becomes the deployment name outright.
- * @see https://developers.openai.com/api/docs/guides/latest-model
- */
-const responsesApiPreferredPattern = /^gpt-6-astra(?:-|$)/i;
-
-function prefersResponsesApi(model?: string): boolean {
- return typeof model === 'string' && responsesApiPreferredPattern.test(model);
-}
-
+/** Native model defaults apply only to canonical Azure transports; gateways
+ * may implement a different API contract even for the same model name. */
function isCanonicalAzureBaseURL(baseURL?: string | null, azure?: false | t.AzureOptions): boolean {
if (!azure) {
return false;
@@ -885,7 +870,7 @@ export function getOpenAILLMConfig({
(dropParams.includes('reasoning_effort') || dropParams.includes('useResponsesApi'));
/**
* The GPT-5.6 default above is reasoning-driven, so dropping `reasoning_effort`
- * removes its reason to route. Astra's is not: it takes Responses for every
+ * removes its reason to route. GPT-6's is not: it takes Responses for every
* turn, and a drop rule clearing an unsupported stored effort must not also
* disable its routing. Only an explicit `useResponsesApi` drop does that.
*/
@@ -898,8 +883,9 @@ export function getOpenAILLMConfig({
endpoint === EModelEndpoint.azureOpenAI &&
isCanonicalAzureBaseURL(baseURL, azure);
const firstPartyEndpoint = firstPartyOpenAI || firstPartyAzure;
- /** Astra keeps its model identity on Azure, where the deployment becomes the wire model. */
- const firstPartyAstra = firstPartyEndpoint && prefersResponsesApi(llmConfig.model);
+ /** Keep GPT-6 model identity on Azure, with the deployment name used on the wire. */
+ const firstPartyResponsesModel =
+ firstPartyEndpoint && prefersResponsesApiByModel(llmConfig.model);
if (
firstPartyOpenAI &&
reasoningFormat !== ReasoningParameterFormat.disabled &&
@@ -911,11 +897,14 @@ export function getOpenAILLMConfig({
}
/**
- * Route GPT-6 Astra to the Responses API for every turn. Unlike the GPT-5.6
- * rule above this does not depend on reasoning params: Astra serves tool calls
- * only from Responses on both OpenAI and Azure OpenAI.
+ * Route GPT-6 to Responses before invocation, including unset effort, so tools
+ * bound later cannot accidentally reach Chat Completions with default reasoning.
*/
- if (firstPartyAstra && llmConfig.useResponsesApi == null && !responsesApiExplicitlyOptedOut) {
+ if (
+ firstPartyResponsesModel &&
+ llmConfig.useResponsesApi == null &&
+ !responsesApiExplicitlyOptedOut
+ ) {
llmConfig.useResponsesApi = true;
}
@@ -930,6 +919,12 @@ export function getOpenAILLMConfig({
llmConfig.firstPartyEndpoint = true;
}
+ /** Settle an administrator route drop before shaping API-specific fields.
+ * The drop loop later removes the flag, but it must already govern effort. */
+ if (responsesApiExplicitlyOptedOut) llmConfig.useResponsesApi = false;
+
+ const solLunaRulesApply =
+ firstPartyEndpoint && /^gpt-6-(?:sol|luna)(?:-|$)/i.test(llmConfig.model ?? '');
if (!useOpenRouter) {
hasModelKwargs =
applyReasoningConfig({
@@ -944,6 +939,17 @@ export function getOpenAILLMConfig({
}) || hasModelKwargs;
}
+ /** Flat effort is an ignored constructor field in Chat Completions. Convert
+ * after shaping (including nested defaults), before administrator drops. */
+ if (solLunaRulesApply && llmConfig.useResponsesApi !== true) {
+ const effort = llmConfig.reasoning_effort ?? llmConfig.reasoning?.effort;
+ if (effort != null && effort !== '') {
+ modelKwargs.reasoning_effort = effort;
+ hasModelKwargs = true;
+ }
+ delete llmConfig.reasoning_effort;
+ }
+
/** DeepSeek thinking-mode requires `reasoning_content` replay on tool turns (#13366). */
const isDeepSeekModel =
typeof modelOptions.model === 'string' &&
@@ -1003,6 +1009,44 @@ export function getOpenAILLMConfig({
dropParams.forEach((param) => deleteConfigParam({ param, llmConfig, modelKwargs }));
}
+ /** Normalize the final effective value in either API, regardless of whether
+ * it came from saved settings, flat params, or a nested configured object.
+ * Copy nested objects so administrator defaults are never mutated. */
+ if (solLunaRulesApply) {
+ if (llmConfig.reasoning?.effort === ReasoningEffort.minimal) {
+ llmConfig.reasoning = { ...llmConfig.reasoning, effort: ReasoningEffort.low };
+ }
+ if (modelKwargs.reasoning_effort === ReasoningEffort.minimal) {
+ modelKwargs.reasoning_effort = ReasoningEffort.low;
+ }
+ }
+
+ /** Sol/Luna reject sampling controls when Responses uses reasoning. The
+ * provider default is medium, so an unset effort is reasoning-enabled too.
+ * Strip only the request copy; saved settings remain available when the user
+ * switches models or explicitly selects `none`. */
+ const solLunaResponsesReasoning =
+ solLunaRulesApply &&
+ llmConfig.useResponsesApi === true &&
+ llmConfig.reasoning?.effort !== ReasoningEffort.none;
+ if (solLunaResponsesReasoning) {
+ for (const param of [
+ 'temperature',
+ 'topP',
+ 'top_p',
+ 'logprobs',
+ 'topLogprobs',
+ 'top_logprobs',
+ ]) {
+ deleteConfigParam({ param, llmConfig, modelKwargs });
+ }
+ for (const target of [llmConfig as Record<string, unknown>, modelKwargs]) {
+ if (Array.isArray(target.include)) {
+ target.include = target.include.filter((value) => value !== 'message.output_text.logprobs');
+ }
+ }
+ }
+
hasModelKwargs =
applyResponsesVerbosity({
llmConfig,
@@ -1038,7 +1082,7 @@ export function getOpenAILLMConfig({
? sanitizeModelName(llmConfig.model || '')
: azure.azureOpenAIApiDeploymentName ||
getAzureDeploymentName(baseURL, azure) ||
- (firstPartyAstra || llmConfig.useResponsesApi ? model : undefined);
+ (firstPartyResponsesModel || llmConfig.useResponsesApi ? model : undefined);
if (process.env.AZURE_OPENAI_DEFAULT_MODEL) {
llmConfig.model = process.env.AZURE_OPENAI_DEFAULT_MODEL;
@@ -1074,7 +1118,7 @@ export function getOpenAILLMConfig({
constructAzureResponsesApi();
/** Keep Astra's identity for SDK constraints; only the wire model is a deployment alias. */
- if (firstPartyAstra) {
+ if (firstPartyResponsesModel) {
llmConfig.model = model;
llmConfig.modelKwargs = {
...llmConfig.modelKwargs,
diff --git a/packages/api/src/endpoints/openai/parameters.ts b/packages/api/src/endpoints/openai/parameters.ts
new file mode 100644
index 0000000000..dc8938ab13
--- /dev/null
+++ b/packages/api/src/endpoints/openai/parameters.ts
@@ -0,0 +1,17 @@
+import { EModelEndpoint } from 'librechat-data-provider';
+import type { AppConfig } from '@librechat/data-schemas';
+
+/** Parameter overrides belong to configured Azure groups. Native OpenAI and
+ * endpoints.all do not declare add/drop parameters in their schema. Sharing
+ * this selection keeps endpoint discovery and actual initialization aligned. */
+export function getOpenAIEndpointParameters(
+ appConfig: AppConfig | undefined,
+ endpoint: string,
+ model?: string,
+) {
+ const azure =
+ endpoint === EModelEndpoint.azureOpenAI ? appConfig?.endpoints?.azureOpenAI : undefined;
+ const groupName = model ? azure?.modelGroupMap[model]?.group : undefined;
+ const group = groupName ? azure?.groupMap[groupName] : undefined;
+ return { addParams: group?.addParams, dropParams: group?.dropParams };
+}
diff --git a/packages/api/src/endpoints/openai/sol-luna.spec.ts b/packages/api/src/endpoints/openai/sol-luna.spec.ts
new file mode 100644
index 0000000000..6eecaf9aea
--- /dev/null
+++ b/packages/api/src/endpoints/openai/sol-luna.spec.ts
@@ -0,0 +1,430 @@
+import { createTxMethods } from '@librechat/data-schemas';
+import { HumanMessage } from '@librechat/agents/langchain';
+import { Providers, initializeModel } from '@librechat/agents';
+import { EModelEndpoint, ReasoningEffort, ReasoningParameterFormat } from 'librechat-data-provider';
+import type { AIMessageChunk } from '@librechat/agents/langchain';
+import type { OpenAIConfiguration } from '~/types';
+import { computeUsageCostUSD, recordCollectedUsage } from '~/agents/usage';
+import { matchModelName, findMatchingPattern } from '~/utils/tokens';
+import { getOpenAIConfig } from './config';
+import { getOpenAILLMConfig } from './llm';
+
+const pricing = createTxMethods({} as typeof import('mongoose'), {
+ matchModelName: (model, endpoint) => matchModelName(model, endpoint as EModelEndpoint),
+ findMatchingPattern: (model, values) => findMatchingPattern(model, values) ?? undefined,
+});
+const tool = {
+ type: 'function' as const,
+ function: {
+ name: 'lookup',
+ description: 'Look up a value',
+ parameters: { type: 'object', properties: {} },
+ },
+};
+const azure = {
+ azureOpenAIApiKey: 'test-key',
+ azureOpenAIApiInstanceName: 'test-instance',
+ azureOpenAIApiDeploymentName: 'production-deployment',
+ azureOpenAIApiVersion: '2025-04-01-preview',
+};
+
+describe.each(['gpt-6-sol', 'gpt-6-luna'])('%s requests', (model) => {
+ const config = (overrides: Partial<Parameters<typeof getOpenAILLMConfig>[0]> = {}) =>
+ getOpenAILLMConfig({
+ apiKey: 'test-key',
+ streaming: false,
+ endpoint: EModelEndpoint.openAI,
+ modelOptions: { model },
+ ...overrides,
+ }).llmConfig;
+
+ it.each([undefined, '', 'none', 'low', 'medium', 'high', 'xhigh', 'max'] as const)(
+ 'defaults to Responses with effort %s before tools are bound',
+ (effort) => {
+ expect(
+ config({
+ modelOptions: { model, reasoning_effort: effort as ReasoningEffort, max_tokens: 2048 },
+ }),
+ ).toMatchObject({
+ useResponsesApi: true,
+ modelKwargs: { max_output_tokens: 2048 },
+ });
+ },
+ );
+ it.each([
+ { modelOptions: { model, useResponsesApi: false, reasoning_effort: ReasoningEffort.none } },
+ { addParams: { useResponsesApi: false } },
+ { dropParams: ['useResponsesApi'] },
+ { endpoint: EModelEndpoint.custom },
+ { baseURL: 'https://gateway.example/v1' },
+ { useOpenRouter: true },
+ ])('respects explicit routes and compatible providers: %j', (overrides) => {
+ expect(config(overrides).useResponsesApi).not.toBe(true);
+ });
+ it.each([
+ { dropParams: ['reasoning_effort'] },
+ { reasoningFormat: ReasoningParameterFormat.disabled },
+ ])('still routes unset provider reasoning to Responses: %j', (overrides) => {
+ expect(config(overrides).useResponsesApi).toBe(true);
+ });
+ it.each([ReasoningEffort.none, ReasoningEffort.max])(
+ 'preserves %s reasoning when dropParams forces Chat Completions',
+ (effort) => {
+ const llmConfig = config({
+ modelOptions: { model, reasoning_effort: effort },
+ dropParams: ['useResponsesApi'],
+ });
+ expect(llmConfig.useResponsesApi).toBeUndefined();
+ expect(llmConfig.modelKwargs).toMatchObject({ reasoning_effort: effort });
+ expect(llmConfig).not.toHaveProperty('reasoning_effort');
+ },
+ );
+
+ it.each(['addParams', 'defaultParams'] as const)(
+ 'removes both naming conventions from %s without mutating configuration',
+ (source) => {
+ const sampling = {
+ temperature: 0.7,
+ topP: 0.8,
+ top_p: 0.9,
+ logprobs: true,
+ topLogprobs: 3,
+ top_logprobs: 4,
+ };
+ const result = config({ [source]: sampling });
+ for (const key of Object.keys(sampling)) {
+ expect(result).not.toHaveProperty(key);
+ expect(result.modelKwargs ?? {}).not.toHaveProperty(key);
+ }
+ expect(sampling).toEqual({
+ temperature: 0.7,
+ topP: 0.8,
+ top_p: 0.9,
+ logprobs: true,
+ topLogprobs: 3,
+ top_logprobs: 4,
+ });
+ const withoutReasoning = config({
+ [source]: sampling,
+ modelOptions: { model, reasoning_effort: ReasoningEffort.none },
+ });
+ expect(withoutReasoning.modelKwargs).toMatchObject({ top_p: 0.9, top_logprobs: 4 });
+ const defaultReasoning = config({
+ [source]: sampling,
+ modelOptions: { model, reasoning_effort: ReasoningEffort.none },
+ dropParams: ['reasoning_effort'],
+ });
+ expect(defaultReasoning.modelKwargs ?? {}).not.toHaveProperty('top_p');
+ },
+ );
+
+ it.each([ReasoningEffort.none, ReasoningEffort.max])(
+ 'settles a route drop before translating saved-true %s reasoning',
+ (effort) => {
+ const result = config({
+ modelOptions: { model, useResponsesApi: true, reasoning_effort: effort },
+ dropParams: ['useResponsesApi'],
+ });
+ expect(result.useResponsesApi).toBeUndefined();
+ expect(result.modelKwargs).toHaveProperty('reasoning_effort', effort);
+ },
+ );
+
+ describe.each(['addParams', 'defaultParams'] as const)('%s nested reasoning', (source) => {
+ it.each([undefined, false, true])(
+ 'normalizes nested minimal for route %s without changing the configured object',
+ (useResponsesApi) => {
+ const reasoning = { effort: 'minimal', summary: 'auto' };
+ const result = config({
+ [source]: { reasoning },
+ modelOptions: { model, useResponsesApi },
+ });
+ expect(result.reasoning).toMatchObject({ effort: 'low', summary: 'auto' });
+ if (useResponsesApi === false)
+ expect(result.modelKwargs).toHaveProperty('reasoning_effort', 'low');
+ expect(reasoning).toEqual({ effort: 'minimal', summary: 'auto' });
+ },
+ );
+ it.each(['reasoning', 'reasoning_effort'])('honors %s drops for nested minimal', (param) => {
+ const result = config({
+ [source]: { reasoning: { effort: 'minimal' } },
+ dropParams: [param],
+ });
+ expect(result.reasoning?.effort).toBeUndefined();
+ expect(result.modelKwargs ?? {}).not.toHaveProperty('reasoning_effort');
+ });
+ it('does not normalize configured reasoning for a custom gateway', () => {
+ const result = config({
+ baseURL: 'https://gateway.example/v1',
+ [source]: { reasoning: { effort: 'minimal' } },
+ });
+ expect(result.reasoning?.effort).toBe('minimal');
+ });
+ });
+
+ it.each([false, true])(
+ 'serializes nested minimal on Azure=%s using the real SDK',
+ async (isAzure) => {
+ let body: Record<string, unknown> | undefined;
+ const fetch: NonNullable<NonNullable<OpenAIConfiguration>['fetch']> = async (
+ _url,
+ options,
+ ) => {
+ body = JSON.parse(String(options?.body));
+ return Response.json({
+ id: 'resp',
+ object: 'response',
+ status: 'completed',
+ model,
+ output: [],
+ usage: { input_tokens: 1, output_tokens: 1, total_tokens: 2 },
+ });
+ };
+ const { llmConfig, configOptions } = getOpenAIConfig(
+ 'test-key',
+ {
+ streaming: false,
+ ...(isAzure ? { azure } : {}),
+ modelOptions: { model },
+ addParams: { reasoning: { effort: 'minimal' }, temperature: 0.7 },
+ },
+ isAzure ? EModelEndpoint.azureOpenAI : EModelEndpoint.openAI,
+ );
+ const llm = initializeModel({
+ provider: Providers.OPENAI,
+ clientOptions: {
+ ...llmConfig,
+ verbosity: undefined,
+ configuration: { ...configOptions, fetch },
+ },
+ });
+ await llm.invoke('test');
+ expect(body).toHaveProperty('reasoning.effort', 'low');
+ expect(body).not.toHaveProperty('temperature');
+ },
+ );
+
+ it('keeps unrelated Responses includes while removing logprob includes for reasoning', () => {
+ const include = ['message.output_text.logprobs', 'reasoning.encrypted_content'];
+ const result = config({ addParams: { include } });
+ expect(result).toHaveProperty('include', ['reasoning.encrypted_content']);
+ expect(include).toHaveLength(2);
+ });
+
+ it('routes using the final model override, not the stale selected model', () => {
+ expect(
+ config({ modelOptions: { model: 'gpt-4.1' }, addParams: { model } }).useResponsesApi,
+ ).toBe(true);
+ expect(config({ addParams: { model: 'gpt-4.1' } }).useResponsesApi).not.toBe(true);
+ expect(config({ modelOptions: { model: `${model}-2026-09-22` } }).useResponsesApi).toBe(true);
+ });
+ it('normalizes restored minimal effort without mutating saved settings or bypassing drops', () => {
+ const saved = { model, reasoning_effort: ReasoningEffort.minimal };
+ expect(config({ modelOptions: saved }).reasoning).toEqual({ effort: 'low' });
+ expect(saved.reasoning_effort).toBe('minimal');
+ expect(
+ config({ modelOptions: saved, dropParams: ['reasoning_effort'] }).reasoning,
+ ).toBeUndefined();
+ expect(
+ (
+ config({ modelOptions: saved, baseURL: 'https://gateway.example/v1' }) as Record<
+ string,
+ unknown
+ >
+ ).reasoning_effort,
+ ).toBe('minimal');
+ expect(
+ config({ modelOptions: saved, azure, endpoint: EModelEndpoint.azureOpenAI }).reasoning,
+ ).toEqual({ effort: 'low' });
+ });
+
+ it.each([
+ [false, false, undefined],
+ [false, true, undefined],
+ [true, false, undefined],
+ [true, true, 'max'],
+ [false, true, 'none'],
+ [false, false, 'none', true],
+ [true, false, 'none', true],
+ [false, false, 'max', true, false],
+ [true, false, 'max', true, false],
+ [false, true, 'low', false, false],
+ [true, true, 'low', false, false],
+ [false, false, undefined, false, false],
+ [false, true, undefined, false, false],
+ ] as const)(
+ 'serializes tools with Azure=%s streaming=%s effort=%s and preserves cache usage',
+ async (
+ isAzure,
+ streaming,
+ effort,
+ chatCompletions: boolean = false,
+ withTools: boolean = true,
+ ) => {
+ const bodies: Record<string, unknown>[] = [];
+ const urls: string[] = [];
+ const response = {
+ id: 'resp_test',
+ object: 'response',
+ status: 'completed',
+ model,
+ choices: [
+ { index: 0, message: { role: 'assistant', content: 'OK' }, finish_reason: 'stop' },
+ ],
+ output: [
+ {
+ type: 'message',
+ id: 'msg_test',
+ role: 'assistant',
+ status: 'completed',
+ content: [{ type: 'output_text', text: 'OK', annotations: [] }],
+ },
+ ],
+ usage: {
+ prompt_tokens: 300000,
+ completion_tokens: 100,
+ prompt_tokens_details: { cached_tokens: 100000, cache_write_tokens: 50000 },
+ input_tokens: 300000,
+ output_tokens: 100,
+ total_tokens: 300100,
+ input_tokens_details: { cached_tokens: 100000, cache_write_tokens: 50000 },
+ output_tokens_details: { reasoning_tokens: 10 },
+ },
+ };
+ const fetch: NonNullable<NonNullable<OpenAIConfiguration>['fetch']> = async (url, init) => {
+ urls.push(String(url));
+ bodies.push(JSON.parse(String(init?.body)));
+ if (!streaming) return Response.json(response);
+ const events = [
+ {
+ type: 'response.created',
+ response: { ...response, output: [], status: 'in_progress' },
+ },
+ {
+ type: 'response.output_text.delta',
+ item_id: 'msg_test',
+ output_index: 0,
+ content_index: 0,
+ delta: 'OK',
+ },
+ { type: 'response.completed', response },
+ ];
+ return new Response(
+ events
+ .map((event) => `event: ${event.type}\ndata: ${JSON.stringify(event)}\n\n`)
+ .join(''),
+ { headers: { 'Content-Type': 'text/event-stream' } },
+ );
+ };
+ const { llmConfig, configOptions } = getOpenAIConfig(
+ 'test-key',
+ {
+ streaming,
+ modelOptions: {
+ model,
+ max_tokens: 2048,
+ reasoning_effort: effort as ReasoningEffort,
+ temperature: 0.7,
+ top_p: 0.9,
+ ...(chatCompletions ? { useResponsesApi: false } : {}),
+ },
+ ...(streaming
+ ? { defaultParams: { logprobs: true, topLogprobs: 3, top_p: 0.8, top_logprobs: 4 } }
+ : { addParams: { logprobs: true, topLogprobs: 3, top_p: 0.8, top_logprobs: 4 } }),
+ ...(isAzure ? { azure } : {}),
+ },
+ isAzure ? EModelEndpoint.azureOpenAI : EModelEndpoint.openAI,
+ );
+ const bound = initializeModel({
+ provider: isAzure && chatCompletions ? Providers.AZURE : Providers.OPENAI,
+ clientOptions: {
+ ...llmConfig,
+ verbosity: undefined,
+ configuration: { ...configOptions, fetch },
+ streamUsage: true,
+ },
+ tools: withTools ? [tool] : [],
+ });
+ const messages = [
+ new HumanMessage({
+ content: [
+ { type: 'text', text: 'Look up the value' },
+ { type: 'image_url', image_url: { url: 'data:image/png;base64,dGVzdA==' } },
+ ],
+ }),
+ ];
+ let message: AIMessageChunk;
+ if (streaming) {
+ let aggregate: AIMessageChunk | undefined;
+ for await (const chunk of await bound.stream(messages)) {
+ aggregate = aggregate ? aggregate.concat(chunk) : chunk;
+ }
+ message = aggregate!;
+ } else {
+ message = await bound.invoke(messages);
+ }
+ expect(urls[0]).toContain(chatCompletions ? '/chat/completions' : '/responses');
+ expect(new URL(urls[0]).hostname).toBe(
+ isAzure ? 'test-instance.openai.azure.com' : 'api.openai.com',
+ );
+ expect(bodies[0].model).toBe(isAzure ? 'production-deployment' : model);
+ expect(bodies[0]).toHaveProperty(
+ chatCompletions ? 'max_completion_tokens' : 'max_output_tokens',
+ 2048,
+ );
+ expect(bodies[0]).not.toHaveProperty(
+ chatCompletions ? 'max_output_tokens' : 'max_completion_tokens',
+ );
+ if (withTools) expect(bodies[0].tools).toHaveLength(1);
+ else expect(bodies[0].tools ?? []).toHaveLength(0);
+ if (effort)
+ expect(bodies[0]).toHaveProperty(
+ chatCompletions ? 'reasoning_effort' : 'reasoning.effort',
+ effort,
+ );
+ expect(JSON.stringify(bodies[0][chatCompletions ? 'messages' : 'input'])).toContain(
+ 'data:image/png;base64,dGVzdA==',
+ );
+ const reasoningEnabledResponses = !chatCompletions && effort !== ReasoningEffort.none;
+ if (reasoningEnabledResponses) {
+ for (const param of ['temperature', 'top_p', 'logprobs', 'top_logprobs']) {
+ expect(bodies[0]).not.toHaveProperty(param);
+ }
+ } else {
+ expect(bodies[0]).toHaveProperty('temperature', 0.7);
+ }
+ expect(message.usage_metadata).toMatchObject({
+ input_tokens: 300000,
+ output_tokens: 100,
+ input_token_details: chatCompletions
+ ? { cache_read: 100000 }
+ : { cache_read: 100000, cache_creation: 50000 },
+ });
+
+ if (!chatCompletions) {
+ const usage = { ...message.usage_metadata!, provider: Providers.OPENAI, model };
+ // Full prompt crosses 272K: all reported categories use premium rates.
+ const expected = model === 'gpt-6-sol' ? 0.8915 : 0.044575;
+ expect(computeUsageCostUSD(usage, pricing)).toBeCloseTo(expected, 8);
+ const spendTokens = jest.fn().mockResolvedValue(undefined);
+ const spendStructuredTokens = jest.fn().mockResolvedValue(undefined);
+ await recordCollectedUsage(
+ { spendTokens, spendStructuredTokens, pricing },
+ {
+ user: 'test-user',
+ conversationId: 'test-conversation',
+ model,
+ context: 'message',
+ collectedUsage: [usage],
+ transactions: { enabled: true },
+ },
+ );
+ expect(spendTokens).not.toHaveBeenCalled();
+ expect(spendStructuredTokens).toHaveBeenCalledWith(expect.objectContaining({ model }), {
+ promptTokens: { input: 150000, write: 50000, read: 100000 },
+ completionTokens: 100,
+ });
+ }
+ },
+ );
+});
diff --git a/packages/api/src/utils/tokens.spec.ts b/packages/api/src/utils/tokens.spec.ts
index b1a50d72c7..62801ece02 100644
--- a/packages/api/src/utils/tokens.spec.ts
+++ b/packages/api/src/utils/tokens.spec.ts
@@ -246,3 +246,12 @@ describe('Opus 5.5 token limits', () => {
expect(getModelMaxOutputTokens(model)).toBe(128000);
});
});
+
+describe.each(['gpt-6-sol', 'gpt-6-luna'])('%s token limits', (model) => {
+ it('resolves exact, snapshot, and provider-prefixed IDs', () => {
+ for (const name of [model, `${model}-2026-09-22`, `openai/${model}`]) {
+ expect(getModelMaxTokens(name, EModelEndpoint.openAI)).toBe(1050000);
+ expect(getModelMaxOutputTokens(name, EModelEndpoint.openAI)).toBe(128000);
+ }
+ });
+});
diff --git a/packages/api/src/utils/tokens.ts b/packages/api/src/utils/tokens.ts
index 3b80b2c4ae..f9ad7c0792 100644
--- a/packages/api/src/utils/tokens.ts
+++ b/packages/api/src/utils/tokens.ts
@@ -65,6 +65,8 @@ const openAIModels = {
'gpt-5.6-terra': 1050000,
'gpt-5.6-luna': 1050000,
'gpt-6-astra': 1050000, // >272K input prices at the long-context tier (2x input/cache, 1.5x output)
+ 'gpt-6-sol': 1050000, // >272K input prices at the long-context tier (2x input/cache, 1.5x output)
+ 'gpt-6-luna': 1050000, // >272K input prices at the long-context tier (2x input/cache, 1.5x output)
'chat-latest': 400000,
'gpt-5-mini': 400000,
'gpt-5-nano': 400000,
@@ -522,6 +524,8 @@ export const modelMaxOutputs = {
'gpt-5.6-terra': 128000,
'gpt-5.6-luna': 128000,
'gpt-6-astra': 128000,
+ 'gpt-6-sol': 128000,
+ 'gpt-6-luna': 128000,
'chat-latest': 128000,
'gpt-5-mini': 128000,
'gpt-5-nano': 128000,
diff --git a/packages/data-provider/specs/sol-luna.spec.ts b/packages/data-provider/specs/sol-luna.spec.ts
new file mode 100644
index 0000000000..9feeedbfae
--- /dev/null
+++ b/packages/data-provider/specs/sol-luna.spec.ts
@@ -0,0 +1,42 @@
+import { defaultModels, initialModelsConfig } from '../src/config';
+import { EModelEndpoint } from '../src/schemas';
+import { ReasoningEffort } from '../src/types';
+import { applyModelAwareDefaults, paramSettings } from '../src/parameterSettings';
+
+describe.each(['gpt-6-sol', 'gpt-6-luna'])('%s catalog and settings', (model) => {
+ it('offers native OpenAI and Agents support without advertising legacy Assistants support', () => {
+ for (const endpoint of [EModelEndpoint.openAI, EModelEndpoint.agents]) {
+ expect(defaultModels[endpoint]).toContain(model);
+ expect(initialModelsConfig[endpoint]).toContain(model);
+ }
+ for (const endpoint of [EModelEndpoint.assistants, EModelEndpoint.azureAssistants])
+ expect(defaultModels[endpoint]).not.toContain(model);
+ expect(initialModelsConfig[EModelEndpoint.azureOpenAI]).not.toContain(model);
+ });
+ it.each([EModelEndpoint.openAI, EModelEndpoint.azureOpenAI])(
+ 'keeps stored keys while limiting effort controls on %s',
+ (endpoint) => {
+ const settings = paramSettings[endpoint]!;
+ const next = applyModelAwareDefaults(settings, endpoint, model);
+ expect(next.map(({ key }) => key)).toEqual(settings.map(({ key }) => key));
+ expect(next.find(({ key }) => key === 'reasoning_effort')?.options).toEqual([
+ ReasoningEffort.unset,
+ ReasoningEffort.none,
+ ReasoningEffort.low,
+ ReasoningEffort.medium,
+ ReasoningEffort.high,
+ ReasoningEffort.xhigh,
+ ReasoningEffort.max,
+ ]);
+ expect(settings.find(({ key }) => key === 'reasoning_effort')?.options).toContain(
+ ReasoningEffort.minimal,
+ );
+ expect(next.find(({ key }) => key === 'useResponsesApi')?.default).toBe(false);
+ const routed = applyModelAwareDefaults(settings, endpoint, model, {
+ [model]: { default: true, on: true, off: false },
+ });
+ expect(routed.find(({ key }) => key === 'useResponsesApi')?.default).toBe(true);
+ expect(settings.find(({ key }) => key === 'useResponsesApi')?.default).toBe(false);
+ },
+ );
+});
diff --git a/packages/data-provider/src/config.ts b/packages/data-provider/src/config.ts
index 18747628d1..0a2f63ff0e 100644
--- a/packages/data-provider/src/config.ts
+++ b/packages/data-provider/src/config.ts
@@ -3208,6 +3208,9 @@ export const alternateName = {
* catalogs consume.
*/
const responsesOnlyOpenAIModels = ['gpt-6-astra'];
+/** Tool calls with Sol/Luna's default reasoning require Responses. Do not offer
+ * these on Assistants, which cannot use the native request-routing path. */
+const responsesReasoningOpenAIModels = ['gpt-6-sol', 'gpt-6-luna'];
const sharedOpenAIModels = [
'gpt-5.6',
@@ -3314,7 +3317,11 @@ export const defaultModels = {
[EModelEndpoint.azureAssistants]: sharedOpenAIModels,
[EModelEndpoint.assistants]: [...sharedOpenAIModels, 'chatgpt-4o-latest'],
// TODO: Add agent models (agentsModels)
- [EModelEndpoint.agents]: [...responsesOnlyOpenAIModels, ...sharedOpenAIModels],
+ [EModelEndpoint.agents]: [
+ ...responsesOnlyOpenAIModels,
+ ...responsesReasoningOpenAIModels,
+ ...sharedOpenAIModels,
+ ],
[EModelEndpoint.google]: [
// Gemini 3.8 Models
'gemini-3.8-flash',
@@ -3340,6 +3347,7 @@ export const defaultModels = {
[EModelEndpoint.anthropic]: sharedAnthropicModels,
[EModelEndpoint.openAI]: [
...responsesOnlyOpenAIModels,
+ ...responsesReasoningOpenAIModels,
...sharedOpenAIModels,
'chatgpt-4o-latest',
'gpt-4-vision-preview',
@@ -3361,7 +3369,8 @@ const openAIModels = defaultModels[EModelEndpoint.openAI];
* model list, including Astra when deployed.
*/
const nonResponsesOnlyOpenAIModels = openAIModels.filter(
- (model) => !responsesOnlyOpenAIModels.includes(model),
+ (model) =>
+ !responsesOnlyOpenAIModels.includes(model) && !responsesReasoningOpenAIModels.includes(model),
);
export const initialModelsConfig: TModelsConfig = {
diff --git a/packages/data-provider/src/file-config.spec.ts b/packages/data-provider/src/file-config.spec.ts
index cecd38bfc8..d7010b2052 100644
--- a/packages/data-provider/src/file-config.spec.ts
+++ b/packages/data-provider/src/file-config.spec.ts
@@ -3,6 +3,7 @@ import type { FileConfig } from './types/files';
import {
fileConfig as baseFileConfig,
fileConfigSchema,
+ resolveEffectiveUseResponsesApi,
isAnthropicTextDocumentType,
getConfiguredMimeAccept,
getDocumentFileExtension,
@@ -2121,3 +2122,77 @@ describe('getDocumentFileExtension', () => {
expect(getDocumentFileExtension(mimeType)).toBe(expected);
});
});
+
+describe('server-effective Responses routing', () => {
+ const enabled = { default: true, on: true, off: false };
+ const disabled = { default: false, on: false, off: false };
+ it('does not assume model defaults before policy arrives or against an older server', () => {
+ expect(
+ resolveEffectiveUseResponsesApi({ endpoint: EModelEndpoint.azureOpenAI, model: 'gpt-6-sol' }),
+ ).toBeUndefined();
+ });
+ it('uses native snapshot policy but does not invent an Azure deployment', () => {
+ const routing = { 'gpt-6-sol': enabled, 'gpt-6-sol-*': enabled, '*': disabled };
+ expect(
+ resolveEffectiveUseResponsesApi({
+ endpoint: EModelEndpoint.openAI,
+ model: 'gpt-6-sol-2026-09-22',
+ routing,
+ }),
+ ).toBe(true);
+ expect(
+ resolveEffectiveUseResponsesApi({
+ endpoint: EModelEndpoint.azureOpenAI,
+ model: 'gpt-6-sol-2026-09-22',
+ routing: { 'gpt-6-sol': enabled, '*': disabled },
+ }),
+ ).toBe(false);
+ });
+ it('leaves custom provider selections alone rather than inferring native support', () => {
+ expect(
+ resolveEffectiveUseResponsesApi({
+ endpoint: EModelEndpoint.custom,
+ model: 'gpt-6-sol',
+ routing: { 'gpt-6-sol': enabled },
+ }),
+ ).toBeUndefined();
+ });
+});
+
+it('inherits environment-based Azure snapshot policy only when the server advertises a family wildcard', () => {
+ const routing = { 'gpt-6-sol-*': { default: true, on: true, off: false } };
+ expect(
+ resolveEffectiveUseResponsesApi({
+ endpoint: EModelEndpoint.azureOpenAI,
+ model: 'gpt-6-sol-2026-09-22',
+ routing,
+ }),
+ ).toBe(true);
+});
+it('selects web-search routing without changing stored route selection', () => {
+ const routing = {
+ 'gpt-6-sol': {
+ default: false,
+ on: true,
+ off: false,
+ withWebSearch: { default: true, on: true, off: true },
+ },
+ };
+ expect(
+ resolveEffectiveUseResponsesApi({
+ endpoint: EModelEndpoint.azureOpenAI,
+ model: 'gpt-6-sol',
+ value: false,
+ webSearch: true,
+ routing,
+ }),
+ ).toBe(true);
+ expect(
+ resolveEffectiveUseResponsesApi({
+ endpoint: EModelEndpoint.azureOpenAI,
+ model: 'gpt-6-sol',
+ value: false,
+ routing,
+ }),
+ ).toBe(false);
+});
diff --git a/packages/data-provider/src/file-config.ts b/packages/data-provider/src/file-config.ts
index d413cbf8d1..a819e13bd0 100644
--- a/packages/data-provider/src/file-config.ts
+++ b/packages/data-provider/src/file-config.ts
@@ -1,5 +1,6 @@
import { z } from 'zod';
import type { EndpointFileConfig, FileConfig, RegexLike } from './types/files';
+import type { ResponsesApiRouting } from './types';
import { EModelEndpoint, isAgentsEndpoint, isDocumentSupportedProvider } from './schemas';
import { normalizeEndpointName } from './utils';
@@ -234,6 +235,42 @@ export const resolveUseResponsesApi = (
conversationValue?: boolean | null,
): boolean | undefined => agentValue ?? conversationValue ?? undefined;
+/** Models whose native OpenAI and Azure execution defaults to Responses. Keep
+ * this shared with client upload routing so documents follow the API that the
+ * backend will actually invoke. Explicit false remains an opt-out. */
+export const prefersResponsesApiByModel = (model?: string | null): boolean =>
+ typeof model === 'string' && /^gpt-6-(?:astra|sol|luna)(?:-|$)/i.test(model);
+
+/** The server has transport and administrator settings the browser cannot see.
+ * Missing policy never enables model-based uploads (including during upgrades). */
+export const resolveEffectiveUseResponsesApi = ({
+ value,
+ endpoint,
+ model,
+ routing,
+ webSearch,
+}: {
+ value?: boolean | null;
+ endpoint?: string | null;
+ model?: string | null;
+ routing?: ResponsesApiRouting;
+ webSearch?: boolean | null;
+}): boolean | undefined => {
+ if (endpoint !== EModelEndpoint.openAI && endpoint !== EModelEndpoint.azureOpenAI) {
+ return value ?? undefined;
+ }
+ let policy = model ? routing?.[model] : undefined;
+ if (!policy && model && prefersResponsesApiByModel(model)) {
+ const family = /^gpt-6-(?:astra|sol|luna)(?=-|$)/i.exec(model)?.[0].toLowerCase();
+ policy = family ? routing?.[`${family}-*`] : undefined;
+ }
+ policy ??= routing?.['*'];
+ if (!policy) return value ?? undefined;
+ if (webSearch && policy.withWebSearch) policy = policy.withWebSearch;
+ if (value == null) return policy.default;
+ return value ? policy.on : policy.off;
+};
+
export const isBedrockDocumentType = (mimeType?: string): boolean =>
mimeType != null && mimeType in bedrockDocumentFormats;
diff --git a/packages/data-provider/src/parameterSettings.ts b/packages/data-provider/src/parameterSettings.ts
index 58067190fb..155760b8e3 100644
--- a/packages/data-provider/src/parameterSettings.ts
+++ b/packages/data-provider/src/parameterSettings.ts
@@ -1,3 +1,4 @@
+import type { ResponsesApiRouting } from './types';
import {
Verbosity,
ImageDetail,
@@ -17,6 +18,7 @@ import {
anthropicSettings,
} from './types';
import { SettingDefinition, SettingsConfiguration } from './generate';
+import { resolveEffectiveUseResponsesApi } from './file-config';
import { isOpus55Model, supportsPromptCache } from './bedrock';
// Base definitions
@@ -1315,6 +1317,7 @@ export function applyModelAwareDefaults(
settings: SettingsConfiguration,
endpoint: string,
model?: string,
+ responsesApiRouting?: ResponsesApiRouting,
): SettingsConfiguration {
if (!model) {
return settings;
@@ -1335,6 +1338,28 @@ export function applyModelAwareDefaults(
: setting,
);
}
+ if (/^gpt-6-(?:sol|luna)(?:$|-)/i.test(model)) {
+ return settings.map((setting) => {
+ if (setting.key === 'reasoning_effort') {
+ return {
+ ...setting,
+ options: setting.options?.filter((effort) => effort !== ReasoningEffort.minimal),
+ };
+ }
+ /** Match the native backend's unset default without writing into stored
+ * settings. Explicit false still overrides this rendered default. */
+ if (setting.key === 'useResponsesApi') {
+ const route = (value?: boolean) =>
+ resolveEffectiveUseResponsesApi({ endpoint, model, routing: responsesApiRouting, value });
+ return {
+ ...setting,
+ default: route() ?? false,
+ enumMappings: { true: route(true) ?? true, false: route(false) ?? false },
+ };
+ }
+ return setting;
+ });
+ }
if (isOpus55Model(model)) {
return settings.filter(
(setting) =>
diff --git a/packages/data-provider/src/types.ts b/packages/data-provider/src/types.ts
index aa94eba897..9cd3f33cfa 100644
--- a/packages/data-provider/src/types.ts
+++ b/packages/data-provider/src/types.ts
@@ -628,7 +628,17 @@ export type TCodeEnvironmentMoveResponse = {
codeWorkspaces: CodeWorkspaceSelection[];
};
+/** Sanitized results of server request shaping for each saved toggle state. */
+export type ResponsesApiRoute = {
+ default: boolean;
+ on: boolean;
+ off: boolean;
+ withWebSearch?: { default: boolean; on: boolean; off: boolean };
+};
+export type ResponsesApiRouting = Record<string, ResponsesApiRoute>;
+
export type TConfig = {
+ responsesApiRouting?: ResponsesApiRouting;
order: number;
type?: EModelEndpoint;
azure?: boolean;
diff --git a/packages/data-provider/src/types/agents.ts b/packages/data-provider/src/types/agents.ts
index 2b26e8dabd..9ee535636a 100644
--- a/packages/data-provider/src/types/agents.ts
+++ b/packages/data-provider/src/types/agents.ts
@@ -867,6 +867,7 @@ export type AgentModelParameters = {
frequency_penalty: AgentParameterValue;
presence_penalty: AgentParameterValue;
useResponsesApi?: boolean;
+ web_search?: boolean;
};
export interface AgentBaseResource {
diff --git a/packages/data-schemas/src/methods/systemGrant.spec.ts b/packages/data-schemas/src/methods/systemGrant.spec.ts
index c7d9fb9ae1..c76c4bf373 100644
--- a/packages/data-schemas/src/methods/systemGrant.spec.ts
+++ b/packages/data-schemas/src/methods/systemGrant.spec.ts
@@ -25,6 +25,9 @@ beforeAll(async () => {
mongoose.models.SystemGrant || mongoose.model<t.ISystemGrant>('SystemGrant', systemGrantSchema);
methods = createSystemGrantMethods(mongoose);
await mongoose.connect(mongoServer.getUri());
+ // Connecting does not wait for the unique index. Complete initialization
+ // before any seeding or duplicate writes can race the background build.
+ await SystemGrant.init();
});
afterAll(async () => {
@@ -893,6 +896,18 @@ describe('systemGrant methods', () => {
});
describe('schema validation', () => {
+ it('starts with the non-sparse unique grant index ready', async () => {
+ const indexes = await SystemGrant.collection.indexes();
+ const unique = indexes.find((index) => index.unique === true);
+ expect(unique?.key).toEqual({
+ principalType: 1,
+ principalId: 1,
+ capability: 1,
+ tenantId: 1,
+ });
+ expect(unique?.sparse).not.toBe(true);
+ });
+
it('rejects null tenantId at the schema level', async () => {
await expect(
SystemGrant.create({
diff --git a/packages/data-schemas/src/methods/tx.spec.ts b/packages/data-schemas/src/methods/tx.spec.ts
index 8f081e6a3c..23a4fb9cce 100644
--- a/packages/data-schemas/src/methods/tx.spec.ts
+++ b/packages/data-schemas/src/methods/tx.spec.ts
@@ -3219,3 +3219,30 @@ describe('Opus 5.5 pricing', () => {
expect(cacheTokenValues[key].read).toBeLessThan(cacheTokenValues['claude-opus-5'].read);
});
});
+
+describe.each([
+ ['gpt-6-sol', 2, 0.2, 2.5, 10],
+ ['gpt-6-luna', 0.1, 0.01, 0.125, 0.5],
+] as const)('%s published pricing', (model, input, read, write, output) => {
+ it.each([272000, 272001])(
+ 'applies full-request rates at %i total input tokens',
+ (inputTokenCount) => {
+ const premium = inputTokenCount > 272000;
+ for (const name of [model, `${model}-2026-09-22`, `openai/${model}`]) {
+ expect(getValueKey(name)).toBe(model);
+ expect(getMultiplier({ model: name, tokenType: 'prompt', inputTokenCount })).toBeCloseTo(
+ input * (premium ? 2 : 1),
+ );
+ expect(
+ getMultiplier({ model: name, tokenType: 'completion', inputTokenCount }),
+ ).toBeCloseTo(output * (premium ? 1.5 : 1));
+ expect(getCacheMultiplier({ model: name, cacheType: 'read', inputTokenCount })).toBeCloseTo(
+ read * (premium ? 2 : 1),
+ );
+ expect(
+ getCacheMultiplier({ model: name, cacheType: 'write', inputTokenCount }),
+ ).toBeCloseTo(write * (premium ? 2 : 1));
+ }
+ },
+ );
+});
diff --git a/packages/data-schemas/src/methods/tx.ts b/packages/data-schemas/src/methods/tx.ts
index 01a2d01a00..74ff8f8e6a 100644
--- a/packages/data-schemas/src/methods/tx.ts
+++ b/packages/data-schemas/src/methods/tx.ts
@@ -151,6 +151,8 @@ export const tokenValues: Record<string, { prompt: number; completion: number }>
'gpt-5.6-terra': { prompt: 2, completion: 12 },
'gpt-5.6-luna': { prompt: 0.2, completion: 1.2 },
'gpt-6-astra': { prompt: 10, completion: 50 },
+ 'gpt-6-sol': { prompt: 2, completion: 10 },
+ 'gpt-6-luna': { prompt: 0.1, completion: 0.5 },
'chat-latest': { prompt: 5, completion: 30 },
'gpt-5-chat-latest': { prompt: 1.25, completion: 10 },
'gpt-5.1-chat-latest': { prompt: 1.25, completion: 10 },
@@ -397,6 +399,8 @@ export const cacheTokenValues: Record<string, { write: number; read: number }> =
'gpt-5.6-terra': { write: 2.5, read: 0.2 },
'gpt-5.6-luna': { write: 0.25, read: 0.02 },
'gpt-6-astra': { write: 12.5, read: 1 },
+ 'gpt-6-sol': { write: 2.5, read: 0.2 },
+ 'gpt-6-luna': { write: 0.125, read: 0.01 },
'chat-latest': { write: 5, read: 0.5 },
'gpt-5-chat-latest': { write: 1.25, read: 0.125 },
'gpt-5.1-chat-latest': { write: 1.25, read: 0.125 },
@@ -456,6 +460,8 @@ export const premiumTokenValues: Record<
'gpt-5.6-terra': { threshold: 272000, prompt: 4, completion: 18 },
'gpt-5.6-luna': { threshold: 272000, prompt: 0.4, completion: 1.8 },
'gpt-6-astra': { threshold: 272000, prompt: 20, completion: 75 },
+ 'gpt-6-sol': { threshold: 272000, prompt: 4, completion: 15 },
+ 'gpt-6-luna': { threshold: 272000, prompt: 0.2, completion: 0.75 },
'grok-4.5': { threshold: 200000, prompt: 4, completion: 12 },
'grok-4-5': { threshold: 200000, prompt: 4, completion: 12 },
'grok-4.6': { threshold: 200000, prompt: 4, completion: 12 },
@@ -481,6 +487,8 @@ export const premiumCacheTokenValues: Record<
'gpt-5.6-terra': { threshold: 272000, write: 5, read: 0.4 },
'gpt-5.6-luna': { threshold: 272000, write: 0.5, read: 0.04 },
'gpt-6-astra': { threshold: 272000, write: 25, read: 2 },
+ 'gpt-6-sol': { threshold: 272000, write: 5, read: 0.4 },
+ 'gpt-6-luna': { threshold: 272000, write: 0.25, read: 0.02 },
'grok-4.7': { threshold: 199999, write: 4, read: 1 },
'grok-4-7': { threshold: 199999, write: 4, read: 1 },
};