🦉 feat: Claude Opus 4.7 Model Support (#12698)

* 🦉 feat: Claude Opus 4.7 Model Support

- Add `claude-opus-4-7` to shared Anthropic models and `anthropic.claude-opus-4-7` to Bedrock models
- Register 1M context window and 128K max output in anthropic token maps
- Add token pricing ($5/$25), cache rates (6.25/0.5), and premium tier ($10/$37.50 above 200K) in tx.ts
- Update `.env.example` with Opus 4.7 IDs in `ANTHROPIC_MODELS` and `BEDROCK_AWS_MODELS` examples
- Add parallel Opus 4.7 test cases for token/cache/premium rates, context length, max output, name-variation matching, and 1M-context qualification

* feat: Add `xhigh` Effort Level for Opus 4.7

- Add `xhigh` variant to `AnthropicEffort` enum between `high` and `max`
- Expose `xhigh` in `anthropicSettings.effort.options` and the UI slider `enumMappings`
- Reuse existing `com_ui_xhigh` translation key

* test: Cover `xhigh` Effort and Exact Opus 4.7 Premium Rates

- Assert `xhigh` position (between high and max), inclusion in
  `anthropicSettings.effort.options`, zod acceptance, and rejection of
  unknown values in schemas.spec.ts
- Verify bedrockInputParser emits `output_config: { effort: 'xhigh' }`
  for adaptive `anthropic.claude-opus-4-7`
- Verify getLLMConfig sets adaptive thinking and `output_config.effort =
  'xhigh'` for `claude-opus-4-7`
- Pin Opus 4.7 premium pricing to exact threshold/prompt/completion
  values (200000 / 10 / 37.5) so silent rate drift fails the test
This commit is contained in:
Danny Avila 2026-04-16 14:51:00 -04:00 committed by GitHub
parent 49f228de78
commit e2e3284713
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 148 additions and 4 deletions

View file

@ -1377,6 +1377,37 @@ describe('Claude Model Tests', () => {
});
});
it('should return correct context length for Claude Opus 4.7 (1M)', () => {
expect(getModelMaxTokens('claude-opus-4-7', EModelEndpoint.anthropic)).toBe(
maxTokensMap[EModelEndpoint.anthropic]['claude-opus-4-7'],
);
expect(getModelMaxTokens('claude-opus-4-7')).toBe(
maxTokensMap[EModelEndpoint.anthropic]['claude-opus-4-7'],
);
});
it('should return correct max output tokens for Claude Opus 4.7 (128K)', () => {
const { getModelMaxOutputTokens } = require('@librechat/api');
expect(getModelMaxOutputTokens('claude-opus-4-7', EModelEndpoint.anthropic)).toBe(
maxOutputTokensMap[EModelEndpoint.anthropic]['claude-opus-4-7'],
);
});
it('should match model names correctly for Claude Opus 4.7', () => {
const modelVariations = [
'claude-opus-4-7',
'claude-opus-4-7-20260401',
'claude-opus-4-7-latest',
'anthropic/claude-opus-4-7',
'claude-opus-4-7/anthropic',
'claude-opus-4-7-preview',
];
modelVariations.forEach((model) => {
expect(matchModelName(model, EModelEndpoint.anthropic)).toBe('claude-opus-4-7');
});
});
it('should return correct context length for Claude Sonnet 4.6 (1M)', () => {
expect(getModelMaxTokens('claude-sonnet-4-6', EModelEndpoint.anthropic)).toBe(
maxTokensMap[EModelEndpoint.anthropic]['claude-sonnet-4-6'],