(accessToken: string)
| 27 | } |
| 28 | |
| 29 | export function extractChatGptAccountId(accessToken: string): string | null { |
| 30 | try { |
| 31 | const parts = accessToken.split('.') |
| 32 | if (parts.length !== 3) return null |
| 33 | const payload = JSON.parse(base64UrlDecode(parts[1])) |
| 34 | const auth = payload?.['https://api.openai.com/auth'] |
| 35 | return typeof auth?.chatgpt_account_id === 'string' |
| 36 | ? auth.chatgpt_account_id |
| 37 | : null |
| 38 | } catch { |
| 39 | return null |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | // ============================================================================ |
| 44 | // Request Transform: Chat Completions → Responses API |
no test coverage detected