ChatAPI  by zyf2007

API for human-AI interaction and agent mocking

Created 1 month ago
259 stars

Top 97.7% on SourcePulse

GitHubView on GitHub
Project Summary

Summary

This project offers a self-hostable API gateway emulating OpenAI's chat completion and Anthropic's Messages API formats. It enables users to act as AI assistants, integrate with diverse AI clients, or serve as a mock LLM for agent development, featuring a web console for configuration and request assembly.

How It Works

ChatAPI employs a Flask backend and a React/Vite/Ant Design frontend, leveraging SQLite for data persistence. It exposes OpenAI-compatible endpoints (/v1/chat/completions, /v1/responses) and an Anthropic-compatible /messages endpoint. Key functionalities include user authentication, session management, message history storage, and advanced features like assembling Tool Calling requests via its web UI and configuring automated, conditional, or time-based responses.

Quick Start & Requirements

  • Installation: Clone repo, build frontend (cd ./frontend && npm i && npm run build), configure .env (min: CHATAPI_USERNAME, CHATAPI_PASSWORD, CHATAPI_SESSION_SECRET), start backend (cd ./backend && uv sync && uv run main.py dev).
  • Prerequisites: Node.js (frontend build), Python (uv for backend), SQLite.
  • Configuration: Environment variables in .env manage credentials, secrets, database path, host, port, and optional TLS/email settings.
  • Docs: README serves as primary documentation.

Highlighted Details

  • Emulates OpenAI /v1/chat/completions, /v1/responses, and Anthropic /messages APIs.
  • Web console facilitates Tool Calling request assembly and automated/conditional reply rule configuration.
  • Supports user authentication (optional TOTP) and message persistence for debugging.
  • Optional ntfy integration for message push notifications.

Maintenance & Community

No specific details on maintainers, community channels, or roadmap were found in the provided text.

Licensing & Compatibility

The license type is not explicitly stated in the provided README content.

Limitations & Caveats

The ntfy message push feature presents a potential Server-Side Request Forgery (SSRF) risk if configured to access internal network addresses (127.0.0.1, localhost, internal IPs) without adequate trust; mitigation options are available via configuration settings (e.g., "Admin only" or "Closed"). Secure operation necessitates careful environment variable setup.

Health Check
Last Commit

1 day ago

Responsiveness

Inactive

Pull Requests (30d)
2
Issues (30d)
2
Star History
42 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.