fix(openai): harden GPT-5.6 billing and usage

This commit is contained in:
superman2003
2026-07-10 15:13:11 +08:00
parent 9a2f11b4e2
commit de28eba3c8
28 changed files with 524 additions and 49 deletions
+23 -3
View File
@@ -636,6 +636,23 @@ function generateOpenCodeConfig(platform: string, baseUrl: string, apiKey: strin
xhigh: {}
}
},
'gpt-5.6': {
name: 'GPT-5.6 (Sol)',
limit: {
context: 1050000,
output: 128000
},
options: {
store: false
},
variants: {
low: {},
medium: {},
high: {},
xhigh: {},
max: {}
}
},
'gpt-5.6-sol': {
name: 'GPT-5.6 Sol',
limit: {
@@ -649,7 +666,8 @@ function generateOpenCodeConfig(platform: string, baseUrl: string, apiKey: strin
low: {},
medium: {},
high: {},
xhigh: {}
xhigh: {},
max: {}
}
},
'gpt-5.6-terra': {
@@ -665,7 +683,8 @@ function generateOpenCodeConfig(platform: string, baseUrl: string, apiKey: strin
low: {},
medium: {},
high: {},
xhigh: {}
xhigh: {},
max: {}
}
},
'gpt-5.6-luna': {
@@ -681,7 +700,8 @@ function generateOpenCodeConfig(platform: string, baseUrl: string, apiKey: strin
low: {},
medium: {},
high: {},
xhigh: {}
xhigh: {},
max: {}
}
},
'gpt-5.5': {
@@ -123,6 +123,43 @@ describe('UseKeyModal', () => {
expect(codeBlock.text()).not.toContain('"name": "GPT-5.4 Nano"')
})
it('renders GPT-5.6 alias and max variants in OpenCode config', async () => {
const wrapper = mount(UseKeyModal, {
props: {
show: true,
apiKey: 'sk-test',
baseUrl: 'https://example.com/v1',
platform: 'openai'
},
global: {
stubs: {
BaseDialog: {
template: '<div><slot /><slot name="footer" /></div>'
},
Icon: {
template: '<span />'
}
}
}
})
const opencodeTab = wrapper.findAll('button').find((button) =>
button.text().includes('keys.useKeyModal.cliTabs.opencode')
)
expect(opencodeTab).toBeDefined()
await opencodeTab!.trigger('click')
await nextTick()
const parsed = JSON.parse(wrapper.find('pre code').text())
const models = parsed.provider.openai.models
for (const model of ['gpt-5.6', 'gpt-5.6-sol', 'gpt-5.6-terra', 'gpt-5.6-luna']) {
expect(models[model]).toBeDefined()
expect(models[model].variants).toHaveProperty('max')
expect(models[model].variants).toHaveProperty('xhigh')
}
expect(models['gpt-5.6'].name).toBe('GPT-5.6 (Sol)')
})
it('renders Claude Fable 5 OpenCode config with adaptive thinking', async () => {
const wrapper = mount(UseKeyModal, {
props: {