🤯 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.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
✨ feat(hetero-agent): add Codex Fast speed mode to model selector (#16663)
AmAzing-2ddf1ae5d8a4
diff --git a/apps/cli/src/commands/hetero.test.ts b/apps/cli/src/commands/hetero.test.tsindex bdfd452bb12..d2e6c47eced 100644--- a/apps/cli/src/commands/hetero.test.ts+++ b/apps/cli/src/commands/hetero.test.ts@@ -239,6 +239,50 @@ describe('hetero exec command', () => {});});+ it('translates Codex --speed to native service_tier config', async () => {+ mockSpawnAgent.mockReturnValue(createFakeHandle());++ await runCmd([+ 'hetero',+ 'exec',+ '--type',+ 'codex',+ '--prompt',+ 'hi',+ '--model',+ 'gpt-5.5',+ '--speed',+ 'fast',+ ]);++ expect(mockSpawnAgent).toHaveBeenCalledTimes(1);+ expect(mockSpawnAgent.mock.calls[0][0]).toMatchObject({+ extraArgs: ['--model', 'gpt-5.5', '-c', 'service_tier="fast"'],+ });+ });++ it('ignores --speed for Claude Code runs', async () => {+ mockSpawnAgent.mockReturnValue(createFakeHandle());++ await runCmd([+ 'hetero',+ 'exec',+ '--type',+ 'claude-code',+ '--prompt',+ 'hi',+ '--model',+ 'opus',+ '--speed',+ 'fast',+ ]);++ expect(mockSpawnAgent).toHaveBeenCalledTimes(1);+ expect(mockSpawnAgent.mock.calls[0][0]).toMatchObject({+ extraArgs: ['--model', 'opus'],+ });+ });+it('passes native agent args through --agent-arg without treating them as wrapper options', async () => {mockSpawnAgent.mockReturnValue(createFakeHandle());diff --git a/apps/cli/src/commands/hetero.ts b/apps/cli/src/commands/hetero.tsindex e339d2a668b..c35eb5c869f 100644--- a/apps/cli/src/commands/hetero.ts+++ b/apps/cli/src/commands/hetero.ts@@ -19,6 +19,7 @@ import { TrpcIngestSink } from '../utils/TrpcIngestSink';const SUPPORTED_AGENT_TYPES = new Set(['claude-code', 'codex']);const CODEX_REASONING_EFFORT_CONFIG_KEY = 'model_reasoning_effort';+const CODEX_SERVICE_TIER_CONFIG_KEY = 'service_tier';/*** Patterns that indicate a `--resume <sessionId>` run should be retried@@ -79,6 +80,11 @@ interface ExecOptions {*/render?: 'jsonl' | 'none';resume?: string;+ /**+ * Speed mode selection (Codex only). Translated into the native+ * `service_tier` config; `fast` requests the Fast (priority) tier.+ */+ speed?: string;/*** Server topic id. When set, enables server-ingest mode: events are* batch-POSTed to `aiAgent.heteroIngest` in addition to (or instead of)@@ -93,7 +99,7 @@ const collectImage = (value: string, previous: string[] = []): string[] => [...pconst collectAgentArg = (value: string, previous: string[] = []): string[] => [...previous, value];const buildExtraArgs = (- options: Pick<ExecOptions, 'agentArg' | 'effort' | 'model' | 'type'>,+ options: Pick<ExecOptions, 'agentArg' | 'effort' | 'model' | 'speed' | 'type'>,): string[] | undefined => {const selectorArgs =options.type === 'codex'@@ -102,6 +108,7 @@ const buildExtraArgs = (...(options.effort? ['-c', `${CODEX_REASONING_EFFORT_CONFIG_KEY}="${options.effort}"`]: []),+ ...(options.speed ? ['-c', `${CODEX_SERVICE_TIER_CONFIG_KEY}="${options.speed}"`] : []),]: [...(options.model ? ['--model', options.model] : []),@@ -805,6 +812,10 @@ export function registerHeteroCommand(program: Command) {.option('-d, --cwd <path>', 'Working directory for the spawned agent (default: process.cwd())').option('--model <model>', 'Forward a resolved model selection to the agent CLI').option('--effort <level>', 'Forward a resolved reasoning effort selection to the agent CLI')+ .option(+ '--speed <mode>',+ 'Forward a resolved speed selection to the agent CLI (codex only; `fast` requests the Fast service tier)',+ ).option('--agent-arg <arg>','Forward one native agent CLI argument after wrapper parsing (repeatable)',diff --git a/locales/en-US/chat.json b/locales/en-US/chat.jsonindex e2a709fb1f0..f36496334b0 100644--- a/locales/en-US/chat.json+++ b/locales/en-US/chat.json@@ -271,29 +271,6 @@"heteroAgent.cloudRepo.noRepos": "No repositories configured. Add them in agent settings.","heteroAgent.cloudRepo.notSet": "No repo selected","heteroAgent.cloudRepo.sectionTitle": "Repositories",- "heteroAgent.executionTarget.auto": "Auto",- "heteroAgent.executionTarget.autoDesc": "Use an online device automatically, picking one when several are available",- "heteroAgent.executionTarget.downloadDesktop": "Get Desktop App",- "heteroAgent.executionTarget.downloadDesktopDesc": "Run agents with access to your computer",- "heteroAgent.executionTarget.downloadDesktopTitle": "Get the desktop app",- "heteroAgent.executionTarget.gateway": "Gateway",- "heteroAgent.executionTarget.gatewayDesc": "Run through the device gateway so other clients can follow progress",- "heteroAgent.executionTarget.infoTooltip": "Pick a device and the agent uses it as its runtime environment — reading and writing files and operating the computer. Cloud sandbox is provided by LobeHub Marketplace.",- "heteroAgent.executionTarget.loading": "Loading devices…",- "heteroAgent.executionTarget.local": "This device",- "heteroAgent.executionTarget.localDesc": "Run as a local process on this desktop app",- "heteroAgent.executionTarget.manage": "Manage",- "heteroAgent.executionTarget.noDevices": "No remote devices yet. Run `lh connect` on another machine to add one.",- "heteroAgent.executionTarget.none": "No device",- "heteroAgent.executionTarget.noneDesc": "No device enabled",- "heteroAgent.executionTarget.offline": "Offline",- "heteroAgent.executionTarget.online": "Online",- "heteroAgent.executionTarget.personalGroup": "Personal",- "heteroAgent.executionTarget.sandbox": "Cloud Sandbox",- "heteroAgent.executionTarget.sandboxDesc": "Run in an ephemeral cloud sandbox",- "heteroAgent.executionTarget.title": "Execution Device",- "heteroAgent.executionTarget.unknownDevice": "Unknown device",- "heteroAgent.executionTarget.workspaceGroup": "Workspace","heteroAgent.codexQuota.compactLeft": "{{percent}}%","heteroAgent.codexQuota.duration.day_one": "{{count}}d","heteroAgent.codexQuota.duration.day_other": "{{count}}d",@@ -306,10 +283,10 @@"heteroAgent.codexQuota.nextExpiresIn": "Next expires in {{duration}}","heteroAgent.codexQuota.noData": "Codex quota is not available yet.","heteroAgent.codexQuota.refresh": "Refresh Codex quota",+ "heteroAgent.codexQuota.resetCreditsUnavailable": "Reset credits unavailable","heteroAgent.codexQuota.resetCredits_one": "1 rate-limit reset available","heteroAgent.codexQuota.resetCredits_other": "{{count}} rate-limit resets available","heteroAgent.codexQuota.resetCredits_zero": "No rate-limit resets available",- "heteroAgent.codexQuota.resetCreditsUnavailable": "Reset credits unavailable","heteroAgent.codexQuota.resetsIn": "Resets in {{duration}}","heteroAgent.codexQuota.resetsSoon": "Resets soon","heteroAgent.codexQuota.session": "Session",@@ -319,6 +296,29 @@"heteroAgent.codexQuota.updatedAgo": "Updated {{duration}} ago","heteroAgent.codexQuota.updatedJustNow": "Updated just now","heteroAgent.codexQuota.weekly": "Weekly",+ "heteroAgent.executionTarget.auto": "Auto",+ "heteroAgent.executionTarget.autoDesc": "Use an online device automatically, picking one when several are available",+ "heteroAgent.executionTarget.downloadDesktop": "Get Desktop App",+ "heteroAgent.executionTarget.downloadDesktopDesc": "Run agents with access to your computer",+ "heteroAgent.executionTarget.downloadDesktopTitle": "Get the desktop app",+ "heteroAgent.executionTarget.gateway": "Gateway",+ "heteroAgent.executionTarget.gatewayDesc": "Run through the device gateway so other clients can follow progress",+ "heteroAgent.executionTarget.infoTooltip": "Pick a device and the agent uses it as its runtime environment — reading and writing files and operating the computer. Cloud sandbox is provided by LobeHub Marketplace.",+ "heteroAgent.executionTarget.loading": "Loading devices…",+ "heteroAgent.executionTarget.local": "This device",+ "heteroAgent.executionTarget.localDesc": "Run as a local process on this desktop app",+ "heteroAgent.executionTarget.manage": "Manage",+ "heteroAgent.executionTarget.noDevices": "No remote devices yet. Run `lh connect` on another machine to add one.",+ "heteroAgent.executionTarget.none": "No device",+ "heteroAgent.executionTarget.noneDesc": "No device enabled",+ "heteroAgent.executionTarget.offline": "Offline",+ "heteroAgent.executionTarget.online": "Online",+ "heteroAgent.executionTarget.personalGroup": "Personal",+ "heteroAgent.executionTarget.sandbox": "Cloud Sandbox",+ "heteroAgent.executionTarget.sandboxDesc": "Run in an ephemeral cloud sandbox",+ "heteroAgent.executionTarget.title": "Execution Device",+ "heteroAgent.executionTarget.unknownDevice": "Unknown device",+ "heteroAgent.executionTarget.workspaceGroup": "Workspace","heteroAgent.fullAccess.label": "Full access","heteroAgent.fullAccess.tooltip": "The local coding agent runs with full read/write access to the working directory. Switching permission modes is not available yet.","heteroAgent.modelSelector.ariaLabel": "Model: {{model}}. Reasoning: {{reasoning}}",@@ -329,10 +329,16 @@"heteroAgent.modelSelector.model": "Model","heteroAgent.modelSelector.reasoning": "Reasoning","heteroAgent.modelSelector.reasoning.high": "High",+ "heteroAgent.modelSelector.reasoning.light": "Light","heteroAgent.modelSelector.reasoning.low": "Low","heteroAgent.modelSelector.reasoning.max": "Max","heteroAgent.modelSelector.reasoning.medium": "Medium","heteroAgent.modelSelector.reasoning.xhigh": "Extra High",+ "heteroAgent.modelSelector.speed": "Speed",+ "heteroAgent.modelSelector.speed.fast": "Fast",+ "heteroAgent.modelSelector.speed.fastDesc": "1.5x speed, increased usage",+ "heteroAgent.modelSelector.speed.standard": "Standard",+ "heteroAgent.modelSelector.speed.standardDesc": "Default speed","heteroAgent.resumeReset.cwdChanged": "Working directory changed. Previous Claude Code session can only be resumed from its original directory, so a new conversation has started.","heteroAgent.resumeReset.resumeFailed": "The saved Codex thread could not be resumed safely, so a new conversation has started for this topic.","heteroAgent.switchCwd.cancel": "Cancel",diff --git a/locales/zh-CN/chat.json b/locales/zh-CN/chat.jsonindex 57da0642275..5b0f9b0c164 100644--- a/locales/zh-CN/chat.json+++ b/locales/zh-CN/chat.json@@ -271,29 +271,6 @@"heteroAgent.cloudRepo.noRepos": "未配置仓库,请在助理设置中添加。","heteroAgent.cloudRepo.notSet": "未选择仓库","heteroAgent.cloudRepo.sectionTitle": "代码仓库",- "heteroAgent.executionTarget.auto": "自动",- "heteroAgent.executionTarget.autoDesc": "自动使用在线设备,有多台时择一使用",- "heteroAgent.executionTarget.downloadDesktop": "下载桌面端",- "heteroAgent.executionTarget.downloadDesktopDesc": "让 Agent 直接连接你的电脑",- "heteroAgent.executionTarget.downloadDesktopTitle": "下载桌面端",- "heteroAgent.executionTarget.gateway": "网关",- "heteroAgent.executionTarget.gatewayDesc": "经由设备网关运行,其他客户端可跟踪进度",- "heteroAgent.executionTarget.infoTooltip": "选择某台设备后,Agent 将以该设备为运行环境,读写文件、操作电脑。云端沙箱由 LobeHub Marketplace 提供服务",- "heteroAgent.executionTarget.loading": "正在加载设备…",- "heteroAgent.executionTarget.local": "本机",- "heteroAgent.executionTarget.localDesc": "在当前桌面端以本地进程运行",- "heteroAgent.executionTarget.manage": "管理",- "heteroAgent.executionTarget.noDevices": "暂无远程设备。在另一台机器上执行 `lh connect` 即可接入。",- "heteroAgent.executionTarget.none": "无设备",- "heteroAgent.executionTarget.noneDesc": "不启用任何设备",- "heteroAgent.executionTarget.offline": "离线",- "heteroAgent.executionTarget.online": "在线",- "heteroAgent.executionTarget.personalGroup": "个人设备",- "heteroAgent.executionTarget.sandbox": "云端沙箱",- "heteroAgent.executionTarget.sandboxDesc": "在临时云端沙箱中运行",- "heteroAgent.executionTarget.title": "执行设备",- "heteroAgent.executionTarget.unknownDevice": "未知设备",- "heteroAgent.executionTarget.workspaceGroup": "工作区设备","heteroAgent.codexQuota.compactLeft": "{{percent}}%","heteroAgent.codexQuota.duration.day_one": "{{count}}天","heteroAgent.codexQuota.duration.day_other": "{{count}}天",@@ -306,10 +283,10 @@"heteroAgent.codexQuota.nextExpiresIn": "下一次将在 {{duration}}后过期","heteroAgent.codexQuota.noData": "暂未获取到 Codex 额度。","heteroAgent.codexQuota.refresh": "刷新 Codex 额度",+ "heteroAgent.codexQuota.resetCreditsUnavailable": "额度重置次数不可用","heteroAgent.codexQuota.resetCredits_one": "1 次可用额度重置","heteroAgent.codexQuota.resetCredits_other": "{{count}} 次可用额度重置","heteroAgent.codexQuota.resetCredits_zero": "暂无可用额度重置",- "heteroAgent.codexQuota.resetCreditsUnavailable": "额度重置次数不可用","heteroAgent.codexQuota.resetsIn": "{{duration}}后重置","heteroAgent.codexQuota.resetsSoon": "即将重置","heteroAgent.codexQuota.session": "会话",@@ -319,6 +296,29 @@"heteroAgent.codexQuota.updatedAgo": "{{duration}}前更新","heteroAgent.codexQuota.updatedJustNow": "刚刚更新","heteroAgent.codexQuota.weekly": "每周",+ "heteroAgent.executionTarget.auto": "自动",+ "heteroAgent.executionTarget.autoDesc": "自动使用在线设备,有多台时择一使用",+ "heteroAgent.executionTarget.downloadDesktop": "下载桌面端",+ "heteroAgent.executionTarget.downloadDesktopDesc": "让 Agent 直接连接你的电脑",+ "heteroAgent.executionTarget.downloadDesktopTitle": "下载桌面端",+ "heteroAgent.executionTarget.gateway": "网关",+ "heteroAgent.executionTarget.gatewayDesc": "经由设备网关运行,其他客户端可跟踪进度",+ "heteroAgent.executionTarget.infoTooltip": "选择某台设备后,Agent 将以该设备为运行环境,读写文件、操作电脑。云端沙箱由 LobeHub Marketplace 提供服务",+ "heteroAgent.executionTarget.loading": "正在加载设备…",+ "heteroAgent.executionTarget.local": "本机",+ "heteroAgent.executionTarget.localDesc": "在当前桌面端以本地进程运行",+ "heteroAgent.executionTarget.manage": "管理",+ "heteroAgent.executionTarget.noDevices": "暂无远程设备。在另一台机器上执行 `lh connect` 即可接入。",+ "heteroAgent.executionTarget.none": "无设备",+ "heteroAgent.executionTarget.noneDesc": "不启用任何设备",+ "heteroAgent.executionTarget.offline": "离线",+ "heteroAgent.executionTarget.online": "在线",+ "heteroAgent.executionTarget.personalGroup": "个人设备",+ "heteroAgent.executionTarget.sandbox": "云端沙箱",+ "heteroAgent.executionTarget.sandboxDesc": "在临时云端沙箱中运行",+ "heteroAgent.executionTarget.title": "执行设备",+ "heteroAgent.executionTarget.unknownDevice": "未知设备",+ "heteroAgent.executionTarget.workspaceGroup": "工作区设备","heteroAgent.fullAccess.label": "完全访问权限","heteroAgent.fullAccess.tooltip": "本地编码 Agent 运行时对工作目录拥有完全的读写权限。当前暂不支持切换权限模式。","heteroAgent.modelSelector.ariaLabel": "模型:{{model}}。思考强度:{{reasoning}}",@@ -329,10 +329,16 @@"heteroAgent.modelSelector.model": "模型","heteroAgent.modelSelector.reasoning": "思考强度","heteroAgent.modelSelector.reasoning.high": "高",+ "heteroAgent.modelSelector.reasoning.light": "低","heteroAgent.modelSelector.reasoning.low": "低","heteroAgent.modelSelector.reasoning.max": "最高","heteroAgent.modelSelector.reasoning.medium": "中","heteroAgent.modelSelector.reasoning.xhigh": "超高",+ "heteroAgent.modelSelector.speed": "速度",+ "heteroAgent.modelSelector.speed.fast": "快速",+ "heteroAgent.modelSelector.speed.fastDesc": "1.5 倍速度,消耗更多用量",+ "heteroAgent.modelSelector.speed.standard": "标准",+ "heteroAgent.modelSelector.speed.standardDesc": "默认速度","heteroAgent.resumeReset.cwdChanged": "工作目录已切换,之前的 Claude Code 会话只能在原目录下继续,已开始新对话。","heteroAgent.resumeReset.resumeFailed": "已保存的 Codex 线程无法安全恢复,当前话题已自动开启新会话。","heteroAgent.switchCwd.cancel": "取消",diff --git a/packages/locales/src/default/chat.ts b/packages/locales/src/default/chat.tsindex 2e930fed517..5dc846978ab 100644--- a/packages/locales/src/default/chat.ts+++ b/packages/locales/src/default/chat.ts@@ -212,10 +212,16 @@ export default {'heteroAgent.modelSelector.model': 'Model','heteroAgent.modelSelector.reasoning': 'Reasoning','heteroAgent.modelSelector.reasoning.high': 'High',+ 'heteroAgent.modelSelector.reasoning.light': 'Light','heteroAgent.modelSelector.reasoning.low': 'Low','heteroAgent.modelSelector.reasoning.max': 'Max','heteroAgent.modelSelector.reasoning.medium': 'Medium','heteroAgent.modelSelector.reasoning.xhigh': 'Extra High',+ 'heteroAgent.modelSelector.speed': 'Speed',+ 'heteroAgent.modelSelector.speed.fast': 'Fast',+ 'heteroAgent.modelSelector.speed.fastDesc': '1.5x speed, increased usage',+ 'heteroAgent.modelSelector.speed.standard': 'Standard',+ 'heteroAgent.modelSelector.speed.standardDesc': 'Default speed','heteroAgent.resumeReset.cwdChanged':'Working directory changed. Previous Claude Code session can only be resumed from its original directory, so a new conversation has started.','heteroAgent.resumeReset.resumeFailed':diff --git a/packages/types/src/agent/agencyConfig.test.ts b/packages/types/src/agent/agencyConfig.test.tsindex ea8a72ff3ee..4e9a9ef6032 100644--- a/packages/types/src/agent/agencyConfig.test.ts+++ b/packages/types/src/agent/agencyConfig.test.ts@@ -3,12 +3,14 @@ import { describe, expect, it } from 'vitest';import {buildHeteroExecArgs,buildHeteroSpawnArgs,+ codexModelSupportsFastSpeed,HETEROGENEOUS_AGENT_DEFAULT_SELECTION,pruneWorkingDirByDeviceDeletes,resolveClaudeCodeModel,resolveClaudeCodeReasoningEffort,resolveCodexModel,resolveCodexReasoningEffort,+ resolveCodexSpeedMode,} from './agencyConfig';describe('pruneWorkingDirByDeviceDeletes', () => {@@ -244,3 +246,81 @@ describe('buildHeteroSpawnArgs', () => {).toEqual(['--agent-arg=--verbose', '--effort', 'high']);});});++describe('codex speed mode', () => {+ it('resolves missing / default selections to Default', () => {+ expect(resolveCodexSpeedMode(undefined)).toBe(HETEROGENEOUS_AGENT_DEFAULT_SELECTION);+ expect(resolveCodexSpeedMode({ speed: HETEROGENEOUS_AGENT_DEFAULT_SELECTION })).toBe(+ HETEROGENEOUS_AGENT_DEFAULT_SELECTION,+ );+ });++ it('resolves persisted fast selections', () => {+ expect(resolveCodexSpeedMode({ speed: 'fast' })).toBe('fast');+ });++ it('resolves service_tier from args before persisted selections', () => {+ expect(resolveCodexSpeedMode({ args: ['-c', 'service_tier="fast"'] })).toBe('fast');+ // The native request value spelling counts as fast too.+ expect(resolveCodexSpeedMode({ args: ['--config=service_tier="priority"'] })).toBe('fast');+ // Unknown tiers (e.g. flex) are displayed as Standard.+ expect(resolveCodexSpeedMode({ args: ['-c', 'service_tier="flex"'], speed: 'fast' })).toBe(+ HETEROGENEOUS_AGENT_DEFAULT_SELECTION,+ );+ });++ it('reports fast support for catalog models and the default selection', () => {+ expect(codexModelSupportsFastSpeed(HETEROGENEOUS_AGENT_DEFAULT_SELECTION)).toBe(true);+ expect(codexModelSupportsFastSpeed('gpt-5.5')).toBe(true);+ expect(codexModelSupportsFastSpeed('gpt-5.4')).toBe(true);+ expect(codexModelSupportsFastSpeed('gpt-5.4-mini')).toBe(false);+ expect(codexModelSupportsFastSpeed('gpt-5.3-codex-spark')).toBe(false);+ });++ it('appends service_tier config for Codex spawns when fast is selected', () => {+ expect(buildHeteroSpawnArgs({ speed: 'fast', type: 'codex' })).toEqual([+ '-c',+ 'service_tier="fast"',+ ]);+ expect(buildHeteroSpawnArgs({ effort: 'high', speed: 'fast', type: 'codex' })).toEqual([+ '-c',+ 'model_reasoning_effort="high"',+ '-c',+ 'service_tier="fast"',+ ]);+ });++ it('does not append service_tier for default speed or user-authored overrides', () => {+ expect(+ buildHeteroSpawnArgs({ speed: HETEROGENEOUS_AGENT_DEFAULT_SELECTION, type: 'codex' }),+ ).toBeUndefined();+ expect(+ buildHeteroSpawnArgs({+ args: ['-c', 'service_tier="priority"'],+ speed: 'fast',+ type: 'codex',+ }),+ ).toEqual(['-c', 'service_tier="priority"']);+ });++ it('ignores speed for claude-code spawns', () => {+ expect(buildHeteroSpawnArgs({ speed: 'fast', type: 'claude-code' })).toBeUndefined();+ });++ it('keeps lh hetero exec speed overrides in wrapper form', () => {+ expect(buildHeteroExecArgs({ model: 'gpt-5.5', speed: 'fast', type: 'codex' })).toEqual([+ '--model',+ 'gpt-5.5',+ '--speed',+ 'fast',+ ]);+ expect(+ buildHeteroExecArgs({+ args: ['-c', 'service_tier="priority"'],+ speed: 'fast',+ type: 'codex',+ }),+ ).toEqual(['--agent-arg=-c', '--agent-arg=service_tier="priority"']);+ expect(buildHeteroExecArgs({ speed: 'fast', type: 'claude-code' })).toBeUndefined();+ });+});diff --git a/packages/types/src/agent/agencyConfig.ts b/packages/types/src/agent/agencyConfig.tsindex 0b61f52caf2..cdf6c103e28 100644--- a/packages/types/src/agent/agencyConfig.ts+++ b/packages/types/src/agent/agencyConfig.ts@@ -38,9 +38,35 @@ export const CODEX_DEFAULT_REASONING_EFFORT = 'medium' satisfies CodexReasoningEexport const CODEX_REASONING_EFFORT_CONFIG_KEY = 'model_reasoning_effort';export type HeterogeneousReasoningEffort =- | ClaudeCodeReasoningEffort- | CodexReasoningEffort- | HeterogeneousAgentDefaultSelection;+ ClaudeCodeReasoningEffort | CodexReasoningEffort | HeterogeneousAgentDefaultSelection;++/**+ * Codex speed modes, mirrored to the CLI config key `service_tier`.+ *+ * `fast` maps to the Fast service tier (request value `priority`): ~1.5x+ * faster inference at a higher credit-consumption rate. Requires ChatGPT+ * sign-in; the Codex CLI silently omits the tier for unsupported models, so+ * passing it is always safe.+ */+export const CODEX_SPEED_MODES = ['fast'] as const;++export type CodexSpeedMode = (typeof CODEX_SPEED_MODES)[number];++export type HeterogeneousSpeedMode = CodexSpeedMode | HeterogeneousAgentDefaultSelection;++export const CODEX_SERVICE_TIER_CONFIG_KEY = 'service_tier';++/**+ * Codex models whose catalog exposes the Fast (`priority`) service tier.+ * Sourced from the model catalog embedded in codex-cli (>= 0.142).+ */+export const CODEX_FAST_SPEED_MODELS = ['gpt-5.5', 'gpt-5.4'] as const;++/**+ * `service_tier` values the Codex CLI resolves to the Fast tier+ * (`ServiceTier::from_request_value` accepts both spellings).+ */+const CODEX_FAST_SERVICE_TIER_VALUES = ['fast', 'priority'] as const;/*** Heterogeneous agent provider configuration.@@ -84,6 +110,14 @@ export interface HeterogeneousProviderConfig {* - hermes: reserved for future use*/platformAgentId?: string;+ /**+ * Speed mode (Codex only), surfaced through the chat-input model selector+ * and translated into the `service_tier` CLI config at spawn time. Omitted+ * or `'default'` values are displayed as Standard in the UI and are not+ * passed as CLI overrides, so the CLI keeps its own settings and account+ * defaults.+ */+ speed?: HeterogeneousSpeedMode;/*** Static context prepended to every user prompt before it reaches the agent CLI.* Use this to prime the agent with workspace conventions, rules, or instructions@@ -105,6 +139,7 @@ interface CodexSelectionSource {args?: string[];effort?: string | null;model?: string | null;+ speed?: string | null;}const CODEX_CONFIG_FLAGS = ['-c', '--config'] as const;@@ -268,6 +303,36 @@ const getExplicitCodexReasoningEffort = (return isCodexReasoningEffort(effort) ? effort : undefined;};+const isCodexFastServiceTier = (value: string | undefined): boolean =>+ !!value &&+ CODEX_FAST_SERVICE_TIER_VALUES.includes(value as (typeof CODEX_FAST_SERVICE_TIER_VALUES)[number]);++export const resolveCodexSpeedMode = (+ source: CodexSelectionSource | null | undefined,+): HeterogeneousSpeedMode => {+ const tier = (+ getCliConfigValue(source?.args, CODEX_SERVICE_TIER_CONFIG_KEY) ?? source?.speed+ )?.trim();++ return isCodexFastServiceTier(tier) ? 'fast' : HETEROGENEOUS_AGENT_DEFAULT_SELECTION;+};++const getExplicitCodexSpeedMode = (+ source: CodexSelectionSource | null | undefined,+): CodexSpeedMode | undefined => {+ const speed = source?.speed?.trim();+ return isCodexFastServiceTier(speed) ? 'fast' : undefined;+};++/**+ * Whether the Fast speed toggle applies to a selector model value. `default`+ * counts as supported: the CLI's own default model (currently gpt-5.5)+ * supports Fast, and unsupported models simply ignore the tier.+ */+export const codexModelSupportsFastSpeed = (model: string): boolean =>+ model === HETEROGENEOUS_AGENT_DEFAULT_SELECTION ||+ CODEX_FAST_SPEED_MODELS.includes(model as (typeof CODEX_FAST_SPEED_MODELS)[number]);+/*** Resolve the effective native CLI args for a heterogeneous spawn.*@@ -314,6 +379,11 @@ export const buildHeteroSpawnArgs = (if (effort && !hasCliConfigKey(baseArgs, CODEX_REASONING_EFFORT_CONFIG_KEY)) {extraArgs.push('-c', `${CODEX_REASONING_EFFORT_CONFIG_KEY}="${effort}"`);}++ const speed = getExplicitCodexSpeedMode(provider);+ if (speed && !hasCliConfigKey(baseArgs, CODEX_SERVICE_TIER_CONFIG_KEY)) {+ extraArgs.push('-c', `${CODEX_SERVICE_TIER_CONFIG_KEY}="${speed}"`);+ }}if (extraArgs.length === 0) return provider.args;@@ -365,6 +435,15 @@ export const buildHeteroExecArgs = () {selectorArgs.push('--effort', effort);}++ const speed = getExplicitCodexSpeedMode(provider);+ if (+ speed &&+ !hasCliFlag(baseArgs, '--speed') &&+ !hasCliConfigKey(baseArgs, CODEX_SERVICE_TIER_CONFIG_KEY)+ ) {+ selectorArgs.push('--speed', speed);+ }}const args = [...wrapperArgs, ...selectorArgs];diff --git a/src/features/ChatInput/ControlBar/HeteroModel.tsx b/src/features/ChatInput/ControlBar/HeteroModel.tsxindex 411d21b7b60..06aa2377df7 100644--- a/src/features/ChatInput/ControlBar/HeteroModel.tsx+++ b/src/features/ChatInput/ControlBar/HeteroModel.tsx@@ -5,16 +5,20 @@ import type {CodexReasoningEffort,HeterogeneousAgentDefaultSelection,HeterogeneousProviderConfig,+ HeterogeneousSpeedMode,} from '@lobechat/types';import {CLAUDE_CODE_REASONING_EFFORT_LEVELS,CODEX_REASONING_EFFORT_CONFIG_KEY,CODEX_REASONING_EFFORT_LEVELS,+ CODEX_SERVICE_TIER_CONFIG_KEY,+ codexModelSupportsFastSpeed,HETEROGENEOUS_AGENT_DEFAULT_SELECTION,resolveClaudeCodeModel,resolveClaudeCodeReasoningEffort,resolveCodexModel,resolveCodexReasoningEffort,+ resolveCodexSpeedMode,} from '@lobechat/types';import { Icon } from '@lobehub/ui';import {@@ -31,7 +35,7 @@ import {} from '@lobehub/ui/base-ui';import { createStaticStyles, cssVar, cx } from 'antd-style';import isEqual from 'fast-deep-equal';-import { CheckIcon, ChevronDownIcon, ChevronRightIcon } from 'lucide-react';+import { CheckIcon, ChevronDownIcon, ChevronRightIcon, ZapIcon } from 'lucide-react';import { memo, useCallback, useState } from 'react';import { useTranslation } from 'react-i18next';@@ -42,9 +46,7 @@ import { agentByIdSelectors } from '@/store/agent/selectors';import { useAgentId } from '../hooks/useAgentId';type HeteroReasoningEffort =- | ClaudeCodeReasoningEffort- | CodexReasoningEffort- | HeterogeneousAgentDefaultSelection;+ ClaudeCodeReasoningEffort | CodexReasoningEffort | HeterogeneousAgentDefaultSelection;type SelectableHeteroProviderType = 'claude-code' | 'codex';@@ -77,6 +79,15 @@ const EFFORT_LABEL_KEYS = {xhigh: 'heteroAgent.modelSelector.reasoning.xhigh',} as const satisfies Record<HeteroReasoningEffort, string>;+/**+ * Codex renames the `low` effort to "Light" in its official app UI while the+ * CLI value stays `low`; Claude Code keeps the plain "Low" wording.+ */+const CODEX_EFFORT_LABEL_KEYS = {+ ...EFFORT_LABEL_KEYS,+ low: 'heteroAgent.modelSelector.reasoning.light',+} as const satisfies Record<HeteroReasoningEffort, string>;+const styles = createStaticStyles(({ css }) => ({check: css`flex: none;@@ -115,6 +126,28 @@ const styles = createStaticStyles(({ css }) => ({background: ${cssVar.colorFillTertiary};}`,+ optionBody: css`+ overflow: hidden;+ display: flex;+ flex: 1;+ flex-direction: column;+ gap: 3px;++ min-width: 0;+ padding-block: 7px;+ `,+ optionDesc: css`+ overflow: hidden;++ font-size: 12px;+ color: ${cssVar.colorTextTertiary};+ text-overflow: ellipsis;+ white-space: nowrap;+ `,+ optionIcon: css`+ flex: none;+ color: ${cssVar.colorTextSecondary};+ `,optionLabel: css`overflow: hidden;flex: 1;@@ -124,6 +157,12 @@ const styles = createStaticStyles(({ css }) => ({text-overflow: ellipsis;white-space: nowrap;`,+ optionTitle: css`+ display: flex;+ gap: 6px;+ align-items: center;+ white-space: nowrap;+ `,popup: css`padding: 8px;border-radius: 16px;@@ -160,8 +199,17 @@ const styles = createStaticStyles(({ css }) => ({font-size: 14px;color: ${cssVar.colorText};`,+ submenuLead: css`+ overflow: hidden;+ display: flex;+ gap: 6px;+ align-items: center;++ min-width: 0;+ `,submenuMeta: css`overflow: hidden;+ min-width: 0;text-overflow: ellipsis;white-space: nowrap;`,@@ -318,9 +366,10 @@ const HeteroModel = memo(() => {const { allowed: canCreateContent, reason } = usePermission('create_content');const [open, setOpen] = useState(false);const [modelOpen, setModelOpen] = useState(false);+ const [speedOpen, setSpeedOpen] = useState(false);const patchProvider = useCallback(- async (patch: Partial<Pick<HeterogeneousProviderConfig, 'effort' | 'model'>>) => {+ async (patch: Partial<Pick<HeterogeneousProviderConfig, 'effort' | 'model' | 'speed'>>) => {if (!canCreateContent || !agentId) return;const nextPatch: Partial<HeterogeneousProviderConfig> = { ...patch };@@ -335,6 +384,10 @@ const HeteroModel = memo(() => {const sourceArgs = nextPatch.args ?? provider?.args;nextPatch.args = stripCodexConfigKey(sourceArgs, CODEX_REASONING_EFFORT_CONFIG_KEY);}+ if ('speed' in patch) {+ const sourceArgs = nextPatch.args ?? provider?.args;+ nextPatch.args = stripCodexConfigKey(sourceArgs, CODEX_SERVICE_TIER_CONFIG_KEY);+ }} else {if ('model' in patch) {nextPatch.args = stripCliFlags(provider?.args, ['--model']);@@ -354,17 +407,31 @@ const HeteroModel = memo(() => {const closeMenu = useCallback(() => {setOpen(false);setModelOpen(false);+ setSpeedOpen(false);}, []);const handleOpenChange = useCallback((value: boolean) => {setOpen(value);- if (!value) setModelOpen(false);+ if (!value) {+ setModelOpen(false);+ setSpeedOpen(false);+ }}, []);const selectModel = useCallback((value: string) => {closeMenu();- void patchProvider({ model: value });+ // Fast speed only applies to supported Codex models — reset it when the+ // user switches away so the selector never claims a speed the run ignores.+ const resetSpeed =+ provider?.type === 'codex' &&+ resolveCodexSpeedMode(provider) === 'fast' &&+ !codexModelSupportsFastSpeed(value);++ void patchProvider({+ model: value,+ ...(resetSpeed ? { speed: HETEROGENEOUS_AGENT_DEFAULT_SELECTION } : {}),+ });},- [closeMenu, patchProvider],+ [closeMenu, patchProvider, provider],);const selectReasoningEffort = useCallback((value: HeteroReasoningEffort) => {@@ -373,6 +440,13 @@ const HeteroModel = memo(() => {},[closeMenu, patchProvider],);+ const selectSpeedMode = useCallback(+ (value: HeterogeneousSpeedMode) => {+ closeMenu();+ void patchProvider({ speed: value });+ },+ [closeMenu, patchProvider],+ );if (!isSelectableProviderType(provider?.type)) return null;@@ -383,9 +457,19 @@ const HeteroModel = memo(() => {providerType === 'codex'? resolveCodexReasoningEffort(provider): resolveClaudeCodeReasoningEffort(provider);+ // Fast speed is a per-model capability: hide the whole Speed UI (submenu ++ // lightning icons) for models without the Fast tier. A stale persisted+ // `fast` on an unsupported model is ignored by the Codex CLI and cleared by+ // the selector on the next model switch.+ const supportsFastSpeed = providerType === 'codex' && codexModelSupportsFastSpeed(model);+ const speed = supportsFastSpeed+ ? resolveCodexSpeedMode(provider)+ : HETEROGENEOUS_AGENT_DEFAULT_SELECTION;+ const isFastSpeed = speed === 'fast';const defaultLabel = t('heteroAgent.modelSelector.default');const modelLabel = getModelLabel(model, defaultLabel);- const effortLabel = t(EFFORT_LABEL_KEYS[effort]);+ const effortLabelKeys = providerType === 'codex' ? CODEX_EFFORT_LABEL_KEYS : EFFORT_LABEL_KEYS;+ const effortLabel = t(effortLabelKeys[effort]);const reasoningLevels =providerType === 'codex' ? CODEX_REASONING_EFFORT_LEVELS : CLAUDE_CODE_REASONING_EFFORT_LEVELS;const providerModelOptions =@@ -393,7 +477,7 @@ const HeteroModel = memo(() => {const effortOptions: { label: string; value: HeteroReasoningEffort }[] = [{ label: defaultLabel, value: HETEROGENEOUS_AGENT_DEFAULT_SELECTION },...reasoningLevels.map((level) => ({- label: t(EFFORT_LABEL_KEYS[level]),+ label: t(effortLabelKeys[level]),value: level,})),];@@ -404,6 +488,24 @@ const HeteroModel = memo(() => {const modelOptions = baseModelOptions.some((option) => option.value === model)? baseModelOptions: [{ label: model, value: model }, ...baseModelOptions];+ const speedOptions: {+ description: string;+ icon?: typeof ZapIcon;+ label: string;+ value: HeterogeneousSpeedMode;+ }[] = [+ {+ description: t('heteroAgent.modelSelector.speed.standardDesc'),+ label: t('heteroAgent.modelSelector.speed.standard'),+ value: HETEROGENEOUS_AGENT_DEFAULT_SELECTION,+ },+ {+ description: t('heteroAgent.modelSelector.speed.fastDesc'),+ icon: ZapIcon,+ label: t('heteroAgent.modelSelector.speed.fast'),+ value: 'fast',+ },+ ];const triggerText = getTriggerText({defaultConfigLabel: t('heteroAgent.modelSelector.defaultConfig'),defaultModelLabel: t('heteroAgent.modelSelector.defaultModel'),@@ -422,6 +524,7 @@ const HeteroModel = memo(() => {reasoning: effortLabel,})}>+ {isFastSpeed && <Icon icon={ZapIcon} size={12} />}<span className={styles.label}>{triggerText}</span><Icon icon={ChevronDownIcon} size={12} /></div>@@ -436,7 +539,7 @@ const HeteroModel = memo(() => {const renderOption = <T extends string>(title: string,- options: readonly { label: string; value: T }[],+ options: readonly { description?: string; icon?: typeof ZapIcon; label: string; value: T }[],current: T,onSelect: (value: T) => void,) =>@@ -447,7 +550,17 @@ const HeteroModel = memo(() => {key={`${title}-${option.value}`}onClick={() => void onSelect(option.value)}>- <span className={styles.optionLabel}>{option.label}</span>+ {option.description ? (+ <div className={styles.optionBody}>+ <span className={styles.optionTitle}>+ {option.icon && <Icon className={styles.optionIcon} icon={option.icon} size={14} />}+ {option.label}+ </span>+ <span className={styles.optionDesc}>{option.description}</span>+ </div>+ ) : (+ <span className={styles.optionLabel}>{option.label}</span>+ )}{current === option.value && <Icon className={styles.check} icon={CheckIcon} size={16} />}</DropdownMenuItem>));@@ -466,13 +579,19 @@ const HeteroModel = memo(() => {<DropdownMenuSubmenuRoot open={modelOpen} onOpenChange={setModelOpen}><DropdownMenuSubmenuTriggerclassName={styles.submenuTrigger}- onMouseEnter={() => setModelOpen(true)}onClick={(event) => {event.preventDefault();setModelOpen(true);}}+ onMouseEnter={() => {+ setModelOpen(true);+ setSpeedOpen(false);+ }}>- <span className={styles.submenuMeta}>{modelLabel}</span>+ <span className={styles.submenuLead}>+ {isFastSpeed && <Icon className={styles.optionIcon} icon={ZapIcon} size={12} />}+ <span className={styles.submenuMeta}>{modelLabel}</span>+ </span><span className={styles.submenuTrail}><Icon icon={ChevronRightIcon} size={16} /></span>@@ -495,6 +614,43 @@ const HeteroModel = memo(() => {</DropdownMenuPositioner></DropdownMenuPortal></DropdownMenuSubmenuRoot>+ {supportsFastSpeed && (+ <DropdownMenuSubmenuRoot open={speedOpen} onOpenChange={setSpeedOpen}>+ <DropdownMenuSubmenuTrigger+ className={styles.submenuTrigger}+ onClick={(event) => {+ event.preventDefault();+ setSpeedOpen(true);+ }}+ onMouseEnter={() => {+ setSpeedOpen(true);+ setModelOpen(false);+ }}+ >+ <span className={styles.submenuMeta}>{t('heteroAgent.modelSelector.speed')}</span>+ <span className={styles.submenuTrail}>+ <Icon icon={ChevronRightIcon} size={16} />+ </span>+ </DropdownMenuSubmenuTrigger>+ <DropdownMenuPortal>+ <DropdownMenuPositioner+ alignOffset={-4}+ anchor={null}+ placement="right"+ sideOffset={8}+ >+ <DropdownMenuPopup className={styles.popup} style={{ minWidth: 232 }}>+ <div className={styles.sectionTitle}>+ {t('heteroAgent.modelSelector.speed')}+ </div>+ <div className={styles.scroll}>+ {renderOption('speed', speedOptions, speed, selectSpeedMode)}+ </div>+ </DropdownMenuPopup>+ </DropdownMenuPositioner>+ </DropdownMenuPortal>+ </DropdownMenuSubmenuRoot>+ )}</DropdownMenuPopup></DropdownMenuPositioner></DropdownMenuPortal>