← all repositories
rgommezz/react-native-chatgpt

ChatGPT in your pocket, no server required

A React Native library that reverse-engineers ChatGPT's web auth so your app can talk directly to OpenAI's servers.

587 stars TypeScript Chat Assistants
react-native-chatgpt
Velocity · 7d
+0.5
★ / day
Trend
steady
star history

What it does

react-native-chatgpt wraps ChatGPT’s unofficial web API into a React Native hook and provider. It handles the full dance: popping a WebView modal for login, stashing JWT tokens in secure storage, streaming tokens back as they arrive, and threading conversationId/messageId to maintain context across messages. All from the client — no backend proxy needed.

The interesting bit

The library doesn’t use OpenAI’s official API at all. It piggybacks on ChatGPT’s web session, scraping the same endpoints the browser uses. That’s why it needs a WebView for auth and why tokens expire every 7 days — you’re essentially pretending to be the website. The streaming support mirrors the web playground’s Server-Sent Events behavior, accumulated token by token in a callback.

Key highlights

  • Zero backend: 100% client-side, though this also means 100% of OpenAI’s rate limits and ToS ambiguity land on your users
  • Streaming or batch: sendMessage has two signatures — Promise-based for full responses, callback-based for real-time token accumulation
  • Expo-friendly: works in managed workflow; bare apps need react-native-webview, vector-icons, and expo-secure-store
  • TypeScript throughout: hook returns a finite state machine of auth statuses (initializinglogged-outgetting_auth_tokenauthenticated)
  • Snack demo: runnable Expo Snack included to test drive before installing

Caveats

  • Unofficial and fragile: README explicitly calls it “experimental”; it’s reverse-engineered against web endpoints that can change without warning
  • Weekly re-auth: JWTs expire in 7 days, so users will see the login modal regularly
  • Rate limiting: 429 errors from OpenAI’s backend if users send too many messages; no retry logic built in

Verdict

Worth a look if you’re prototyping a mobile ChatGPT integration and want to skip backend setup entirely. Skip it if you need reliability, official API guarantees, or plan to ship to production without a migration path to OpenAI’s proper API.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.