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.

✨style: add adaptive thinking and effort configuration for Claude Opus 4.6 (#12139)

sxjerub0a8e0f51c9a
diff --git a/locales/zh-CN/chat.json b/locales/zh-CN/chat.json
index 4d888b133c9..92cb1659497 100644
--- a/locales/zh-CN/chat.json
+++ b/locales/zh-CN/chat.json
@@ -60,6 +60,10 @@
"emptyAgentAction": "创建助理",
"extendParams.disableContextCaching.desc": "最多可减少90%的单次对话生成成本,并将速度提升至最多4倍。启用此功能将自动取消历史消息数量的限制。<1>了解更多</1>",
"extendParams.disableContextCaching.title": "开启上下文缓存",
+ "extendParams.effort.desc": "控制 Claude 响应时使用的 token 数量。",
+ "extendParams.effort.title": "推理力度",
+ "extendParams.enableAdaptiveThinking.desc": "让 Claude 通过自适应思考模式动态决定何时思考以及思考多少。",
+ "extendParams.enableAdaptiveThinking.title": "开启自适应思考",
"extendParams.enableReasoning.desc": "基于Claude推理机制的限制,启用此功能将自动取消历史消息数量的限制。<1>了解更多</1>",
"extendParams.enableReasoning.title": "开启深度思考",
"extendParams.imageAspectRatio.title": "图片宽高比",
diff --git a/locales/zh-CN/modelProvider.json b/locales/zh-CN/modelProvider.json
index 502f478dbaa..aed5818c725 100644
--- a/locales/zh-CN/modelProvider.json
+++ b/locales/zh-CN/modelProvider.json
@@ -196,6 +196,8 @@
"providerModels.item.modelConfig.displayName.title": "模型展示名称",
"providerModels.item.modelConfig.extendParams.extra": "选择模型支持的扩展参数。将鼠标悬停在选项上可预览控制项。配置错误可能导致请求失败。",
"providerModels.item.modelConfig.extendParams.options.disableContextCaching.hint": "适用于 Claude 模型;可降低成本并加快响应速度。",
+ "providerModels.item.modelConfig.extendParams.options.effort.hint": "适用于 Claude Opus 4.6;控制推理力度。",
+ "providerModels.item.modelConfig.extendParams.options.enableAdaptiveThinking.hint": "适用于 Claude Opus 4.6;开启或关闭自适应思考。",
"providerModels.item.modelConfig.extendParams.options.enableReasoning.hint": "适用于 Claude、DeepSeek 及其他推理模型;可启用更深层次的思考能力。",
"providerModels.item.modelConfig.extendParams.options.gpt5ReasoningEffort.hint": "适用于 GPT-5 系列;控制推理强度。",
"providerModels.item.modelConfig.extendParams.options.gpt5_1ReasoningEffort.hint": "适用于 GPT-5.1 系列;控制推理强度。",
diff --git a/package.json b/package.json
index ba1b51ddc86..f5b4cb916ac 100644
--- a/package.json
+++ b/package.json
@@ -35,12 +35,12 @@
"prebuild": "tsx scripts/prebuild.mts && npm run lint",
"build": "cross-env NODE_OPTIONS=--max-old-space-size=8192 next build --webpack",
"postbuild": "npm run build-sitemap && npm run build-migrate-db",
+ "build-migrate-db": "bun run db:migrate",
+ "build-sitemap": "tsx ./scripts/buildSitemapIndex/index.ts",
"build:analyze": "NODE_OPTIONS=--max-old-space-size=81920 ANALYZE=true next build --webpack",
"build:docker": "npm run prebuild && NODE_OPTIONS=--max-old-space-size=8192 DOCKER=true next build --webpack && npm run build-sitemap",
"build:electron": "cross-env NODE_OPTIONS=--max-old-space-size=8192 NEXT_PUBLIC_IS_DESKTOP_APP=1 tsx scripts/electronWorkflow/buildNextApp.mts",
"build:vercel": "npm run prebuild && cross-env NODE_OPTIONS=--max-old-space-size=6144 next build --webpack && npm run postbuild",
- "build-migrate-db": "bun run db:migrate",
- "build-sitemap": "tsx ./scripts/buildSitemapIndex/index.ts",
"clean:node_modules": "bash -lc 'set -e; echo \"Removing all node_modules...\"; rm -rf node_modules; pnpm -r exec rm -rf node_modules; rm -rf apps/desktop/node_modules; echo \"All node_modules removed.\"'",
"db:generate": "drizzle-kit generate && npm run workflow:dbml",
"db:migrate": "MIGRATION_DB=1 tsx ./scripts/migrateServerDB/index.ts",
@@ -91,11 +91,11 @@
"start": "next start -p 3210",
"stylelint": "stylelint \"src/**/*.{js,jsx,ts,tsx}\" --fix",
"test": "npm run test-app && npm run test-server",
+ "test-app": "vitest run",
+ "test-app:coverage": "vitest --coverage --silent='passed-only'",
"test:e2e": "pnpm --filter @lobechat/e2e-tests test",
"test:e2e:smoke": "pnpm --filter @lobechat/e2e-tests test:smoke",
"test:update": "vitest -u",
- "test-app": "vitest run",
- "test-app:coverage": "vitest --coverage --silent='passed-only'",
"tunnel:cloudflare": "cloudflared tunnel --url http://localhost:3010",
"tunnel:ngrok": "ngrok http http://localhost:3011",
"type-check": "tsgo --noEmit",
@@ -144,7 +144,7 @@
"dependencies": {
"@ant-design/icons": "^6.1.0",
"@ant-design/pro-components": "^2.8.10",
- "@anthropic-ai/sdk": "^0.67.1",
+ "@anthropic-ai/sdk": "^0.73.0",
"@atlaskit/pragmatic-drag-and-drop": "^1.7.7",
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.1.0",
"@aws-sdk/client-s3": "~3.932.0",
diff --git a/packages/model-bank/src/aiModels/aihubmix.ts b/packages/model-bank/src/aiModels/aihubmix.ts
index dac73c3ca31..cd70f90b22b 100644
--- a/packages/model-bank/src/aiModels/aihubmix.ts
+++ b/packages/model-bank/src/aiModels/aihubmix.ts
@@ -668,6 +668,41 @@ const aihubmixModels: AIChatModelCard[] = [
},
type: 'chat',
},
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ search: true,
+ structuredOutput: true,
+ vision: true,
+ },
+ contextWindowTokens: 200_000,
+ description:
+ 'Claude Opus 4.6 is Anthropic’s most intelligent model for building agents and coding.',
+ displayName: 'Claude Opus 4.6',
+ enabled: true,
+ id: 'claude-opus-4-6',
+ maxOutput: 128_000,
+ pricing: {
+ units: [
+ { name: 'textInput_cacheRead', rate: 0.5, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textInput', rate: 5, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 25, strategy: 'fixed', unit: 'millionTokens' },
+ {
+ lookup: { prices: { '1h': 10, '5m': 6.25 }, pricingParams: ['ttl'] },
+ name: 'textInput_cacheWrite',
+ strategy: 'lookup',
+ unit: 'millionTokens',
+ },
+ ],
+ },
+ releasedAt: '2026-02-05',
+ settings: {
+ extendParams: ['disableContextCaching', 'enableAdaptiveThinking', 'effort'],
+ searchImpl: 'params',
+ },
+ type: 'chat',
+ },
{
abilities: {
functionCall: true,
@@ -680,7 +715,6 @@ const aihubmixModels: AIChatModelCard[] = [
description:
'Claude Opus 4.5 is Anthropic’s flagship model, combining top-tier intelligence with scalable performance for complex, high-quality reasoning tasks.',
displayName: 'Claude Opus 4.5',
- enabled: true,
id: 'claude-opus-4-5-20251101',
maxOutput: 64_000,
pricing: {
diff --git a/packages/model-bank/src/aiModels/anthropic.ts b/packages/model-bank/src/aiModels/anthropic.ts
index e093c0a894f..60b832f8017 100644
--- a/packages/model-bank/src/aiModels/anthropic.ts
+++ b/packages/model-bank/src/aiModels/anthropic.ts
@@ -1,6 +1,41 @@
import { AIChatModelCard } from '../types/aiModel';
const anthropicChatModels: AIChatModelCard[] = [
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ search: true,
+ structuredOutput: true,
+ vision: true,
+ },
+ contextWindowTokens: 200_000,
+ description:
+ 'Claude Opus 4.6 is Anthropic’s most intelligent model for building agents and coding.',
+ displayName: 'Claude Opus 4.6',
+ enabled: true,
+ id: 'claude-opus-4-6',
+ maxOutput: 128_000,
+ pricing: {
+ units: [
+ { name: 'textInput_cacheRead', rate: 0.5, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textInput', rate: 5, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 25, strategy: 'fixed', unit: 'millionTokens' },
+ {
+ lookup: { prices: { '1h': 10, '5m': 6.25 }, pricingParams: ['ttl'] },
+ name: 'textInput_cacheWrite',
+ strategy: 'lookup',
+ unit: 'millionTokens',
+ },
+ ],
+ },
+ releasedAt: '2026-02-05',
+ settings: {
+ extendParams: ['disableContextCaching', 'enableAdaptiveThinking', 'effort'],
+ searchImpl: 'params',
+ },
+ type: 'chat',
+ },
{
abilities: {
functionCall: true,
@@ -13,7 +48,6 @@ const anthropicChatModels: AIChatModelCard[] = [
description:
'Claude Opus 4.5 is Anthropic’s flagship model, combining top-tier intelligence with scalable performance for complex, high-quality reasoning tasks.',
displayName: 'Claude Opus 4.5',
- enabled: true,
id: 'claude-opus-4-5-20251101',
maxOutput: 64_000,
pricing: {
diff --git a/packages/model-bank/src/types/aiModel.ts b/packages/model-bank/src/types/aiModel.ts
index ff9e347ca44..8b58734e05e 100644
--- a/packages/model-bank/src/types/aiModel.ts
+++ b/packages/model-bank/src/types/aiModel.ts
@@ -235,7 +235,9 @@ export type ModelSearchImplementType = 'tool' | 'params' | 'internal';
export type ExtendParamsType =
| 'reasoningBudgetToken'
| 'enableReasoning'
+ | 'enableAdaptiveThinking'
| 'disableContextCaching'
+ | 'effort'
| 'reasoningEffort'
| 'gpt5ReasoningEffort'
| 'gpt5_1ReasoningEffort'
@@ -262,7 +264,9 @@ export interface AiModelSettings {
export const ExtendParamsTypeSchema = z.enum([
'reasoningBudgetToken',
'enableReasoning',
+ 'enableAdaptiveThinking',
'disableContextCaching',
+ 'effort',
'reasoningEffort',
'gpt5ReasoningEffort',
'gpt5_1ReasoningEffort',
diff --git a/packages/model-runtime/package.json b/packages/model-runtime/package.json
index e1857aa59ee..5c908f99270 100644
--- a/packages/model-runtime/package.json
+++ b/packages/model-runtime/package.json
@@ -12,7 +12,7 @@
"test:update": "vitest -u"
},
"dependencies": {
- "@anthropic-ai/sdk": "^0.67.1",
+ "@anthropic-ai/sdk": "^0.73.0",
"@aws-sdk/client-bedrock-runtime": "^3.941.0",
"@azure-rest/ai-inference": "1.0.0-beta.5",
"@azure/core-auth": "^1.10.1",
diff --git a/packages/model-runtime/src/core/anthropicCompatibleFactory/index.ts b/packages/model-runtime/src/core/anthropicCompatibleFactory/index.ts
index 80252b46e1b..c5cec8c10a6 100644
--- a/packages/model-runtime/src/core/anthropicCompatibleFactory/index.ts
+++ b/packages/model-runtime/src/core/anthropicCompatibleFactory/index.ts
@@ -4,12 +4,6 @@ import type { ChatModelCard } from '@lobechat/types';
import debug from 'debug';
import { hasTemperatureTopPConflict } from '../../const/models';
-import {
- buildAnthropicMessages,
- buildAnthropicTools,
- buildSearchTool,
-} from '../contextBuilders/anthropic';
-import { resolveParameters } from '../parameterResolver';
import {
ChatCompletionErrorPayload,
ChatMethodOptions,
@@ -26,6 +20,12 @@ import { getModelPricing } from '../../utils/getModelPricing';
import { MODEL_LIST_CONFIGS, processModelList } from '../../utils/modelParse';
import { StreamingResponse } from '../../utils/response';
import { LobeRuntimeAI } from '../BaseAI';
+import {
+ buildAnthropicMessages,
+ buildAnthropicTools,
+ buildSearchTool,
+} from '../contextBuilders/anthropic';
+import { resolveParameters } from '../parameterResolver';
import { AnthropicStream } from '../streams';
import type { ComputeChatCostOptions } from '../usageConverters/utils/computeChatCost';
import { createAnthropicGenerateObject } from './generateObject';
@@ -95,11 +95,10 @@ export interface AnthropicCompatibleFactoryOptions<T extends Record<string, any>
provider: string;
}
-export interface AnthropicCompatibleParamsInput<T extends Record<string, any> = any>
- extends Omit<
- AnthropicCompatibleFactoryOptions<T>,
- 'chatCompletion' | 'customClient' | 'generateObject' | 'models'
- > {
+export interface AnthropicCompatibleParamsInput<T extends Record<string, any> = any> extends Omit<
+ AnthropicCompatibleFactoryOptions<T>,
+ 'chatCompletion' | 'customClient' | 'generateObject' | 'models'
+> {
chatCompletion?: Partial<NonNullable<AnthropicCompatibleFactoryOptions<T>['chatCompletion']>>;
customClient?: CustomClientOptions<T>;
generateObject?: AnthropicCompatibleFactoryOptions<T>['generateObject'];
@@ -120,6 +119,7 @@ export const buildDefaultAnthropicPayload = async (
top_p,
tools,
thinking,
+ effort,
enabledContextCaching = true,
enabledSearch,
} = payload;
@@ -148,6 +148,11 @@ export const buildDefaultAnthropicPayload = async (
const postMessages = await buildAnthropicMessages(userMessages, { enabledContextCaching });
+ // Claude Opus 4.6 does not support assistant turn prefill
+ if (model.includes('opus-4-6') && postMessages.at(-1)?.role === 'assistant') {
+ postMessages.pop();
+ }
+
let postTools = buildAnthropicTools(tools, { enabledContextCaching }) as
| AnthropicTools[]
| undefined;
@@ -157,20 +162,26 @@ export const buildDefaultAnthropicPayload = async (
postTools = postTools?.length ? [...postTools, webSearchTool] : [webSearchTool];
}
- if (!!thinking && thinking.type === 'enabled') {
+ if (!!thinking && (thinking.type === 'enabled' || thinking.type === 'adaptive')) {
+ const resolvedThinking: Anthropic.MessageCreateParams['thinking'] =
+ thinking.type === 'enabled'
+ ? {
+ budget_tokens: thinking?.budget_tokens
+ ? Math.min(thinking.budget_tokens, resolvedMaxTokens - 1)
+ : 1024,
+ type: 'enabled',
+ }
+ : { type: 'adaptive' as any };
+
return {
max_tokens: resolvedMaxTokens,
messages: postMessages,
model,
system: systemPrompts,
- thinking: {
- ...thinking,
- budget_tokens: thinking?.budget_tokens
- ? Math.min(thinking.budget_tokens, resolvedMaxTokens - 1)
- : 1024,
- },
+ ...(thinking.type === 'adaptive' && effort ? { output_config: { effort } } : {}),
+ thinking: resolvedThinking,
tools: postTools as Anthropic.MessageCreateParams['tools'],
- } satisfies Anthropic.MessageCreateParams;
+ } as Anthropic.MessageCreateParams;
}
const hasConflict = hasTemperatureTopPConflict(model);
@@ -295,7 +306,11 @@ export const createDefaultAnthropicModels = async ({
}
const json = await response.json();
- const modelList = (json['data'] || []) as Array<{ created_at: string; display_name: string; id: string }>;
+ const modelList = (json['data'] || []) as Array<{
+ created_at: string;
+ display_name: string;
+ id: string;
+ }>;
const standardModelList = modelList.map((model) => ({
created: model.created_at,
@@ -363,17 +378,30 @@ export const createAnthropicCompatibleRuntime = <T extends Record<string, any> =
protected _options: ConstructorOptions<T>;
constructor(options: ClientOptions & Record<string, any> = {}) {
+ const apiKey = typeof options.apiKey === 'string' ? options.apiKey.trim() : options.apiKey;
+ const baseURL =
+ typeof options.baseURL === 'string' ? options.baseURL.trim() : options.baseURL;
+
const resolvedOptions = {
...options,
- apiKey: options.apiKey?.trim() || DEFAULT_API_KEY,
- baseURL: options.baseURL?.trim() || DEFAULT_BASE_URL,
+ apiKey: apiKey || DEFAULT_API_KEY,
+ baseURL: baseURL || DEFAULT_BASE_URL,
};
- const { apiKey, baseURL = DEFAULT_BASE_URL, ...rest } = resolvedOptions;
+ const {
+ apiKey: finalApiKey,
+ baseURL: finalBaseURL = DEFAULT_BASE_URL,
+ ...rest
+ } = resolvedOptions;
this._options = resolvedOptions as ConstructorOptions<T>;
- if (!apiKey) throw AgentRuntimeError.createError(ErrorType.invalidAPIKey);
+ if (!finalApiKey) throw AgentRuntimeError.createError(ErrorType.invalidAPIKey);
- const initOptions = { apiKey, baseURL, ...constructorOptions, ...rest };
+ const initOptions = {
+ apiKey: finalApiKey,
+ baseURL: finalBaseURL,
+ ...constructorOptions,
+ ...rest,
+ };
if (customClient?.createClient) {
this.client = customClient.createClient(initOptions as ConstructorOptions<T>);
@@ -476,7 +504,10 @@ export const createAnthropicCompatibleRuntime = <T extends Record<string, any> =
} satisfies Anthropic.MessageStreamEvent);
controller.enqueue({
- delta: { partial_json: JSON.stringify(block.input ?? {}), type: 'input_json_delta' },
+ delta: {
+ partial_json: JSON.stringify(block.input ?? {}),
+ type: 'input_json_delta',
+ },
index,
type: 'content_block_delta',
} satisfies Anthropic.MessageStreamEvent);
@@ -555,7 +586,7 @@ export const createAnthropicCompatibleRuntime = <T extends Record<string, any> =
async models() {
if (!models) return [];
return models({
- apiKey: this._options.apiKey ?? undefined,
+ apiKey: (this._options.apiKey as string) ?? undefined,
baseURL: this.baseURL,
client: this.client,
});
diff --git a/packages/model-runtime/src/core/anthropicCompatibleFactory/resolveMaxTokens.ts b/packages/model-runtime/src/core/anthropicCompatibleFactory/resolveMaxTokens.ts
index 4d437066e3c..7e82682e17a 100644
--- a/packages/model-runtime/src/core/anthropicCompatibleFactory/resolveMaxTokens.ts
+++ b/packages/model-runtime/src/core/anthropicCompatibleFactory/resolveMaxTokens.ts
@@ -28,6 +28,7 @@ export const resolveMaxTokens = async ({
if (preferredMaxTokens) return preferredMaxTokens;
if (thinking?.type === 'enabled') return 32_000;
+ if (thinking?.type === 'adaptive') return 64_000;
const hasSmallContextWindow = smallContextWindowPatterns.some((pattern) => pattern.test(model));
diff --git a/packages/model-runtime/src/providers/anthropic/index.test.ts b/packages/model-runtime/src/providers/anthropic/index.test.ts
index cc813f71e97..df98bec6428 100644
--- a/packages/model-runtime/src/providers/anthropic/index.test.ts
+++ b/packages/model-runtime/src/providers/anthropic/index.test.ts
@@ -13,7 +13,7 @@ const bizErrorType = 'ProviderBizError';
const invalidErrorType = 'InvalidProviderAPIKey';
// Mock the console.error to avoid polluting test output
-vi.spyOn(console, 'error').mockImplementation(() => {});
+vi.spyOn(console, 'error').mockImplementation(() => { });
let instance: InstanceType<typeof LobeAnthropicAI>;
@@ -702,6 +702,35 @@ describe('LobeAnthropicAI', () => {
});
});
+ it('should correctly build payload with adaptive thinking and effort', async () => {
+ const payload: ChatStreamPayload = {
+ max_tokens: 16000,
+ messages: [{ content: 'Solve this problem', role: 'user' }],
+ model: 'claude-opus-4-6',
+ effort: 'high',
+ thinking: { type: 'adaptive', budget_tokens: 0 },
+ };
+
+ const result = await buildDefaultAnthropicPayload(payload);
+
+ expect(result).toEqual({
+ max_tokens: 16000,
+ messages: [
+ {
+ content: [
+ { cache_control: { type: 'ephemeral' }, text: 'Solve this problem', type: 'text' },
+ ],
+ role: 'user',
+ },
+ ],
+ model: 'claude-opus-4-6',
+ output_config: { effort: 'high' },
+ system: undefined,
+ thinking: { type: 'adaptive' },
+ tools: undefined,
+ });
+ });
+
it('should respect max_tokens in thinking mode when provided', async () => {
const payload: ChatStreamPayload = {
max_tokens: 1000,
diff --git a/packages/model-runtime/src/providers/wenxin/index.ts b/packages/model-runtime/src/providers/wenxin/index.ts
index 2cf270aab44..4498a3baccb 100644
--- a/packages/model-runtime/src/providers/wenxin/index.ts
+++ b/packages/model-runtime/src/providers/wenxin/index.ts
@@ -27,7 +27,7 @@ export const params = {
},
}),
...(thinking && {
- enable_thinking: { disabled: false, enabled: true }[thinking.type],
+ enable_thinking: thinking.type !== 'disabled',
...(thinking?.budget_tokens !== 0 && {
thinking_budget: Math.min(Math.max(thinking?.budget_tokens, 100), 16_384),
}),
diff --git a/packages/model-runtime/src/types/chat.ts b/packages/model-runtime/src/types/chat.ts
index 85e58199cda..13b2a069e24 100644
--- a/packages/model-runtime/src/types/chat.ts
+++ b/packages/model-runtime/src/types/chat.ts
@@ -7,13 +7,13 @@ export type LLMRoleType = 'user' | 'system' | 'assistant' | 'function' | 'tool';
export type ChatResponseFormat =
| { type: 'json_object' }
| {
- json_schema: {
- name: string;
- schema: Record<string, any>;
- strict?: boolean;
- };
- type: 'json_schema';
+ json_schema: {
+ name: string;
+ schema: Record<string, any>;
+ strict?: boolean;
};
+ type: 'json_schema';
+ };
interface UserMessageContentPartThinking {
signature: string;
@@ -61,6 +61,7 @@ export interface OpenAIChatMessage {
*/
export interface ChatStreamPayload {
apiMode?: 'chatCompletion' | 'responses';
+ effort?: 'low' | 'medium' | 'high' | 'max';
/**
* Enable context caching
*/
@@ -143,7 +144,7 @@ export interface ChatStreamPayload {
*/
thinking?: {
budget_tokens: number;
- type: 'enabled' | 'disabled';
+ type: 'enabled' | 'disabled' | 'adaptive';
};
thinkingBudget?: number;
/**
diff --git a/packages/types/src/agent/chatConfig.ts b/packages/types/src/agent/chatConfig.ts
index bc4e4bf1a09..8a6ac4a8dc8 100644
--- a/packages/types/src/agent/chatConfig.ts
+++ b/packages/types/src/agent/chatConfig.ts
@@ -28,10 +28,15 @@ export interface LobeAgentChatConfig {
* Whether to enable reasoning
*/
enableReasoning?: boolean;
+ /**
+ * Whether to enable adaptive thinking (Claude Opus 4.6)
+ */
+ enableAdaptiveThinking?: boolean;
/**
* Custom reasoning effort level
*/
enableReasoningEffort?: boolean;
+ effort?: 'low' | 'medium' | 'high' | 'max';
reasoningBudgetToken?: number;
reasoningEffort?: 'low' | 'medium' | 'high';
gpt5ReasoningEffort?: 'minimal' | 'low' | 'medium' | 'high';
@@ -108,6 +113,8 @@ export const AgentChatConfigSchema = z.object({
autoCreateTopicThreshold: z.number().default(2),
compressionModelId: z.string().optional(),
disableContextCaching: z.boolean().optional(),
+ effort: z.enum(['low', 'medium', 'high', 'max']).optional(),
+ enableAdaptiveThinking: z.boolean().optional(),
enableAutoCreateTopic: z.boolean().optional(),
enableCompressHistory: z.boolean().optional(),
enableContextCompression: z.boolean().optional(),
diff --git a/src/app/[variants]/(main)/settings/provider/features/ModelList/CreateNewModelModal/ExtendParamsSelect.tsx b/src/app/[variants]/(main)/settings/provider/features/ModelList/CreateNewModelModal/ExtendParamsSelect.tsx
index 69cfd20e1da..1365d80fcf6 100644
--- a/src/app/[variants]/(main)/settings/provider/features/ModelList/CreateNewModelModal/ExtendParamsSelect.tsx
+++ b/src/app/[variants]/(main)/settings/provider/features/ModelList/CreateNewModelModal/ExtendParamsSelect.tsx
@@ -5,6 +5,7 @@ import { memo, useMemo } from 'react';
import type { ReactNode } from 'react';
import { Trans, useTranslation } from 'react-i18next';
+import EffortSlider from '@/features/ChatInput/ActionBar/Model/EffortSlider';
import GPT5ReasoningEffortSlider from '@/features/ChatInput/ActionBar/Model/GPT5ReasoningEffortSlider';
import GPT51ReasoningEffortSlider from '@/features/ChatInput/ActionBar/Model/GPT51ReasoningEffortSlider';
import GPT52ProReasoningEffortSlider from '@/features/ChatInput/ActionBar/Model/GPT52ProReasoningEffortSlider';
@@ -33,10 +34,18 @@ const EXTEND_PARAMS_OPTIONS: ExtendParamsOption[] = [
hintKey: 'providerModels.item.modelConfig.extendParams.options.enableReasoning.hint',
key: 'enableReasoning',
},
+ {
+ hintKey: 'providerModels.item.modelConfig.extendParams.options.enableAdaptiveThinking.hint',
+ key: 'enableAdaptiveThinking',
+ },
{
hintKey: 'providerModels.item.modelConfig.extendParams.options.reasoningBudgetToken.hint',
key: 'reasoningBudgetToken',
},
+ {
+ hintKey: 'providerModels.item.modelConfig.extendParams.options.effort.hint',
+ key: 'effort',
+ },
{
hintKey: 'providerModels.item.modelConfig.extendParams.options.reasoningEffort.hint',
key: 'reasoningEffort',
@@ -110,6 +119,12 @@ type PreviewMeta = {
const PREVIEW_META: Partial<Record<ExtendParamsType, PreviewMeta>> = {
disableContextCaching: { labelSuffix: ' (Claude)', previewWidth: 400 },
+ effort: { labelSuffix: ' (Opus 4.6)', previewWidth: 280, tag: 'output_config.effort' },
+ enableAdaptiveThinking: {
+ labelSuffix: ' (Opus 4.6)',
+ previewWidth: 300,
+ tag: 'thinking.type',
+ },
enableReasoning: { previewWidth: 300, tag: 'thinking.type' },
gpt5ReasoningEffort: { previewWidth: 300, tag: 'reasoning_effort' },
gpt5_1ReasoningEffort: { labelSuffix: ' (GPT-5.1)', previewWidth: 300, tag: 'reasoning_effort' },
@@ -212,6 +227,8 @@ const ExtendParamsSelect = memo<ExtendParamsSelectProps>(({ value, onChange }) =
const previewControls = useMemo<Partial<Record<ExtendParamsType, ReactNode>>>(
() => ({
disableContextCaching: <Switch checked disabled />,
+ effort: <EffortSlider value="high" />,
+ enableAdaptiveThinking: <Switch checked disabled />,
enableReasoning: <Switch checked disabled />,
gpt5ReasoningEffort: <GPT5ReasoningEffortSlider value="medium" />,
gpt5_1ReasoningEffort: <GPT51ReasoningEffortSlider value="none" />,
diff --git a/src/features/ChatInput/ActionBar/Model/ControlsForm.tsx b/src/features/ChatInput/ActionBar/Model/ControlsForm.tsx
index 2d4fd7e655e..93b1c9382bd 100644
--- a/src/features/ChatInput/ActionBar/Model/ControlsForm.tsx
+++ b/src/features/ChatInput/ActionBar/Model/ControlsForm.tsx
@@ -12,6 +12,7 @@ import { aiModelSelectors, useAiInfraStore } from '@/store/aiInfra';
import { useAgentId } from '../../hooks/useAgentId';
import { useUpdateAgentConfig } from '../../hooks/useUpdateAgentConfig';
import ContextCachingSwitch from './ContextCachingSwitch';
+import EffortSlider from './EffortSlider';
import GPT5ReasoningEffortSlider from './GPT5ReasoningEffortSlider';
import GPT51ReasoningEffortSlider from './GPT51ReasoningEffortSlider';
import GPT52ProReasoningEffortSlider from './GPT52ProReasoningEffortSlider';
@@ -101,6 +102,18 @@ const ControlsForm = memo(() => {
minWidth: undefined,
name: 'enableReasoning',
},
+ {
+ children: <Switch />,
+ desc: isNarrow ? (
+ <span style={descNarrow}>{t('extendParams.enableAdaptiveThinking.desc')}</span>
+ ) : (
+ t('extendParams.enableAdaptiveThinking.desc')
+ ),
+ label: t('extendParams.enableAdaptiveThinking.title'),
+ layout: isNarrow ? 'vertical' : 'horizontal',
+ minWidth: undefined,
+ name: 'enableAdaptiveThinking',
+ },
(enableReasoning || modelExtendParams?.includes('reasoningBudgetToken')) && {
children: <ReasoningTokenSlider />,
label: t('extendParams.reasoningBudgetToken.title'),
@@ -122,6 +135,21 @@ const ControlsForm = memo(() => {
paddingBottom: 0,
},
},
+ {
+ children: <EffortSlider />,
+ desc: isNarrow ? (
+ <span style={descNarrow}>{t('extendParams.effort.desc')}</span>
+ ) : (
+ t('extendParams.effort.desc')
+ ),
+ label: t('extendParams.effort.title'),
+ layout: 'horizontal',
+ minWidth: undefined,
+ name: 'effort',
+ style: {
+ paddingBottom: 0,
+ },
+ },
{
children: <GPT5ReasoningEffortSlider />,
desc: 'reasoning_effort',
diff --git a/src/features/ChatInput/ActionBar/Model/EffortSlider.tsx b/src/features/ChatInput/ActionBar/Model/EffortSlider.tsx
new file mode 100644
index 00000000000..b92a35fe12d
--- /dev/null
+++ b/src/features/ChatInput/ActionBar/Model/EffortSlider.tsx
@@ -0,0 +1,16 @@
+import { type CreatedLevelSliderProps, createLevelSliderComponent } from './createLevelSlider';
+
+const EFFORT_LEVELS = ['low', 'medium', 'high', 'max'] as const;
+
+type EffortLevel = (typeof EFFORT_LEVELS)[number];
+
+export type EffortSliderProps = CreatedLevelSliderProps<EffortLevel>;
+
+const EffortSlider = createLevelSliderComponent<EffortLevel>({
+ configKey: 'effort',
+ defaultValue: 'high',
+ levels: EFFORT_LEVELS,
+ style: { minWidth: 200 },
+});
+
+export default EffortSlider;
diff --git a/src/locales/default/chat.ts b/src/locales/default/chat.ts
index 40fccf486d0..ef1d3538dad 100644
--- a/src/locales/default/chat.ts
+++ b/src/locales/default/chat.ts
@@ -75,6 +75,12 @@ export default {
'extendParams.disableContextCaching.desc':
'Reduce by up to 90% of the cost of generating a single conversation and bring a max of 4x speed. Enabling this will automatically disable the limit on the number of historical messages. <1>Learn more</1>',
'extendParams.disableContextCaching.title': 'Enable Context Caching',
+ 'extendParams.effort.desc':
+ 'Control how many tokens Claude uses when responding with the effort parameter.',
+ 'extendParams.effort.title': 'Effort',
+ 'extendParams.enableAdaptiveThinking.desc':
+ 'Let Claude dynamically decide when and how much to think with adaptive thinking mode.',
+ 'extendParams.enableAdaptiveThinking.title': 'Enable Adaptive Thinking',
'extendParams.enableReasoning.desc':
'Based on the Claude Thinking mechanism limit, enabling this will automatically disable the limit on the number of historical messages. <1>Learn more</1>',
'extendParams.enableReasoning.title': 'Enable Deep Thinking',
diff --git a/src/locales/default/modelProvider.ts b/src/locales/default/modelProvider.ts
index 97fd14f4802..0fc9a84f575 100644
--- a/src/locales/default/modelProvider.ts
+++ b/src/locales/default/modelProvider.ts
@@ -224,6 +224,10 @@ export default {
'Choose extended parameters supported by the model. Hover an option to preview controls. Incorrect configs may cause request failures.',
'providerModels.item.modelConfig.extendParams.options.disableContextCaching.hint':
'For Claude models; can lower cost and speed up responses.',
+ 'providerModels.item.modelConfig.extendParams.options.effort.hint':
+ 'For Claude Opus 4.6; controls effort level (low/medium/high/max).',
+ 'providerModels.item.modelConfig.extendParams.options.enableAdaptiveThinking.hint':
+ 'For Claude Opus 4.6; toggles adaptive thinking on or off.',
'providerModels.item.modelConfig.extendParams.options.enableReasoning.hint':
'For Claude, DeepSeek and other reasoning models; unlock deeper thinking.',
'providerModels.item.modelConfig.extendParams.options.gpt5ReasoningEffort.hint':
diff --git a/src/services/chat/mecha/modelParamsResolver.test.ts b/src/services/chat/mecha/modelParamsResolver.test.ts
index 09d7797fc7a..869a93aab4d 100644
--- a/src/services/chat/mecha/modelParamsResolver.test.ts
+++ b/src/services/chat/mecha/modelParamsResolver.test.ts
@@ -941,6 +941,56 @@ describe('resolveModelExtendParams', () => {
});
});
+ describe('adaptive thinking configuration', () => {
+ it('should set adaptive thinking when enabled', () => {
+ vi.spyOn(aiModelSelectors.aiModelSelectors, 'modelExtendParams').mockReturnValue(() => [
+ 'enableAdaptiveThinking',
+ ]);
+
+ const result = resolveModelExtendParams({
+ chatConfig: {
+ enableAdaptiveThinking: true,
+ } as any,
+ model: 'claude-opus-4-6',
+ provider: 'anthropic',
+ });
+
+ expect(result.thinking).toEqual({ type: 'adaptive' });
+ });
+
+ it('should disable adaptive thinking when off', () => {
+ vi.spyOn(aiModelSelectors.aiModelSelectors, 'modelExtendParams').mockReturnValue(() => [
+ 'enableAdaptiveThinking',
+ ]);
+
+ const result = resolveModelExtendParams({
+ chatConfig: {
+ enableAdaptiveThinking: false,
+ } as any,
+ model: 'claude-opus-4-6',
+ provider: 'anthropic',
+ });
+
+ expect(result.thinking).toEqual({ type: 'disabled' });
+ });
+
+ it('should set adaptive thinking effort when configured', () => {
+ vi.spyOn(aiModelSelectors.aiModelSelectors, 'modelExtendParams').mockReturnValue(() => [
+ 'effort',
+ ]);
+
+ const result = resolveModelExtendParams({
+ chatConfig: {
+ effort: 'max',
+ } as any,
+ model: 'claude-opus-4-6',
+ provider: 'anthropic',
+ });
+
+ expect(result.effort).toBe('max');
+ });
+ });
+
describe('complex multi-parameter scenarios', () => {
it('should handle all reasoning variants with context caching and verbosity', () => {
vi.spyOn(aiModelSelectors.aiModelSelectors, 'modelExtendParams').mockReturnValue(() => [
diff --git a/src/services/chat/mecha/modelParamsResolver.ts b/src/services/chat/mecha/modelParamsResolver.ts
index 1e5b4c8636b..acf1091e4e6 100644
--- a/src/services/chat/mecha/modelParamsResolver.ts
+++ b/src/services/chat/mecha/modelParamsResolver.ts
@@ -15,6 +15,7 @@ export interface ModelParamsContext {
* Extended parameters for model runtime
*/
export interface ModelExtendParams {
+ effort?: string;
enabledContextCaching?: boolean;
imageAspectRatio?: string;
imageResolution?: string;
@@ -77,6 +78,13 @@ export const resolveModelExtendParams = (ctx: ModelParamsContext): ModelExtendPa
};
}
+ // Adaptive thinking (Claude Opus 4.6)
+ if (modelExtendParams.includes('enableAdaptiveThinking')) {
+ extendParams.thinking = {
+ type: chatConfig.enableAdaptiveThinking ? 'adaptive' : 'disabled',
+ };
+ }
+
// Context caching
if (modelExtendParams.includes('disableContextCaching') && chatConfig.disableContextCaching) {
extendParams.enabledContextCaching = false;
@@ -106,6 +114,10 @@ export const resolveModelExtendParams = (ctx: ModelParamsContext): ModelExtendPa
extendParams.reasoning_effort = chatConfig.gpt5_2ProReasoningEffort;
}
+ if (modelExtendParams.includes('effort') && chatConfig.effort) {
+ extendParams.effort = chatConfig.effort;
+ }
+
// Text verbosity
if (modelExtendParams.includes('textVerbosity') && chatConfig.textVerbosity) {
extendParams.verbosity = chatConfig.textVerbosity;