feat: /login支持codex订阅登录

This commit is contained in:
Bill
2026-05-08 20:35:34 +08:00
parent 73e54d4bbc
commit c7cb3d8f93
17 changed files with 1318 additions and 39 deletions

View File

@@ -9,6 +9,10 @@ import { isEnvTruthy } from './envUtils.js'
import type { EffortLevel } from 'src/entrypoints/sdk/runtimeTypes.js'
import { resolveAntModel } from './model/antModels.js'
import { getAntModelOverrideConfig } from './model/antModels.js'
import {
isChatGPTAuthMode,
isChatGPTCodexReasoningModel,
} from './model/chatgptModels.js'
export type { EffortLevel }
@@ -32,6 +36,13 @@ export function modelSupportsEffort(model: string): boolean {
if (supported3P !== undefined) {
return supported3P
}
if (
getAPIProvider() === 'openai' &&
isChatGPTAuthMode() &&
isChatGPTCodexReasoningModel(model)
) {
return true
}
// Supported by a subset of Claude 4 models
if (
m.includes('opus-4-7') ||
@@ -87,6 +98,13 @@ export function modelSupportsXhighEffort(model: string): boolean {
if (supported3P !== undefined) {
return supported3P
}
if (
getAPIProvider() === 'openai' &&
isChatGPTAuthMode() &&
isChatGPTCodexReasoningModel(model)
) {
return true
}
if (model.toLowerCase().includes('opus-4-7')) {
return true
}
@@ -200,6 +218,16 @@ export function resolveAppliedEffort(
if (resolved === 'xhigh' && !modelSupportsXhighEffort(model)) {
return 'high'
}
// OpenAI Responses uses xhigh as its highest public reasoning effort.
// Keep /effort max usable as a familiar alias in ChatGPT subscription mode.
if (
resolved === 'max' &&
getAPIProvider() === 'openai' &&
isChatGPTAuthMode() &&
modelSupportsXhighEffort(model)
) {
return 'xhigh'
}
// API rejects 'max' on non-Opus-4.6 models — downgrade to 'high'.
if (resolved === 'max' && !modelSupportsMaxEffort(model)) {
return 'high'
@@ -347,6 +375,14 @@ export function getDefaultEffortForModel(
// the model launch DRI and research. Default effort is a sensitive setting
// that can greatly affect model quality and bashing.
if (
getAPIProvider() === 'openai' &&
isChatGPTAuthMode() &&
isChatGPTCodexReasoningModel(model)
) {
return 'medium'
}
// Default effort on Opus 4.6 to medium for Pro.
// Max/Team also get medium when the tengu_grey_step2 config is enabled.
if (