Launching today: let your users bring the AI subscription they already pay for

by

Every AI app I've built ended up with the same screen. Paste your API key, we'll store it. I never liked shipping that, and users don't love it either.

So I built ai-oauth-sdk. It lets someone sign in with the AI plan they already pay for, using the providers' real OAuth flows, the same ones their official CLIs use. The token stays on their device, so you never hold a key and you never pay for their inference.

Eight providers today: ChatGPT, Claude, Gemini, Grok, Copilot, Qwen, OpenRouter and Azure. Zero dependencies in the core package, MIT, and it runs in Node, the browser, React Native and the usual frameworks.

The OAuth was the easy half. What took the time was the things nobody documents. OpenAI's CLI client id is registered for one exact port, localhost:1455, and if it's busy the flow just fails with nothing useful in the error. Cross-Origin-Opener-Policy: same-origin quietly severs window.opener, so a popup callback completes and the parent never hears about it. Google validates redirect_uri strictly enough that a hosted callback is rejected outright, so the loopback URL has to be copied back by hand.

There's a where you can sign in with your own account and chat. The and are both public, and .

Happy to go into any of the provider quirks, that's most of what the repo is. And if you've hit the same walls, I'd like to hear how you got around them.

2 views

Add a comment

Replies

Be the first to comment