YouTube2Text

I Found OpenAI’s $3B Loophole — Transcript

by Evan Zhou · 1,641 words · 251 segments · language en · Watch on YouTube

Full transcript

  1. 0:00This button gives you free AI from
  2. 0:02OpenAI in any app, and it can literally
  3. 0:04cost OpenAI billions of dollars per
  4. 0:06year, which is exactly why I
  5. 0:08open-sourced it so that by the end of
  6. 0:10this video, you too will be able to
  7. 0:11instantly get free OpenAI API, and not
  8. 0:14only that, due to the way it works,
  9. 0:15OpenAI can do nothing to stop me. Let me
  10. 0:18explain. If you want to use OpenAI's AI
  11. 0:20in any app, you need an API key with
  12. 0:22every request costing [music] money. In
  13. 0:24fact, OpenAI makes nearly $3 billion off
  14. 0:27their API each year. But, there's an
  15. 0:29obvious exception. You can use ChatGPT
  16. 0:31and other products by OpenAI themselves
  17. 0:33for free. And with a subscription, you
  18. 0:35can use far more AI than you can with
  19. 0:37the same cost in API. The reason, of
  20. 0:39course, is that they lure you in and
  21. 0:41trap you into using their product. But,
  22. 0:42ironically, this pricing difference
  23. 0:44between a ChatGPT account and API isn't
  24. 0:46quite so open, especially given the fact
  25. 0:49that it's the same [music] compute and
  26. 0:50exact same cost for OpenAI to run a
  27. 0:52model in their product or with an API
  28. 0:54key. So, I always wondered, what [music]
  29. 0:56if we could turn your ChatGPT account
  30. 0:58into an API that you can use anywhere? A
  31. 1:00single sign-in with ChatGPT button
  32. 1:02[music] that would become OpenAI's
  33. 1:04billion-dollar button that they
  34. 1:05definitely don't want you to have. Now,
  35. 1:07the obvious solution to achieve this is
  36. 1:09to reverse engineer chat.openai.com,
  37. 1:11where you can essentially access free AI
  38. 1:13with your account. You would have to
  39. 1:14figure out how they store your login
  40. 1:15credentials and then intercept network
  41. 1:17requests to see how those credentials
  42. 1:18are used to authenticate the internal
  43. 1:20ChatGPT endpoint that the website uses.
  44. 1:22I would know this because over 3 years
  45. 1:24ago, I had to reverse-engineer Google AI
  46. 1:26SDK that used this path before Google
  47. 1:28even had an API. But, from that, I
  48. 1:30learned that not only are those [music]
  49. 1:31credentials unstable, meaning that you
  50. 1:33would have to constantly update them
  51. 1:35manually, the internal ChatGPT endpoint
  52. 1:37is also highly abstracted, meaning that
  53. 1:39you can't do things like add custom
  54. 1:41tools or get direct access to the
  55. 1:42transcript. But, ChatGPT is just one of
  56. 1:45OpenAI's products. Looking at the
  57. 1:47selection of all the other products that
  58. 1:48we can approach and try to
  59. 1:49reverse-engineer to achieve our goal,
  60. 1:51the choice becomes obvious: Codex CLI.
  61. 1:54Like other products, it allows you to
  62. 1:55log in with your ChatGPT account to use
  63. 1:57AI. But, unlike other products, it's
  64. 1:59open source, which means that not only
  65. 2:01could we easily reverse engineer and
  66. 2:03replicate their authentication pattern,
  67. 2:05their API also has to be stable,
  68. 2:07documented, and feature-rich because the
  69. 2:09same maintain shipping product OpenAI is
  70. 2:11constantly updating. Exactly the type of
  71. 2:14API that we would want to reverse
  72. 2:15engineer. But, the best part about this
  73. 2:17is that OpenAI can't block access on
  74. 2:19this Codex API without breaking Codex
  75. 2:21itself, meaning that they can't stop you
  76. 2:23on a technical level from using this
  77. 2:25endpoint. And even on a practical level,
  78. 2:28OpenAI has essentially said multiple
  79. 2:29times that they are okay with using
  80. 2:31alternate harnesses with a Codex
  81. 2:33subscription. And this is simply a
  82. 2:34generalization of that. So, we're good
  83. 2:36to dig in. The way it works is simple.
  84. 2:38Codex stores a special set of
  85. 2:40OAuth-based credentials, which you use
  86. 2:42to authenticate your requests to an
  87. 2:44internal endpoint instead of an API key.
  88. 2:46Since we can simply look at the code,
  89. 2:47it's trivial to find the exact logic to
  90. 2:49use those credentials to make requests.
  91. 2:51We could then build a bridge from that
  92. 2:52internal endpoint to a standard OpenAI
  93. 2:55API interface. And while there were some
  94. 2:57limitations with the Codex internal API,
  95. 2:59we could hide many of these things
  96. 3:01within our bridge. For example, Codex's
  97. 3:03endpoint requires special headers and
  98. 3:05identifiers. Our bridge can inject those
  99. 3:07for you. Codex also only supports
  100. 3:09streaming requests. So, our bridge can
  101. 3:10stream under the hood and return a
  102. 3:11non-streaming request if you need it.
  103. 3:13But, of course, there were other
  104. 3:14limitations that we simply couldn't work
  105. 3:16around, such as the fact that even
  106. 3:17though this works on a free plan, you
  107. 3:19are still subject to rate limits, or the
  108. 3:21fact that the models you have access to
  109. 3:23also varies based on your plan.
  110. 3:25Nonetheless, just like that, OpenAI
  111. 3:27themselves had essentially just handed
  112. 3:29us the ability to turn a ChatGPT account
  113. 3:31into a free API key. And believe it or
  114. 3:33not, you can literally try this out
  115. 3:35right now by typing NPX OpenAI-OAuth
  116. 3:38into your terminal. It'll take your free
  117. 3:40or paid ChatGPT account, and using my
  118. 3:42specially designed bridge, turn it into
  119. 3:44a free OpenAI API. But, even with that,
  120. 3:47we're only halfway done because so far,
  121. 3:49we've only handled using credentials we
  122. 3:51already have on the user's device. Where
  123. 3:53it gets really interesting is getting
  124. 3:55those credentials in the first place,
  125. 3:57which can enable users beyond developers
  126. 3:59with Code X CLI to replace their API
  127. 4:01keys. But to understand why this is so
  128. 4:03difficult and significant, we have to
  129. 4:05start back at Code X CLI, reverse
  130. 4:07engineering how users sign in. It's a
  131. 4:10pretty standard OAuth flow. When a
  132. 4:11client device begins sign in, it starts
  133. 4:13listening at a special localhost port,
  134. 4:151455. Then it sends you to OpenAI's
  135. 4:17website, on which you can log in to your
  136. 4:19account. Most importantly, when you're
  137. 4:20done, sends those credentials back to
  138. 4:22the localhost [music] 1455 port from the
  139. 4:24beginning, so that the client device
  140. 4:26that initialized the request can use
  141. 4:27those credentials to make requests just
  142. 4:29like we have done. Since we have Code
  143. 4:30X's source, it's trivial to figure out
  144. 4:32the special OAuth URL needed to
  145. 4:34initialize the authentication and
  146. 4:36replicate it locally on the user's
  147. 4:37computer. We simply have to start a
  148. 4:39service at 1455, and the rest is
  149. 4:41straightforward. But now, let's take it
  150. 4:42a step further. How can we make the sign
  151. 4:45in flow work in even a browser, so that
  152. 4:48any user, anywhere, can instantly log in
  153. 4:50with their ChatGPT account to any
  154. 4:52website? Something that would allow not
  155. 4:54only developers, but users all around
  156. 4:56the world to [music] ditch API keys
  157. 4:58altogether. The issue though is that
  158. 5:00OpenAI's OAuth flow only returns
  159. 5:02credentials to localhost 1455, and a
  160. 5:04normal browser tab can't read localhost,
  161. 5:07much less open a service on a port to
  162. 5:09read those credentials. So natural next
  163. 5:10step is to have a server on the cloud,
  164. 5:12which has access to its own localhost
  165. 5:14and can handle the OAuth flow there. But
  166. 5:16things quickly fall apart. First, the
  167. 5:18server doesn't have your OpenAI account.
  168. 5:20So you have to use OpenAI's device code
  169. 5:22authentication, which allows you to
  170. 5:24authenticate into a remote device using
  171. 5:26a one-time code. But this also requires
  172. 5:28you to turn on a setting in your ChatGPT
  173. 5:30account, which is rather annoying and
  174. 5:32feels like a loss of trust. And that
  175. 5:33aside, if you just think about it, this
  176. 5:35is essentially giving away your ChatGPT
  177. 5:37account to some random third-party
  178. 5:38server, which I personally would never
  179. 5:41want to do. So, seems like we are at a
  180. 5:43dead end. [music] An external server is
  181. 5:44dangerous, and browser tabs can't
  182. 5:46interact with localhost unless we accept
  183. 5:48one trade-off. [music] Browser tabs
  184. 5:50can't interact with localhost. But, what
  185. 5:52about the browser itself? You see,
  186. 5:54browser extensions, which can tap into
  187. 5:56the capability of the browser itself,
  188. 5:57can open and thus read existing
  189. 6:00localhost websites. But, even an
  190. 6:01extension can't create a service that
  191. 6:03runs on a localhost 1455 to await
  192. 6:06credentials. However, what if we don't
  193. 6:08need to? You see, the purpose of that
  194. 6:10server is to capture credentials from a
  195. 6:11remote service locally. But, when OpenAI
  196. 6:14makes the request to localhost, that
  197. 6:16request itself already has the
  198. 6:17authentication data that we need.
  199. 6:19[music] So, all our extension has to do
  200. 6:20is to intercept that request and
  201. 6:22redirect the credentials back to the
  202. 6:23website that is trying to sign in,
  203. 6:25instead of ever having to deal with
  204. 6:27localhost directly. And with a
  205. 6:28completely open source and local browser
  206. 6:31extension, we can do this directly
  207. 6:32between your browser and OpenAI. No
  208. 6:34credentials leave your system during the
  209. 6:36sign-in flow, and no need to change any
  210. 6:38ChatGPT settings. And to make it easy,
  211. 6:40[music] the first time you use the
  212. 6:41sign-in flow, it takes you directly to
  213. 6:43the Chrome Web Store so that there is no
  214. 6:45friction. Now, we can store these
  215. 6:46credentials locally, encrypted in
  216. 6:47browser storage at rest, only used to
  217. 6:49make [music] API requests through the
  218. 6:51same bridge that we talked about minutes
  219. 6:52ago, completing the circuit. And just
  220. 6:54like that, we've just managed to
  221. 6:55authenticate an OpenAI account to make
  222. 6:57requests as if it were an API key. This
  223. 7:00is OpenAI's [music] billion-dollar
  224. 7:02button, and I just made it open source.
  225. 7:05Getting started is simple. With the set
  226. 7:07of OpenAI OAuth libraries, you can set
  227. 7:08up the sign-in button with just one
  228. 7:10React component and connect it to any
  229. 7:12OpenAI compatible SDK, like the Vercel
  230. 7:15AI SDK. My vision is that frontier
  231. 7:17intelligence is accessible to more
  232. 7:19people, [music] and not just in apps
  233. 7:20that the labs want you to use. With
  234. 7:22sign-in with ChatGPT, that is easier
  235. 7:25than ever. If you want to try it out, a
  236. 7:26demo sign-in with ChatGPT is available
  237. 7:28on Vercel at openai-oauth.vercel.app.
  238. 7:31[music] And you can always get started
  239. 7:32locally by just running MPX
  240. 7:34openai-oauth.
  241. 7:36Feel free to contribute or leave any
  242. 7:37feedback or issues at
  243. 7:38github.com/evanjodav/openai-oauth.
  244. 7:42If you integrate OpenAI OAuth into any
  245. 7:44apps, please share your creation on X
  246. 7:46and tag me @EvanJoeDev. I'd be happy to
  247. 7:48see what everyone is building. Usage of
  248. 7:50OpenAI OAuth is still subject to
  249. 7:52OpenAI's terms of use and other user
  250. 7:53agreements. I'll see you guys next time.
  251. 7:56Peace.

About this transcript

This page contains the full transcript of I Found OpenAI’s $3B Loophole by Evan Zhou, generated from the public captions YouTube serves with the video. The transcript has 1,641 words across 251 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.

What you can do with it

Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to translate the transcript into 100+ languages.

Free YouTube transcript tool

YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, translation to 100+ languages, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.