diff --git a/src/cliproxy/cliproxy-executor.ts b/src/cliproxy/cliproxy-executor.ts index 03c8c04f..ecaaff24 100644 --- a/src/cliproxy/cliproxy-executor.ts +++ b/src/cliproxy/cliproxy-executor.ts @@ -27,6 +27,7 @@ import { CLIPROXY_DEFAULT_PORT, getCliproxyWritablePath, validatePort, + applyThinkingConfig, } from './config-generator'; import { checkRemoteProxy } from './remote-proxy-client'; import { isAuthenticated } from './auth-handler'; @@ -311,6 +312,21 @@ export async function execClaudeWithCLIProxy( setNickname = argsWithoutProxy[nicknameIdx + 1]; } + // Parse --thinking flag for thinking budget control + // Supports: level names (low, medium, high, xhigh, auto), numeric budget, or 'off'/'none' + let thinkingOverride: string | number | undefined; + const thinkingIdx = argsWithoutProxy.indexOf('--thinking'); + if ( + thinkingIdx !== -1 && + argsWithoutProxy[thinkingIdx + 1] && + !argsWithoutProxy[thinkingIdx + 1].startsWith('-') + ) { + const val = argsWithoutProxy[thinkingIdx + 1]; + // Parse as number if numeric, otherwise keep as string (level name) + const numVal = parseInt(val, 10); + thinkingOverride = !isNaN(numVal) ? numVal : val; + } + // Handle --accounts: list accounts and exit if (showAccounts) { const accounts = getProviderAccounts(provider); @@ -704,6 +720,10 @@ export async function execClaudeWithCLIProxy( ) : getEffectiveEnvVars(provider, cfg.port, cfg.customSettingsPath, remoteRewriteConfig); + // Apply thinking configuration to model (auto tier-based or manual override) + // This adds thinking suffix like model(high) or model(8192) for CLIProxyAPIPlus + applyThinkingConfig(envVars, provider, thinkingOverride); + // Codex-only: inject OpenAI reasoning effort based on tier model mapping. // Maps by request.model: // - OPUS/default model → xhigh @@ -789,6 +809,7 @@ export async function execClaudeWithCLIProxy( '--accounts', '--use', '--nickname', + '--thinking', '--incognito', '--no-incognito', '--import', @@ -798,8 +819,12 @@ export async function execClaudeWithCLIProxy( const claudeArgs = argsWithoutProxy.filter((arg, idx) => { // Filter out CCS flags if (ccsFlags.includes(arg)) return false; - // Filter out value after --use or --nickname - if (argsWithoutProxy[idx - 1] === '--use' || argsWithoutProxy[idx - 1] === '--nickname') + // Filter out value after --use, --nickname, or --thinking + if ( + argsWithoutProxy[idx - 1] === '--use' || + argsWithoutProxy[idx - 1] === '--nickname' || + argsWithoutProxy[idx - 1] === '--thinking' + ) return false; return true; }); diff --git a/src/commands/help-command.ts b/src/commands/help-command.ts index b443b5f2..42de0433 100644 --- a/src/commands/help-command.ts +++ b/src/commands/help-command.ts @@ -172,6 +172,10 @@ Run ${color('ccs config', 'command')} for web dashboard`.trim(); ['ccs --accounts', 'List all accounts'], ['ccs --use ', 'Switch to account'], ['ccs --config', 'Change model (agy, gemini)'], + [ + 'ccs --thinking ', + 'Set thinking budget (low/medium/high/xhigh/auto/off or number)', + ], ['ccs --logout', 'Clear authentication'], ['ccs --headless', 'Headless auth (for SSH)'], ['ccs kiro --import', 'Import token from Kiro IDE'],