whatisgithub

What is chat2api?

lanqian528/chat2api — explained in plain English

Analysis updated 2026-05-18

3,619PythonAudience · developerComplexity · 3/5LicenseSetup · moderate

In one sentence

Chat2API lets you call ChatGPT's website using the same request format as the official OpenAI API, without needing an OpenAI API key.

Mindmap

mindmap
  root((Chat2API))
    What it does
      OpenAI API format
      Talks to ChatGPT web
    Tech stack
      Python
      Docker
    Use cases
      Use ChatGPT via API clients
      Self hosted gateway
      Token rotation
    Audience
      Developers
      Self hosters

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Point an existing OpenAI API client at ChatGPT's website without buying API credits.

USE CASE 2

Run a self-hosted gateway that lets others log in and use ChatGPT through your own domain.

USE CASE 3

Rotate multiple ChatGPT account tokens automatically for more reliable access.

What is it built with?

PythonDockerDocker Compose

How does it compare?

lanqian528/chat2apiderv82/wifitekennethreitz/responder
Stars3,6193,6193,619
LanguagePythonPythonPython
Setup difficultymoderatehardeasy
Complexity3/54/52/5
Audiencedeveloperops devopsdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 30min

Needs a ChatGPT AccessToken for GPT-4 and newer models, GPT-3.5 works without login.

MIT license: use freely for any purpose, including commercial use, as long as you keep the copyright notice.

So what is it?

Chat2API is a Python service that sits between your code and ChatGPT's website. It translates calls made in the standard format used by the official OpenAI API into requests against the ChatGPT web interface, then returns the responses in that same standard format. The practical effect is that any program or tool already built to talk to the OpenAI API can be pointed at this service instead and use ChatGPT's website under the hood. For GPT-3.5, no login is required at all. For GPT-4, GPT-4o, and the reasoning models (O1, O3-mini, and their variants), you supply an access token from your own ChatGPT account. The README notes you can get this token by logging into chatgpt.com and visiting a specific session URL. You can add multiple tokens and the service will rotate through them automatically, retrying with the next token if one fails. Deployment options include running the Python script directly, using a Docker container, or using Docker Compose. A one-click deploy option for the Zeabur hosting platform is also provided. The service listens on port 5005 by default and exposes the standard /v1/chat/completions endpoint. A gateway mode can be enabled that proxies the actual ChatGPT web interface, allowing users to log in and use it through your domain. The README includes a table of environment variables for configuring things like authentication keys, proxy addresses, whether to save conversation history, and how aggressively to retry failed requests. The README is written primarily in Chinese, with configuration tables and feature lists making up most of the content. The project is licensed under MIT.

Copy-paste prompts

Prompt 1
Show me how to deploy chat2api with Docker Compose and connect it to my OpenAI-compatible client.
Prompt 2
Explain how to get an AccessToken from chatgpt.com to use with chat2api.
Prompt 3
Write a curl request to chat2api's /v1/chat/completions endpoint using a Bearer token.
Prompt 4
Help me configure multiple AUTHORIZATION tokens so chat2api rotates between accounts on failure.

Frequently asked questions

What is chat2api?

Chat2API lets you call ChatGPT's website using the same request format as the official OpenAI API, without needing an OpenAI API key.

What language is chat2api written in?

Mainly Python. The stack also includes Python, Docker, Docker Compose.

What license does chat2api use?

MIT license: use freely for any purpose, including commercial use, as long as you keep the copyright notice.

How hard is chat2api to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is chat2api for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.