feat(cliproxy): add 'max' thinking level for Claude Opus 4.7

Anthropic exposes `max` as a distinct adaptive-thinking effort above
`xhigh` on Opus 4.7. Previously the validator aliased user input `max`
down to `xhigh`, so users couldn't reach the real top-tier effort
through CCS.

Extend the validator:
- Add `max` to VALID_THINKING_LEVELS and THINKING_LEVEL_RANK (rank 6,
  above xhigh)
- Add `max` to THINKING_LEVEL_BUDGETS (65536, CCS-internal numeric
  mapping for closest-level lookups)
- Widen ThinkingSupport.maxLevel union to include 'max'

The existing `max: 'xhigh'` alias in findClosestLevel is kept as a
graceful fallback for models whose levels list does not include `max`
(e.g. Codex `gpt-5.4`), because exact-match on validLevels takes
priority — so Opus 4.7 returns `max` directly while Codex still maps
`max` -> `xhigh`.

Update the claude.claude-opus-4-7 catalog entry to expose
`['low', 'medium', 'high', 'xhigh', 'max']` with `maxLevel: 'max'`.

Built [OnSteroids](https://onsteroids.ai)

Co-Authored-By: OnSteroids <built@onsteroids.ai>
This commit is contained in:
Sergey GaluzaandOnSteroids committed 2026-04-22 21:32:14 +02:00
1 parent 46920dbc08
commit 45fe7ab086
4 files changed
+47 -7

No files matched your search

+2 -2
View File
@@ -150,8 +150,8 @@ describe('Model Catalog', () => {
// Opus 4.7 requires adaptive thinking (type: 'levels'); manual budget_tokens
// is rejected by the Anthropic API with 400. Extended (1M) context is available.
assert.strictEqual(opus47.thinking.type, 'levels');
assert.deepStrictEqual(opus47.thinking.levels, ['low', 'medium', 'high', 'xhigh']);
assert.strictEqual(opus47.thinking.maxLevel, 'xhigh');
assert.deepStrictEqual(opus47.thinking.levels, ['low', 'medium', 'high', 'xhigh', 'max']);
assert.strictEqual(opus47.thinking.maxLevel, 'max');
assert.strictEqual(opus47.extendedContext, true);
});
@@ -29,6 +29,7 @@ describe('Thinking Validator', () => {
expect(VALID_THINKING_LEVELS).toContain('medium');
expect(VALID_THINKING_LEVELS).toContain('high');
expect(VALID_THINKING_LEVELS).toContain('xhigh');
expect(VALID_THINKING_LEVELS).toContain('max');
expect(VALID_THINKING_LEVELS).toContain('auto');
});
@@ -38,6 +39,24 @@ describe('Thinking Validator', () => {
expect(THINKING_LEVEL_BUDGETS.medium).toBe(8192);
expect(THINKING_LEVEL_BUDGETS.high).toBe(24576);
expect(THINKING_LEVEL_BUDGETS.xhigh).toBe(32768);
// `max` sits above xhigh — unconstrained thinking on Opus 4.7 / Mythos
expect(THINKING_LEVEL_BUDGETS.max).toBeGreaterThan(THINKING_LEVEL_BUDGETS.xhigh);
});
it('should treat max as a distinct top tier on models that list it (Opus 4.7)', () => {
// Opus 4.7 exposes both xhigh and max; max must not collapse into xhigh.
const result = validateThinking('claude', 'claude-opus-4-7', 'max');
expect(result.valid).toBe(true);
expect(result.value).toBe('max');
expect(result.warning).toBeUndefined();
});
it('should still alias max -> xhigh for models without a max level (backcompat)', () => {
// Codex catalog uses ['low','medium','high','xhigh'] with maxLevel 'xhigh'.
// User input "max" should map down to xhigh rather than be rejected.
const result = validateThinking('codex', 'gpt-5.4', 'max');
expect(result.valid).toBe(true);
expect(result.value).toBe('xhigh');
});
it('should export off values', () => {