feat(cliproxy): add model-specific reasoning effort caps

Add maxLevel field to ThinkingSupport interface to cap reasoning
effort at model's maximum supported level. This fixes Issue #344
where gpt-5-mini fails with xhigh reasoning (only supports high).

- Add Codex provider to model catalog with gpt-5.2-codex and gpt-5-mini
- Add capLevelAtMax() and capEffortAtModelMax() for runtime capping
- Update UI presets with new Codex models and tier mappings
This commit is contained in:
kaitranntt committed 2026-01-21 14:27:46 -05:00
1 parent 2f584802bd
commit eec44d54e2
4 files changed
+152 -19

No files matched your search

+43
View File
@@ -20,6 +20,8 @@ export interface ThinkingSupport {
max?: number;
/** Valid level names (for levels type) */
levels?: string[];
/** Maximum reasoning effort level (caps effort at this level for levels type) */
maxLevel?: 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
/** Whether zero/disabled thinking is allowed */
zeroAllowed?: boolean;
/** Whether dynamic/auto thinking is allowed */
@@ -135,6 +137,35 @@ export const MODEL_CATALOG: Partial<Record<CLIProxyProvider, ProviderCatalog>> =
},
],
},
codex: {
provider: 'codex',
displayName: 'Copilot Codex',
defaultModel: 'gpt-5.2-codex',
models: [
{
id: 'gpt-5.2-codex',
name: 'GPT-5.2 Codex',
description: 'Full reasoning support (xhigh)',
thinking: {
type: 'levels',
levels: ['medium', 'high', 'xhigh'],
maxLevel: 'xhigh',
dynamicAllowed: false,
},
},
{
id: 'gpt-5-mini',
name: 'GPT-5 Mini',
description: 'Capped at high reasoning (no xhigh)',
thinking: {
type: 'levels',
levels: ['medium', 'high'],
maxLevel: 'high',
dynamicAllowed: false,
},
},
],
},
};
/**
@@ -208,6 +239,18 @@ export function getModelThinkingSupport(
return model?.thinking;
}
/**
* Get the maximum reasoning effort level for a model.
* Returns undefined if model has no cap or is not in catalog.
*/
export function getModelMaxLevel(
provider: CLIProxyProvider,
modelId: string
): ThinkingSupport['maxLevel'] | undefined {
const thinking = getModelThinkingSupport(provider, modelId);
return thinking?.maxLevel;
}
/**
* Check if model supports thinking/reasoning
*/