Skip to content

Commit 6f19440

Browse files
committed
fix(agy): enable claude model thinking via antigravity profile
- Removed broken: true and issueUrl from Claude thinking models - Added MAX_THINKING_TOKENS=8191 for Antigravity-proxied Claude models - Removed alwaysThinkingEnabled:false requirement - Updated info message explaining thinking token limit Claude models now work with extended thinking when using Antigravity proxy (MAX_THINKING_TOKENS < 8192 is required).
1 parent 30eb5d2 commit 6f19440

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

src/cliproxy/model-catalog.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,22 +50,16 @@ export const MODEL_CATALOG: Partial<Record<CLIProxyProvider, ProviderCatalog>> =
5050
id: 'gemini-claude-opus-4-5-thinking',
5151
name: 'Claude Opus 4.5 Thinking',
5252
description: 'Most capable, extended thinking',
53-
broken: true,
54-
issueUrl: 'https://github.com/router-for-me/CLIProxyAPI/issues/415',
5553
},
5654
{
5755
id: 'gemini-claude-sonnet-4-5-thinking',
5856
name: 'Claude Sonnet 4.5 Thinking',
5957
description: 'Balanced with extended thinking',
60-
broken: true,
61-
issueUrl: 'https://github.com/router-for-me/CLIProxyAPI/issues/415',
6258
},
6359
{
6460
id: 'gemini-claude-sonnet-4-5',
6561
name: 'Claude Sonnet 4.5',
6662
description: 'Fast and capable',
67-
broken: true,
68-
issueUrl: 'https://github.com/router-for-me/CLIProxyAPI/issues/415',
6963
},
7064
{
7165
id: 'gemini-3-pro-preview',

src/cliproxy/model-config.ts

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,22 @@ import { InteractivePrompt } from '../utils/prompt';
1111
import { getProviderCatalog, supportsModelConfig, ModelEntry } from './model-catalog';
1212
import { getProviderSettingsPath, getClaudeEnvVars } from './config-generator';
1313
import { CLIProxyProvider } from './types';
14-
import { initUI, color, bold, dim, ok, info, warn, header } from '../utils/ui';
14+
import { initUI, color, bold, dim, ok, info, header } from '../utils/ui';
1515

1616
/**
1717
* Check if model is a Claude model routed via Antigravity
18-
* These models don't support thinking toggle due to protocol limitations
18+
* Claude models require MAX_THINKING_TOKENS < 8192 for thinking to work
1919
*/
2020
function isClaudeModel(modelId: string): boolean {
2121
return modelId.includes('claude');
2222
}
2323

24+
/**
25+
* Max thinking tokens for Claude models via Antigravity
26+
* Must be < 8192 due to Google protocol conversion limitations
27+
*/
28+
const CLAUDE_MAX_THINKING_TOKENS = '8191';
29+
2430
/** CCS directory */
2531
const CCS_DIR = path.join(process.env.HOME || process.env.USERPROFILE || '', '.ccs');
2632

@@ -146,15 +152,20 @@ export async function configureProviderModel(
146152
const isClaude = isClaudeModel(selectedModel);
147153

148154
// CCS-controlled env vars (always override with our values)
149-
const ccsControlledEnv = {
150-
ANTHROPIC_BASE_URL: baseEnv.ANTHROPIC_BASE_URL,
151-
ANTHROPIC_AUTH_TOKEN: baseEnv.ANTHROPIC_AUTH_TOKEN,
155+
const ccsControlledEnv: Record<string, string> = {
156+
ANTHROPIC_BASE_URL: baseEnv.ANTHROPIC_BASE_URL || '',
157+
ANTHROPIC_AUTH_TOKEN: baseEnv.ANTHROPIC_AUTH_TOKEN || '',
152158
ANTHROPIC_MODEL: selectedModel,
153159
ANTHROPIC_DEFAULT_OPUS_MODEL: selectedModel,
154160
ANTHROPIC_DEFAULT_SONNET_MODEL: selectedModel,
155-
ANTHROPIC_DEFAULT_HAIKU_MODEL: baseEnv.ANTHROPIC_DEFAULT_HAIKU_MODEL,
161+
ANTHROPIC_DEFAULT_HAIKU_MODEL: baseEnv.ANTHROPIC_DEFAULT_HAIKU_MODEL || '',
156162
};
157163

164+
// Claude models require MAX_THINKING_TOKENS < 8192 for thinking to work
165+
if (isClaude) {
166+
ccsControlledEnv.MAX_THINKING_TOKENS = CLAUDE_MAX_THINKING_TOKENS;
167+
}
168+
158169
// Merge: user env vars (preserved) + CCS controlled (override)
159170
const mergedEnv = {
160171
...existingEnv,
@@ -167,12 +178,6 @@ export async function configureProviderModel(
167178
env: mergedEnv,
168179
};
169180

170-
// Claude models via Antigravity don't support thinking toggle
171-
// Always set to false for Claude models (CCS-controlled)
172-
if (isClaude) {
173-
settings.alwaysThinkingEnabled = false;
174-
}
175-
176181
// Ensure CCS directory exists
177182
if (!fs.existsSync(CCS_DIR)) {
178183
fs.mkdirSync(CCS_DIR, { recursive: true });
@@ -189,12 +194,13 @@ export async function configureProviderModel(
189194
console.error(ok(`Model set to: ${bold(displayName)}`));
190195
console.error(dim(` Config saved: ${settingsPath}`));
191196

192-
// Show warning for Claude models about thinking limitation
197+
// Show info for Claude models about thinking token limit
193198
if (isClaude) {
194199
console.error('');
195-
console.error(warn('Claude models via Antigravity have limited thinking support.'));
196-
console.error(dim(' Thinking toggle (Tab) disabled - Google protocol limitation.'));
197-
console.error(dim(' See: https://github.com/router-for-me/CLIProxyAPI/issues/415'));
200+
console.error(
201+
info(`MAX_THINKING_TOKENS set to ${CLAUDE_MAX_THINKING_TOKENS} (required < 8192)`)
202+
);
203+
console.error(dim(' Google protocol conversion requires this limit for thinking to work.'));
198204
}
199205
console.error('');
200206

0 commit comments

Comments
 (0)