MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / extractChatGptAccountId

Function extractChatGptAccountId

sdk/src/impl/chatgpt-backend-fetch.ts:29–41  ·  view source on GitHub ↗
(accessToken: string)

Source from the content-addressed store, hash-verified

27}
28
29export 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

Callers 1

createOpenAIOAuthModelFunction · 0.90

Calls 2

base64UrlDecodeFunction · 0.85
parseMethod · 0.80

Tested by

no test coverage detected