Show HN: Sign in with your ChatGPT account for free AI

EvanZhouDev1 pts1 comments

OpenAI OAuth<br>1Add sign in<br>Let users connect their ChatGPT account.

"use client";

import { SignInWithChatGPT } from "@openai-oauth/react";

export default function App() {<br>return />;

Try it out<br>Works across free and paid plans.<br>OpenAISign in with ChatGPTCredentials are encrypted and<br>stored locally in this browser.

2Make a request<br>Use the AI SDK with the signed-in account.

app.tsxapp/api/chat/route.ts<br>"use client";

import { useCompletion } from "@ai-sdk/react";<br>import { openaiAuthHeaders } from "@openai-oauth/react";

const { completion, complete } = useCompletion({<br>api: "/api/chat",<br>streamProtocol: "text",<br>});

await complete("Hello!", {<br>headers: await openaiAuthHeaders(),<br>});

Ask anything↑

Build with OpenAI OAuth<br>Add Sign in with ChatGPT to your product, start a<br>dev proxy, or connect through the TypeScript SDK.<br>Go to Documentation

openai oauth sign chatgpt account import

Related Articles