chatgpt-api: Check everything and still 403

Hi, @transitive-bullshit

I have check every step you say and still 403

In my case, I run robot on a server. This server also run a http proxy. On my local PC, I use Chrome to access ChatGpt webapp with using proxy running on my server. Then I put session and cf_token onto server and use this lib. Below is my code


chatGpt: new ChatGPTAPI({
          //fresh token copy form Chrome
          sessionToken: account.session_token,
          clearanceToken: account.clearance_token,
         // copy from chrom console
          userAgent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
        }),

But, I still get 403


  • Make sure you’re using Node.js >= 18 sure, node version is v19.2.0

  • Make sure you’re using the latest version of this package sure , “chatgpt”: “^2.3.1”,

  • Make sure your IP address and user agent match exactly the browser that’s being used to generate the CF token and session tokens sure, because I use a http proxy to ensure browser and robot in same IP address

  • This means that for most cases, you can’t use a proxy or VPN to connect to the API

  • Make sure you’re using your local install of Chrome and not the default puppeteer executable (which Cloudflare detects) sure, a normal Chrome I daily use

  • Make sure you’re not using the account in a browser window at the same time (since it can invalidate your bot’s credentials) sure, I close browser tab before robot start

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 22 (10 by maintainers)

Most upvoted comments

@slovx2 https://github.com/transitive-bullshit/chatgpt-api/releases/tag/v2.5.0 adds support for conversations to the browser version 🔥

You have to use the onConversationResponse parameter to get the conversationId and messageId.

@transitive-bullshit thank you, for a great job

@slovx2 yes; I’m currently working on adding conversation tracking support to the browser version.

https://github.com/transitive-bullshit/chatgpt-api/releases/tag/v2.4.0 introduces a now fully browser-based solution, ChatGPTAPIBrowser that should resolve a lot of people’s 403 / 429 errors — unless your account of IP address has been banned.

Thanks, and sorry for all the headaches that Cloudflare has caused.