explaingit

zyf2007/chatapi

Analysis updated 2026-06-24

40PythonAudience · developerComplexity · 3/5Setup · moderate

TLDR

Self-hosted OpenAI-style chat API where a human operator types replies through a web console, useful for human-in-the-loop personas or mocking a real model during agent testing.

Mindmap

mindmap
  root((ChatAPI))
    Inputs
      OpenAI requests
      Anthropic requests
      Operator typing
    Outputs
      Streamed replies
      Auto-replies
      ntfy notifications
    Use Cases
      Mock LLM for tests
      Human persona bot
      Roleplay backend
    Tech Stack
      Flask
      React
      Vite
      SQLite
      uv
Click or tap to explore — scroll the page freely

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

Stand in for a paid LLM during agent development by typing replies through the web console.

USE CASE 2

Run a human-in-the-loop persona that answers chat traffic from OpenAI or Anthropic style clients.

USE CASE 3

Configure scheduled streamed responses and pattern-based auto-replies for unattended sessions.

USE CASE 4

Receive ntfy phone notifications when a new chat arrives so the operator can jump in.

What is it built with?

PythonFlaskReactViteAnt DesignSQLiteNginx

How does it compare?

zyf2007/chatapijun7799/scribe-transcriberbrown101010/codex-marketing-skills
Stars404040
LanguagePythonPythonPython
Setup difficultymoderatemoderatemoderate
Complexity3/53/52/5
Audiencedevelopergeneralwriter

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

How do you get it running?

Difficulty · moderate Time to first run · 1h+

Needs Python with uv, Node for the Vite build, a .env with admin creds, and optional Nginx plus TLS certs for production.

In plain English

This is a small Chinese-language self-hosted project that lets a real person sit on the other side of an OpenAI-style chat API. Other software thinks it is talking to an AI assistant, but the requests actually land in a web console where the operator types the replies by hand. The author also suggests using it as a mock language model for testing your own agent code without paying for a real model. The system has three parts: a Flask backend in Python, a React frontend built with Vite and Ant Design, and a SQLite file that stores users, sessions, and message history. Login uses a username and password set in a .env file, with optional TOTP for two-factor authentication. The same backend exposes three popular request shapes so most clients can connect without changes: /v1/chat/completions, /v1/responses, and Anthropic's /messages. Beyond manual replies, the web console can set automated behaviour. The operator can schedule streamed responses, send looping output, and configure conditional auto-replies that trigger on patterns in the incoming message. There is also optional ntfy push notification so the operator can hear about new chats on a phone. Deployment can go either through Nginx or be run directly from Flask. The frontend is built with npm install and npm run build, then served either by Nginx as static files or by Flask itself when the CHATAPI_WEB_DIST_DIR variable points at the dist folder. The backend is started with the uv tool: uv sync followed by uv run main.py. Common environment variables cover the listening host and port, the SQLite path, allowed CORS origins, optional TLS certificate files, and several optional email-sender configurations such as SMTP, Resend, Brevo, and Tencent Cloud SES. After login, the operator can manage the API key, the site title, the ntfy address, message rate limits, and TOTP inside a system-settings page rather than the .env file. The README shows a curl example that sends a streamed user message to /v1/responses against a model name written in Chinese, which is the project's character persona.

Copy-paste prompts

Prompt 1
Set up ChatAPI on a VPS with uv sync, build the React frontend, and serve it through Nginx with TLS.
Prompt 2
Point my OpenAI SDK client at ChatAPI's /v1/chat/completions and verify the streamed response shows up in the operator console.
Prompt 3
Configure ntfy push and a TOTP second factor in the ChatAPI system-settings page without editing the .env file.
Prompt 4
Write a pattern-based auto-reply rule in ChatAPI that fires on incoming messages containing a specific keyword.

Frequently asked questions

What is chatapi?

Self-hosted OpenAI-style chat API where a human operator types replies through a web console, useful for human-in-the-loop personas or mocking a real model during agent testing.

What language is chatapi written in?

Mainly Python. The stack also includes Python, Flask, React.

How hard is chatapi to set up?

Setup difficulty is rated moderate, with roughly 1h+ to a first successful run.

Who is chatapi for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.