Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

✨ feat: add thinkingLevel5 with xhigh for Gemini 4 Hydrogen (#22933)

YuTengjingf5a0e90d1e16
diff --git a/apps/server/src/routers/lambda/evalRunConfig.schema.ts b/apps/server/src/routers/lambda/evalRunConfig.schema.ts
index a53c824b866..41416939d82 100644
--- a/apps/server/src/routers/lambda/evalRunConfig.schema.ts
+++ b/apps/server/src/routers/lambda/evalRunConfig.schema.ts
@@ -102,6 +102,7 @@ export const evalRunChatConfigSchema = AgentChatConfigSchema.pick({
thinkingLevel2: true,
thinkingLevel3: true,
thinkingLevel4: true,
+ thinkingLevel5: true,
}).strict();
export const evalRunModelParamsSchema = z
diff --git a/locales/en-US/modelProvider.json b/locales/en-US/modelProvider.json
index c7969ea3bdb..11f3f9b1d87 100644
--- a/locales/en-US/modelProvider.json
+++ b/locales/en-US/modelProvider.json
@@ -264,6 +264,7 @@
"providerModels.item.modelConfig.extendParams.options.thinkingLevel2.hint": "For Gemini 3 Pro Preview models; controls thinking depth.",
"providerModels.item.modelConfig.extendParams.options.thinkingLevel3.hint": "For Gemini 3.1 Pro Preview models; controls thinking depth with low/medium/high levels.",
"providerModels.item.modelConfig.extendParams.options.thinkingLevel4.hint": "For Gemini 3.1 Flash Image models; toggle thinking on/off.",
+ "providerModels.item.modelConfig.extendParams.options.thinkingLevel5.hint": "For Gemini 4 Hydrogen models; controls thinking depth with low/medium/high/xhigh levels.",
"providerModels.item.modelConfig.extendParams.options.urlContext.hint": "For Gemini series; supports providing URL context.",
"providerModels.item.modelConfig.extendParams.placeholder": "Select extended parameters to enable",
"providerModels.item.modelConfig.extendParams.previewFallback": "Preview unavailable",
diff --git a/locales/zh-CN/modelProvider.json b/locales/zh-CN/modelProvider.json
index 8ead8bc0150..276462aad06 100644
--- a/locales/zh-CN/modelProvider.json
+++ b/locales/zh-CN/modelProvider.json
@@ -264,6 +264,7 @@
"providerModels.item.modelConfig.extendParams.options.thinkingLevel2.hint": "适用于 Gemini 3 Pro Preview 模型;控制思考深度。",
"providerModels.item.modelConfig.extendParams.options.thinkingLevel3.hint": "适用于 Gemini 3.1 Pro Preview 模型;通过低/中/高等级控制思考深度。",
"providerModels.item.modelConfig.extendParams.options.thinkingLevel4.hint": "适用于 Gemini 3.1 Flash Image 模型;切换思考开/关。",
+ "providerModels.item.modelConfig.extendParams.options.thinkingLevel5.hint": "适用于 Gemini 4 Hydrogen 模型;通过低/中/高/超高等级控制思考深度。",
"providerModels.item.modelConfig.extendParams.options.urlContext.hint": "适用于 Gemini 系列;支持提供 URL 上下文。",
"providerModels.item.modelConfig.extendParams.placeholder": "选择要启用的扩展参数",
"providerModels.item.modelConfig.extendParams.previewFallback": "无法预览",
diff --git a/packages/locales/src/default/modelProvider.ts b/packages/locales/src/default/modelProvider.ts
index 55432761d37..60e9e2b9a56 100644
--- a/packages/locales/src/default/modelProvider.ts
+++ b/packages/locales/src/default/modelProvider.ts
@@ -340,6 +340,8 @@ export default {
'For Gemini 3.1 Pro Preview models; controls thinking depth with low/medium/high levels.',
'providerModels.item.modelConfig.extendParams.options.thinkingLevel4.hint':
'For Gemini 3.1 Flash Image models; toggle thinking on/off.',
+ 'providerModels.item.modelConfig.extendParams.options.thinkingLevel5.hint':
+ 'For Gemini 4 Hydrogen models; controls thinking depth with low/medium/high/xhigh levels.',
'providerModels.item.modelConfig.extendParams.options.urlContext.hint':
'For Gemini series; supports providing URL context.',
'providerModels.item.modelConfig.extendParams.placeholder':
diff --git a/packages/model-bank/src/types/aiModel.test.ts b/packages/model-bank/src/types/aiModel.test.ts
index e81799b075a..515448f6943 100644
--- a/packages/model-bank/src/types/aiModel.test.ts
+++ b/packages/model-bank/src/types/aiModel.test.ts
@@ -27,6 +27,7 @@ describe('Gemini reasoning config persistence', () => {
thinkingLevel2: 'low',
thinkingLevel3: 'medium',
thinkingLevel4: 'high',
+ thinkingLevel5: 'xhigh',
};
expect(AiModelReasoningConfigSchema.parse(config)).toEqual(config);
expect(AiModelReasoningConfigSchema.safeParse({ thinkingLevel3: 'minimal' }).success).toBe(
@@ -35,5 +36,8 @@ describe('Gemini reasoning config persistence', () => {
expect(AiModelReasoningConfigSchema.safeParse({ thinkingLevel4: 'medium' }).success).toBe(
false,
);
+ expect(AiModelReasoningConfigSchema.safeParse({ thinkingLevel5: 'minimal' }).success).toBe(
+ false,
+ );
});
});
diff --git a/packages/model-bank/src/types/aiModel.ts b/packages/model-bank/src/types/aiModel.ts
index 09160a61d5b..33904f04f5c 100644
--- a/packages/model-bank/src/types/aiModel.ts
+++ b/packages/model-bank/src/types/aiModel.ts
@@ -385,6 +385,7 @@ export interface AiModelReasoningConfig {
thinkingLevel2?: 'low' | 'high';
thinkingLevel3?: 'low' | 'medium' | 'high';
thinkingLevel4?: 'minimal' | 'high';
+ thinkingLevel5?: 'low' | 'medium' | 'high' | 'xhigh';
}
export const AiModelReasoningConfigSchema = z.object({
@@ -416,6 +417,7 @@ export const AiModelReasoningConfigSchema = z.object({
thinkingLevel2: z.enum(['low', 'high']).optional(),
thinkingLevel3: z.enum(['low', 'medium', 'high']).optional(),
thinkingLevel4: z.enum(['minimal', 'high']).optional(),
+ thinkingLevel5: z.enum(['low', 'medium', 'high', 'xhigh']).optional(),
});
/**
@@ -463,6 +465,7 @@ export const MODEL_REASONING_PARAM_LEVELS: {
thinkingLevel2: ['low', 'high'],
thinkingLevel3: ['low', 'medium', 'high'],
thinkingLevel4: ['minimal', 'high'],
+ thinkingLevel5: ['low', 'medium', 'high', 'xhigh'],
};
/**
@@ -501,6 +504,7 @@ export const MODEL_REASONING_PARAM_DEFAULTS: {
thinkingLevel2: 'high',
thinkingLevel3: 'high',
thinkingLevel4: 'minimal',
+ thinkingLevel5: 'high',
};
export interface AiModelConfig {
@@ -563,6 +567,7 @@ export type ExtendParamsType =
| 'thinkingLevel2'
| 'thinkingLevel3'
| 'thinkingLevel4'
+ | 'thinkingLevel5'
| 'imageAspectRatio'
| 'imageAspectRatio2'
| 'imageResolution'
@@ -626,6 +631,7 @@ export const ExtendParamsTypeSchema = z.enum([
'thinkingLevel2',
'thinkingLevel3',
'thinkingLevel4',
+ 'thinkingLevel5',
'imageAspectRatio',
'imageAspectRatio2',
'imageResolution',
diff --git a/packages/model-runtime/src/providers/google/thinkingResolver.test.ts b/packages/model-runtime/src/providers/google/thinkingResolver.test.ts
index 9fab76de03e..57eff51628b 100644
--- a/packages/model-runtime/src/providers/google/thinkingResolver.test.ts
+++ b/packages/model-runtime/src/providers/google/thinkingResolver.test.ts
@@ -270,6 +270,14 @@ describe('thinkingResolver', () => {
).toMatchObject({ thinkingBudget: undefined, thinkingLevel: 'high' });
});
+ it('passes the xhigh thinkingLevel through for Gemini 4 Hydrogen', () => {
+ expect(resolveGoogleThinkingConfig('gemini-4-hydrogen', { thinkingLevel: 'xhigh' })).toEqual({
+ includeThoughts: true,
+ thinkingBudget: undefined,
+ thinkingLevel: 'xhigh',
+ });
+ });
+
describe('gemini-pro (legacy unversioned model)', () => {
const model = 'gemini-pro';
diff --git a/packages/model-runtime/src/providers/google/thinkingResolver.ts b/packages/model-runtime/src/providers/google/thinkingResolver.ts
index f6850271660..169bb88052f 100644
--- a/packages/model-runtime/src/providers/google/thinkingResolver.ts
+++ b/packages/model-runtime/src/providers/google/thinkingResolver.ts
@@ -20,7 +20,7 @@ export type GoogleThinkingModelCategory = 'pro' | 'flash' | 'flashLite' | 'robot
/**
* Thinking level for Gemini 3.0+ models
*/
-export type GoogleThinkingLevel = 'minimal' | 'low' | 'medium' | 'high';
+export type GoogleThinkingLevel = 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
/**
* Options for resolving Google thinking configuration
diff --git a/packages/model-runtime/src/types/chat.ts b/packages/model-runtime/src/types/chat.ts
index 355f5fc3d7c..1c8f440f597 100644
--- a/packages/model-runtime/src/types/chat.ts
+++ b/packages/model-runtime/src/types/chat.ts
@@ -196,7 +196,7 @@ export interface ChatStreamPayload {
/**
* Thinking level for Gemini models (e.g., gemini-3.0-pro)
*/
- thinkingLevel?: 'minimal' | 'low' | 'medium' | 'high';
+ thinkingLevel?: 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
tool_choice?: string;
tools?: ChatCompletionTool[];
/**
diff --git a/packages/model-runtime/src/utils/modelExtendParams.test.ts b/packages/model-runtime/src/utils/modelExtendParams.test.ts
index 5f9556d79a8..0a781b8a69a 100644
--- a/packages/model-runtime/src/utils/modelExtendParams.test.ts
+++ b/packages/model-runtime/src/utils/modelExtendParams.test.ts
@@ -44,6 +44,26 @@ describe('applyModelExtendParams', () => {
expect(result.thinkingLevel).toBe('high');
});
+ it('defaults Gemini 4 Hydrogen thinkingLevel to high (thinkingLevel5)', () => {
+ const result = applyModelExtendParams({
+ chatConfig: chatConfig({}),
+ extendParams: ['thinkingLevel5', 'urlContext'],
+ model: 'gemini-4-hydrogen',
+ });
+
+ expect(result.thinkingLevel).toBe('high');
+ });
+
+ it('forwards the xhigh thinkingLevel5 config value', () => {
+ const result = applyModelExtendParams({
+ chatConfig: chatConfig({ thinkingLevel5: 'xhigh' }),
+ extendParams: ['thinkingLevel5'],
+ model: 'gemini-4-hydrogen',
+ });
+
+ expect(result.thinkingLevel).toBe('xhigh');
+ });
+
it('honors an explicit thinkingLevel3 config value', () => {
const result = applyModelExtendParams({
chatConfig: chatConfig({ thinkingLevel3: 'medium' }),
diff --git a/packages/model-runtime/src/utils/modelExtendParams.ts b/packages/model-runtime/src/utils/modelExtendParams.ts
index 98ebe16e4e0..aa94baf6b19 100644
--- a/packages/model-runtime/src/utils/modelExtendParams.ts
+++ b/packages/model-runtime/src/utils/modelExtendParams.ts
@@ -82,15 +82,16 @@ export interface ModelExtendParams {
}
type ThinkingLevelExtendParam =
- 'thinkingLevel' | 'thinkingLevel2' | 'thinkingLevel3' | 'thinkingLevel4';
+ 'thinkingLevel' | 'thinkingLevel2' | 'thinkingLevel3' | 'thinkingLevel4' | 'thinkingLevel5';
-type ThinkingLevelValue = NonNullable<LobeAgentChatConfig['thinkingLevel']>;
+type ThinkingLevelValue = NonNullable<LobeAgentChatConfig[ThinkingLevelExtendParam]>;
const DEFAULT_THINKING_LEVEL_BY_EXTEND_PARAM = {
thinkingLevel: 'high',
thinkingLevel2: 'high',
thinkingLevel3: 'high',
thinkingLevel4: 'minimal',
+ thinkingLevel5: 'high',
} as const satisfies Record<ThinkingLevelExtendParam, ThinkingLevelValue>;
const MODEL_THINKING_LEVEL_DEFAULTS: Partial<
diff --git a/packages/types/src/agent/chatConfig.ts b/packages/types/src/agent/chatConfig.ts
index 3f788b7954a..3509d5dbfdd 100644
--- a/packages/types/src/agent/chatConfig.ts
+++ b/packages/types/src/agent/chatConfig.ts
@@ -189,6 +189,7 @@ export interface LobeAgentChatConfig extends AgentMemoryChatConfig, AgentSelfIte
thinkingLevel2?: 'low' | 'high';
thinkingLevel3?: 'low' | 'medium' | 'high';
thinkingLevel4?: 'minimal' | 'high';
+ thinkingLevel5?: 'low' | 'medium' | 'high' | 'xhigh';
/**
* Tool-resolution mode. When set it overrides the `enableAgentMode` derivation:
* - `agent` full default toolset + plugins + always-on tools
@@ -306,6 +307,7 @@ export const AgentChatConfigSchema = z
thinkingLevel2: z.enum(['low', 'high']).optional(),
thinkingLevel3: z.enum(['low', 'medium', 'high']).optional(),
thinkingLevel4: z.enum(['minimal', 'high']).optional(),
+ thinkingLevel5: z.enum(['low', 'medium', 'high', 'xhigh']).optional(),
toolResultMaxLength: z.number().default(25000),
topicGroupMode: z
.enum(['byTime', 'byProject', 'flat', 'byStatus', 'byAgent', 'byDevice'])
diff --git a/packages/types/src/eval/agentEval.ts b/packages/types/src/eval/agentEval.ts
index 9d120fccbde..5191a92efda 100644
--- a/packages/types/src/eval/agentEval.ts
+++ b/packages/types/src/eval/agentEval.ts
@@ -109,6 +109,7 @@ export type EvalRunChatConfig = Pick<
| 'thinkingLevel2'
| 'thinkingLevel3'
| 'thinkingLevel4'
+ | 'thinkingLevel5'
>;
/** Logical mock services required by a case, independent of deployment and credentials. */
diff --git a/src/features/ChatInput/hooks/useReasoningEffortControl.test.ts b/src/features/ChatInput/hooks/useReasoningEffortControl.test.ts
index 1a2e490b594..343bf605b36 100644
--- a/src/features/ChatInput/hooks/useReasoningEffortControl.test.ts
+++ b/src/features/ChatInput/hooks/useReasoningEffortControl.test.ts
@@ -88,6 +88,7 @@ describe('useReasoningEffortControl', () => {
['thinkingLevel2', 'gemini-3-pro-preview', ['low', 'high'], 'high'],
['thinkingLevel3', 'gemini-3.7-flash', ['low', 'medium', 'high'], 'medium'],
['thinkingLevel4', 'gemini-3.1-flash-image', ['minimal', 'high'], 'minimal'],
+ ['thinkingLevel5', 'gemini-4-hydrogen', ['low', 'medium', 'high', 'xhigh'], 'high'],
['thinkingLevel', 'gemini-3.1-flash-lite', ['minimal', 'low', 'medium', 'high'], 'minimal'],
])('exposes %s choices and the runtime default for %s', (key, model, levels, fallback) => {
testState.ai.reasoningParams = [key as string];
diff --git a/src/features/ChatInput/hooks/useReasoningEffortControl.ts b/src/features/ChatInput/hooks/useReasoningEffortControl.ts
index 91797485915..a8ac4223719 100644
--- a/src/features/ChatInput/hooks/useReasoningEffortControl.ts
+++ b/src/features/ChatInput/hooks/useReasoningEffortControl.ts
@@ -48,7 +48,8 @@ export const resolveReasoningEffortValue = (
effortKey === 'thinkingLevel' ||
effortKey === 'thinkingLevel2' ||
effortKey === 'thinkingLevel3' ||
- effortKey === 'thinkingLevel4'
+ effortKey === 'thinkingLevel4' ||
+ effortKey === 'thinkingLevel5'
)
return resolveDefaultThinkingLevelForModel(model, effortKey);
diff --git a/src/features/LobeBench/lobeBench.ts b/src/features/LobeBench/lobeBench.ts
index 17021ac3607..4e49f40dcd9 100644
--- a/src/features/LobeBench/lobeBench.ts
+++ b/src/features/LobeBench/lobeBench.ts
@@ -305,6 +305,7 @@ export const CONTENDER_SETTING_KEYS = [
'thinkingLevel2',
'thinkingLevel3',
'thinkingLevel4',
+ 'thinkingLevel5',
'thinkingBudget',
'preserveThinking',
'textVerbosity',
diff --git a/src/features/ModelSwitchPanel/components/ControlsForm/ControlsForm.tsx b/src/features/ModelSwitchPanel/components/ControlsForm/ControlsForm.tsx
index df4bdfb2f0d..ec69ed8ef77 100644
--- a/src/features/ModelSwitchPanel/components/ControlsForm/ControlsForm.tsx
+++ b/src/features/ModelSwitchPanel/components/ControlsForm/ControlsForm.tsx
@@ -57,6 +57,7 @@ import ThinkingBudgetSlider from './ThinkingBudgetSlider';
import ThinkingLevel2Slider from './ThinkingLevel2Slider';
import ThinkingLevel3Slider from './ThinkingLevel3Slider';
import ThinkingLevel4Slider from './ThinkingLevel4Slider';
+import ThinkingLevel5Slider from './ThinkingLevel5Slider';
import ThinkingLevelSlider from './ThinkingLevelSlider';
import ThinkingSlider from './ThinkingSlider';
@@ -171,6 +172,7 @@ const ControlsForm = memo<ControlsFormProps>(
const gpt52ReasoningEffortDefaultValue = model === 'gpt-5.5' ? 'medium' : 'none';
const thinkingLevelDefaultValue = resolveDefaultThinkingLevelForModel(model);
const thinkingLevel3DefaultValue = resolveDefaultThinkingLevelForModel(model, 'thinkingLevel3');
+ const thinkingLevel5DefaultValue = resolveDefaultThinkingLevelForModel(model, 'thinkingLevel5');
// Show descriptions as a question-mark tooltip beside the label, matching
// the ControlRow items rendered above this form in the params panel.
@@ -598,6 +600,16 @@ const ControlsForm = memo<ControlsFormProps>(
paddingBottom: 0,
},
},
+ {
+ children: <ThinkingLevel5Slider defaultValue={thinkingLevel5DefaultValue} />,
+ label: t('extendParams.thinkingLevel.title'),
+ layout: 'vertical',
+ minWidth: undefined,
+ name: 'thinkingLevel5',
+ style: {
+ paddingBottom: 0,
+ },
+ },
{
children: <ImageAspectRatioSelect />,
label: t('extendParams.imageAspectRatio.title'),
diff --git a/src/features/ModelSwitchPanel/components/ControlsForm/ThinkingLevel5Slider.tsx b/src/features/ModelSwitchPanel/components/ControlsForm/ThinkingLevel5Slider.tsx
new file mode 100644
index 00000000000..77732ae7f8c
--- /dev/null
+++ b/src/features/ModelSwitchPanel/components/ControlsForm/ThinkingLevel5Slider.tsx
@@ -0,0 +1,20 @@
+import { type CreatedLevelSliderProps } from './createLevelSlider';
+import { createLevelSliderComponent } from './createLevelSlider';
+
+/**
+ * Gemini 4 Hydrogen adds `xhigh` above `high` and rejects `minimal`.
+ * See https://ai.google.dev/gemini-api/docs/whats-new-gemini-4-hydrogen
+ */
+const THINKING_LEVELS_5 = ['low', 'medium', 'high', 'xhigh'] as const;
+type ThinkingLevel5 = (typeof THINKING_LEVELS_5)[number];
+
+export type ThinkingLevel5SliderProps = CreatedLevelSliderProps<ThinkingLevel5>;
+
+const ThinkingLevel5Slider = createLevelSliderComponent<ThinkingLevel5>({
+ configKey: 'thinkingLevel5',
+ defaultValue: 'high',
+ levels: THINKING_LEVELS_5,
+ style: { minWidth: 200 },
+});
+
+export default ThinkingLevel5Slider;
diff --git a/src/features/Settings/provider/features/ModelList/CreateNewModelModal/ExtendParamsSelect.tsx b/src/features/Settings/provider/features/ModelList/CreateNewModelModal/ExtendParamsSelect.tsx
index 3b639798b67..01e0cc8847e 100644
--- a/src/features/Settings/provider/features/ModelList/CreateNewModelModal/ExtendParamsSelect.tsx
+++ b/src/features/Settings/provider/features/ModelList/CreateNewModelModal/ExtendParamsSelect.tsx
@@ -41,6 +41,7 @@ import ThinkingBudgetSlider from '@/features/ModelSwitchPanel/components/Control
import ThinkingLevel2Slider from '@/features/ModelSwitchPanel/components/ControlsForm/ThinkingLevel2Slider';
import ThinkingLevel3Slider from '@/features/ModelSwitchPanel/components/ControlsForm/ThinkingLevel3Slider';
import ThinkingLevel4Slider from '@/features/ModelSwitchPanel/components/ControlsForm/ThinkingLevel4Slider';
+import ThinkingLevel5Slider from '@/features/ModelSwitchPanel/components/ControlsForm/ThinkingLevel5Slider';
import ThinkingLevelSlider from '@/features/ModelSwitchPanel/components/ControlsForm/ThinkingLevelSlider';
import ThinkingSlider from '@/features/ModelSwitchPanel/components/ControlsForm/ThinkingSlider';
@@ -207,6 +208,10 @@ const EXTEND_PARAMS_OPTIONS: ExtendParamsOption[] = [
hintKey: 'providerModels.item.modelConfig.extendParams.options.thinkingLevel4.hint',
key: 'thinkingLevel4',
},
+ {
+ hintKey: 'providerModels.item.modelConfig.extendParams.options.thinkingLevel5.hint',
+ key: 'thinkingLevel5',
+ },
{
hintKey: 'providerModels.item.modelConfig.extendParams.options.urlContext.hint',
key: 'urlContext',
@@ -261,6 +266,7 @@ const TITLE_KEY_ALIASES: Partial<Record<ExtendParamsType, ExtendParamsType>> = {
thinkingLevel2: 'thinkingLevel',
thinkingLevel3: 'thinkingLevel',
thinkingLevel4: 'thinkingLevel',
+ thinkingLevel5: 'thinkingLevel',
};
type PreviewMeta = {
@@ -386,6 +392,11 @@ const PREVIEW_META: Partial<Record<ExtendParamsType, PreviewMeta>> = {
thinkingLevel2: { labelSuffix: ' (3 Pro)', previewWidth: 200, tag: 'thinkingLevel' },
thinkingLevel3: { labelSuffix: ' (Gemini 3.1)', previewWidth: 200, tag: 'thinkingLevel' },
thinkingLevel4: { labelSuffix: ' (Nano Banana 2)', previewWidth: 200, tag: 'thinkingLevel' },
+ thinkingLevel5: {
+ labelSuffix: ' (Gemini 4 Hydrogen)',
+ previewWidth: 300,
+ tag: 'thinkingLevel',
+ },
urlContext: { labelSuffix: ' (Gemini)', previewWidth: 400, tag: 'urlContext' },
};
@@ -540,6 +551,7 @@ const ExtendParamsSelect = memo<ExtendParamsSelectProps>(({ value, onChange }) =
thinkingLevel2: <ThinkingLevel2Slider value="high" />,
thinkingLevel3: <ThinkingLevel3Slider value="high" />,
thinkingLevel4: <ThinkingLevel4Slider value="minimal" />,
+ thinkingLevel5: <ThinkingLevel5Slider value="high" />,
urlContext: <Switch checked disabled />,
}),
[],