gptsession2cpaandsub2api

repository·main·Indexed 23 days ago

https://github.com/gtxx3600/gptsession2cpaandsub2api

A client-side utility for converting ChatGPT Web session JSON into authentication formats for third-party Codex and API proxy tools. Supported target formats include CPA, sub2api, Cockpit Tools, 9router, Codex (native auth.json), AxonHub, and Codex-Manager. The tool operates entirely in the browser to ensure tokens are not uploaded to a server.

Tokens
932
Snippets
2
Records
5
Agent score
32%

What's inside gptsession2cpaandsub2api

  1. Overview of ChatGPT Session Conversion Tool

    main

    This project is a pure front-end single-page tool designed to convert ChatGPT Web login session JSON files into importable JSON formats for various third-party tools.

    Supported target tools include:

    • CPA
    • sub2api
    • Cockpit Tools
    • 9router
    • Codex (native auth.json)
    • AxonHub
    • Codex-Manager

    Important Limitations:

    • No Phone Bypass: This tool can no longer be used to bypass Codex OAuth add phone / mobile verification requirements due to OpenAI restrictions.
    • Token Expiration: ChatGPT Web sessions typically do not contain a refresh_token. Consequently, once the access_token expires, it cannot be automatically refreshed.
    • Account Permissions: Converting a Free account session will not grant access to models or features requiring a paid subscription.
  2. Run the tool locally

    main

    Since this is a pure front-end tool, you can run it locally by opening the HTML file in any modern web browser.

    Privacy Note: All parsing and conversion happen locally in your browser. Tokens are not uploaded to any server and are not written to local storage.

    docs/index.html
  3. Supported input formats

    main

    The tool accepts pasted or dragged-in JSON files from the following sources:

    • ChatGPT Web Session JSON: Must contain fields like user.email, accessToken, sessionToken, expires, account.id, or account.planType.
    • 9router Codex OAuth JSON: Includes accessToken, refreshToken, expiresAt, and providerSpecificData.chatgptAccountId.
    • Codex Native auth.json: Includes auth_mode, OPENAI_API_KEY, tokens.access_token, tokens.refresh_token, tokens.id_token, tokens.account_id, and last_refresh.
    • AxonHub Codex auth.json: Includes tokens.access_token, tokens.refresh_token, tokens.id_token, and last_refresh.
    • Codex-Manager Batch Import JSON: Includes tokens.access_token, tokens.refresh_token, tokens.id_token, and meta.label.

    The tool attempts to supplement missing data (email, account ID, user ID, plan type, and expiration) by parsing the JWT payload of the accessToken.

  4. Supported output formats

    main

    The tool generates specific JSON structures for the following targets:

    • CPA: Generates Codex CPA auth JSON with type: "codex", access_token, session_token, id_token, email, account_id, plan, and expiration. If id_token is missing, it constructs placeholder JWT claims.
    • sub2api: Generates a structure compatible with CPA2sub2API (exported_at/proxies/accounts) with platform: "openai" and type: "oauth". expires_at is derived from the JWT exp claim.
    • Cockpit: Generates a flat token format for Cockpit Tools including id_token, access_token, refresh_token, account_id, email, and expired.
    • 9router: Generates 9router Codex OAuth JSON including accessToken, refreshToken, expiresAt, providerSpecificData, provider, authType, priority, isActive, createdAt, and updatedAt.
    • Codex: Generates native auth.json with auth_mode: "chatgpt" and OPENAI_API_KEY: null. If refresh_token is missing, it is set to an empty string.
    • AxonHub: Generates AxonHub Codex auth.json with auth_mode: "chatgpt". If refresh_token is missing, it uses the placeholder __missing_refresh_token__.
    • Codex-Manager: Generates batch import JSON including tokens.access_token/refresh_token/id_token and meta.label/workspace_id/chatgpt_account_id/note. Missing refresh_token values are set to an empty string to prevent incorrect refresh attempts.