diff --git a/src/utils/auth.ts b/src/utils/auth.ts index d406eae..243ad36 100644 --- a/src/utils/auth.ts +++ b/src/utils/auth.ts @@ -1627,14 +1627,19 @@ export function isClaudeAISubscriber(): boolean { } export function isCodexSubscriber(): boolean { - // Check if we're using OpenAI API - if (getAPIProvider() !== 'openai') { - return false + // Check if we're using OpenAI API via environment variable + if (getAPIProvider() === 'openai') { + return true } - // For now, return true if OpenAI provider is configured - // This can be extended to check for specific token scopes when available - return true + // Check if we have OpenAI OAuth tokens + const config = getGlobalConfig() + const openaiTokens = config?.openaiOauthTokens + if (openaiTokens?.access_token && openaiTokens?.scopes?.includes('codex')) { + return true + } + + return false } /** diff --git a/src/utils/config.ts b/src/utils/config.ts index 9fd2a3c..bdffd13 100644 --- a/src/utils/config.ts +++ b/src/utils/config.ts @@ -587,6 +587,14 @@ export type GlobalConfig = { // CURRENT_MIGRATION_VERSION, runMigrations() skips all sync migrations // (avoiding 11× saveGlobalConfig lock+re-read on every startup). migrationVersion?: number + + // OpenAI OAuth tokens for Codex API access + openaiOauthTokens?: { + access_token: string + refresh_token?: string + scopes?: string[] + expires_at?: number + } } /**