Access OpenAI’s ChatGPT through browser automation.
⚠️ This provider uses browser automation to interact with ChatGPT. No public API routes are available. You don’t to be logged into ChatGPT in your browser.
| Type | URL |
|---|---|
| Local API | http://localhost:8080/api/OpenaiChat |
Model selection is automatic based on your ChatGPT subscription:
from g4f.client import Client
from g4f.Provider import OpenaiChat
# No API key needed - uses browser authentication
client = Client(provider=OpenaiChat)
response = client.chat.completions.create(
model="", # Model auto-selected
messages=[
{"role": "user", "content": "Hello, how are you?"}
],
)
print(response.choices[0].message.content)
import { Client } from '@gpt4free/g4f.dev';
const client = new Client({ baseUrl: 'http://localhost:8080/api/OpenaiChat' });
const response = await client.chat.completions.create({
model: "",
messages: [
{ role: "user", content: "Hello, how are you?" }
],
});
console.log(response.choices[0].message.content);