Skip to content

Chat2API is a native desktop application that provides an OpenAI-compatible API for multiple AI service providers. It allows you to use any OpenAI-compatible client with DeepSeek, GLM, Kimi, MiniMax, Qwen, Z.ai and more across macOS, Windows, and Linux.

License

Notifications You must be signed in to change notification settings

xiaoY233/Chat2API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

19 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Chat2API

Chat2API Logo

Release License
Electron React TypeScript Platform

δΈ­ζ–‡ζ–‡ζ‘£

Multi-platform AI Service Unified Management Tool

Chat2API is a native desktop application that provides an OpenAI-compatible API for multiple AI service providers. It allows you to use any OpenAI-compatible client with DeepSeek, GLM, Kimi, MiniMax, Qwen, Z.ai and more across macOS, Windows, and Linux.

✨ Features

  • OpenAI Compatible API: Provides standard OpenAI-compatible API endpoints for seamless integration
  • πŸ”§ Function Calling Support: Full Function Calling capability via Prompt Engineering for all providers
  • Multi-Provider Support: Connect DeepSeek, GLM, Kimi, MiniMax, Qwen, Z.ai and more
  • Dashboard Monitoring: Real-time request traffic, token usage, and success rates
  • API Key Management: Generate and manage keys for your local proxy
  • Model Management: View and manage available models from all providers
  • Request Logs: Detailed request logging for debugging and analysis
  • Proxy Configuration: Flexible proxy settings and routing strategies
  • System Tray Integration: Quick access to status from menu bar
  • Multilingual: English and Simplified Chinese support
  • Modern UI: Clean, responsive interface with dark/light theme support

πŸ”§ Function Calling

Chat2API implements full Function Calling capability through Prompt Engineering and Stream Parsing, enabling tool use for all supported models without relying on native Function Calling APIs.

How It Works

  1. Protocol Definition: Design a text protocol that models can easily understand and parse

    [function_calls]
    [call:tool_name]{"argument": "value"}[/call]
    [/function_calls]
    
  2. Prompt Injection: Convert OpenAI-format tools definitions into System Prompt

  3. Output Interception: Real-time interception of protocol text during streaming

  4. Format Restoration: Extract protocol content and wrap as OpenAI-format tool_calls

Usage

from openai import OpenAI

client = OpenAI(
    api_key="your-api-key",
    base_url="http://localhost:8080/v1"
)

# Define tools
tools = [{
    "type": "function",
    "function": {
        "name": "get_weather",
        "description": "Get current weather",
        "parameters": {
            "type": "object",
            "properties": {
                "location": {"type": "string", "description": "City name"}
            },
            "required": ["location"]
        }
    }
}]

# Call model
response = client.chat.completions.create(
    model="deepseek-chat",
    messages=[{"role": "user", "content": "What's the weather in Beijing?"}],
    tools=tools
)

# Handle tool calls
if response.choices[0].message.tool_calls:
    for tool_call in response.choices[0].message.tool_calls:
        print(f"Tool: {tool_call.function.name}")
        print(f"Args: {tool_call.function.arguments}")

πŸ€– Supported Providers

Provider Auth Type OAuth Models
DeepSeek User Token Yes DeepSeek-V3.2
GLM Refresh Token Yes GLM-5
Kimi JWT Token Yes kimi-k2.5
MiniMax JWT Token Yes MiniMax-M2.5
Qwen (CN) SSO Ticket Yes Qwen3.5-Plus, Qwen3-Max, Qwen3-Flash, Qwen3-Coder, qwen-max-latest
Qwen AI (Global) JWT Token Yes Qwen3.5-Plus, Qwen3-Max, Qwen3-VL-Plus, Qwen3-Coder-Plus, Qwen-Plus, Qwen-Turbo
Z.ai JWT Token Yes GLM-5, GLM-4.7, GLM-4.6V, GLM-4.6

πŸ“₯ Installation

Download

Download the latest release from GitHub Releases:

Platform Download
macOS (Apple Silicon) Chat2API-x.x.x-arm64.dmg
macOS (Intel) Chat2API-x.x.x-x64.dmg
Windows Chat2API-x.x.x-x64-setup.exe
Linux Chat2API-x.x.x-x64.AppImage or .deb

Build from Source

Requirements:

  • Node.js 18+
  • npm
  • Git
# Clone the repository
git clone https://github.com/xiaoY233/Chat2API.git
cd Chat2API

# Install dependencies
npm install

# Start development server
npx electron-vite dev 2>&1

Build for Production

npm run build              # Build the application
npm run build:mac          # Build for macOS (dmg, zip)
npm run build:win          # Build for Windows (nsis)
npm run build:linux        # Build for Linux (AppImage, deb)
npm run build:all          # Build for all platforms

πŸ“– Usage

1. Start the Application

Launch Chat2API and configure your preferred settings.

2. Add Providers

Go to Providers tab β†’ Add a provider β†’ Enter API key or authenticate via OAuth.

3. Configure Proxy

Go to Proxy Settings tab β†’ Configure port and routing strategy β†’ Start the proxy server.

4. Manage API Keys

Go to API Keys tab β†’ Generate keys for accessing your local proxy.

5. Monitor Usage

  • Dashboard: Overall health and traffic statistics
  • Models: View available models from all providers
  • Logs: Request logs for debugging

πŸ“Έ Screenshots

Dashboard Providers
Dashboard Providers
Proxy Settings API Keys
Proxy API Keys
Models Logs
Models Logs
Settings About
Settings About

βš™οΈ Settings

  • Port: Change the proxy listening port (default: 8080)
  • Routing Strategy: Round Robin or Fill First
  • Auto-start: Launch proxy automatically on app startup
  • Theme: Light, Dark, or System preference
  • Language: English or Simplified Chinese

πŸ—οΈ Architecture

Chat2API/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main/                    # Electron main process
β”‚   β”‚   β”œβ”€β”€ index.ts            # App entry point
β”‚   β”‚   β”œβ”€β”€ tray.ts             # System tray integration
β”‚   β”‚   β”œβ”€β”€ proxy/              # Proxy server management
β”‚   β”‚   β”œβ”€β”€ ipc/                # IPC handlers
β”‚   β”‚   └── utils/              # Utilities
β”‚   β”œβ”€β”€ preload/                # Context bridge
β”‚   └── renderer/               # React frontend
β”‚       β”œβ”€β”€ components/         # UI components
β”‚       β”œβ”€β”€ pages/              # Page components
β”‚       β”œβ”€β”€ stores/             # Zustand state
β”‚       └── hooks/              # Custom hooks
β”œβ”€β”€ build/                      # Build resources
└── scripts/                    # Build scripts

πŸ”§ Tech Stack

Component Technology
Framework Electron 33+
Frontend React 18 + TypeScript
Styling Tailwind CSS
State Zustand
Build Vite + electron-vite
Packaging electron-builder
Server Koa

πŸ“ Data Storage

Application data is stored in ~/.chat2api/ directory:

  • config.json - Application configuration
  • providers.json - Provider settings
  • accounts.json - Account credentials (encrypted)
  • logs/ - Request logs

❓ FAQ

macOS: "App is damaged and can't be opened"

Due to macOS security mechanisms, apps downloaded outside the App Store may trigger this warning. Run the following command to fix it:

sudo xattr -rd com.apple.quarantine "/Applications/Chat2API.app"

How to update?

Check for updates in the About page, or download the latest version from GitHub Releases.

🀝 Contributing

  1. Fork the project
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

GNU General Public License v3.0. See LICENSE for details.

This means:

  • βœ… Free to use, modify, and distribute
  • βœ… Derivative works must be open-sourced under the same license
  • βœ… Must preserve original copyright notices

πŸ™ Acknowledgments

About

Chat2API is a native desktop application that provides an OpenAI-compatible API for multiple AI service providers. It allows you to use any OpenAI-compatible client with DeepSeek, GLM, Kimi, MiniMax, Qwen, Z.ai and more across macOS, Windows, and Linux.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages