feat(llms): add Claude Opus 4.8 support

Strip temperature for claude-opus-4-8, add tests, list model on website.
This commit is contained in:
Simon
2026-06-08 22:23:56 +08:00
parent 0ba3bbd67f
commit 2f343bcc56
3 changed files with 20 additions and 2 deletions

View File

@@ -67,6 +67,18 @@ describe('modelPatch', () => {
expect(body).not.toHaveProperty('temperature')
})
it('claude-opus-4-8: drops temperature', () => {
const body = baseBody('claude-opus-4-8')
modelPatch(body)
expect(body).not.toHaveProperty('temperature')
})
it('claude-opus-48 (alt id form): drops temperature', () => {
const body = baseBody('claude-opus-48-20251210')
modelPatch(body)
expect(body).not.toHaveProperty('temperature')
})
it('grok: removes tool_choice and disables reasoning/thinking', () => {
const body = baseBody('grok-4')
modelPatch(body)

View File

@@ -56,8 +56,13 @@ export function modelPatch(body: Record<string, any>) {
// TODO: Claude naming pattern has changed
// needs proper handling
if (modelName.startsWith('claude-opus-4-7') || modelName.startsWith('claude-opus-47')) {
debug('Applying Claude-4.7 patch: remove temperature')
if (
modelName.startsWith('claude-opus-4-7') ||
modelName.startsWith('claude-opus-47') ||
modelName.startsWith('claude-opus-4-8') ||
modelName.startsWith('claude-opus-48')
) {
debug('Applying Claude-4.7/4.8 patch: remove temperature')
delete body.temperature
}
}