OpenAI (ChatGPT) login (Google SSO)
Log into OpenAI / ChatGPT via Google SSO — picks the right account when several are signed in, and does nothing if you're already logged in. If Google interrupts the flow with a password re-confirmation or a 2FA step-up, the script can't complete that step on its own; sign in once manually in the same browser to clear the step-up, then re-run. It may also occasionally fail to complete a fresh login due to the site's own anti-automation checks — if that happens, try again shortly.
Input
email optionalGoogle account to pick in the chooser when several are signed in. Omit to use the first/only account.
Output
url requiredloggedIn requiredaccount optionalalready optionaltrue if a session already existed (no Google click needed)
FAQ
Ask ChatGPT
Open a new ChatGPT chat, send one question, wait for the answer to finish (up to 3 minutes), and return the answer, the sources it cited, and the web searches it ran. `answers` is a list: ChatGPT sometimes answers twice and asks which reply you prefer, so check its length before reading answers[0]. `references` are the pages the answer cited, each with the id of the search result it came from when ChatGPT gives one (the search call and the result's rank in it). `sources` are the pages its searches gave the model. `searches` and `calls` also list the results ChatGPT shows under Sources but never gave the model, with `given: false`. An empty `references` means that reply cited nothing: the same question may search on one run and not the next, so repeat it before drawing conclusions. `webSearchQueries` lists what ChatGPT searched for, `searches` groups those queries by round with their results, and `calls` lists each search call with every result's type, position, snippet and date. `activity` gives the progress lines the page showed while it worked ("Searching the web", "Searched 8 websites"). `model`, `stopReason` and `searchContext` say which model answered and how; signed in, `searchContext` also gives the model and thinking effort the account asked for, and its plan. Signed in, it answers in Chat mode only: when the browser is in Work mode it fails with an error that says so; switch back with set_mode (a Chat choice lasts about four hours). Works signed in or signed out, on a Reduck cloud browser or your own paired browser, in any display language. Signed in, every field is filled, and the account's saved memory can influence the answer. Signed out, ChatGPT shows the answer and its citations but not its searches: `answers`, `references` (with each citation's search result id) and `activity` are filled, and `webSearchQueries`, `searches`, `sources`, `calls`, `model` and `stopReason` are null (unknown, not none).
ChatGPT whoami (signed-in account)
Report which ChatGPT account this browser is signed in as: the user id, email and name. When the browser is signed out of ChatGPT, the run fails with a message asking you to sign in to chatgpt.com, so it can be used to check a session before running other ChatGPT scripts.
ChatGPT billing: list your ChatGPT subscription invoices
ChatGPT subscription invoices, not the OpenAI API platform. Lists the billing history of the ChatGPT account currently open in this browser, as its Billing page shows it: only that account's invoices, never those of the user's other accounts. To get another account's invoices, switch ChatGPT to that account, then run this again. A Business, Team or Enterprise workspace open in the browser has no personal Billing page, and the run fails saying so. Each invoice comes with its date, amount, currency, payment status, plan and a link to the invoice; the result also names the active account and lists every account the user belongs to. Amounts are in the currency's smallest unit, so 1917 means 19.17 EUR. The Billing page shows the most recent invoices first and this script cannot page further: when ChatGPT says older invoices exist, complete is false and next_cursor holds the cursor ChatGPT gave, but those older invoices are not returned. When the browser is not signed in to ChatGPT, the run fails with a not-signed-in error. Pass hosted_invoice_url to the Stripe invoice PDF download script to get the PDF.
