3,671 prompts from top AI collections
← Back to Market
[UNTESTED] [xuerzong/mas] 1 endpoint(s)
ChatGPT API Proxy/ChatGPT
2,118 characters
Status: [UNTESTED] Endpoints found: http://localhost:8000/chat/completions Source: https://github.com/xuerzong/mas # MAS (Model Auto Switch) [English](./README.md) | [δΈ­ζ–‡](./README.zh.md) OpenAI-compatible API proxy service that intelligently routes requests to multiple upstream providers based on content conditions. ## What is this? MAS is a lightweight Node.js + TypeScript server that receives OpenAI-compatible chat completion requests, automatically selects the best model based on configured conditions, and proxies the request to the upstream API. **Key Features**: - **Smart Model Selection**: Intelligently select the most suitable model based on message content - **OpenAI Compatible**: Drop-in replacement for OpenAI's `/chat/completions` endpoint - **Service Management CLI**: `mas start/stop/status/restart/config` commands - **Streaming Support**: Support both streaming and non-streaming responses ## How to Use ### Installation ```bash npm config set registry https://registry.npmmirror.com npm install -g mas ``` If you publish internally, use your own registry and install with the same command. ### Start the Service ```bash mas start # Start service (default port 8000) mas status # Check service status mas stop # Stop service mas restart # Restart service ``` For local development with hot reload: ```bash npm install npm run dev ``` For local build: ```bash npm run build ``` ### Call the API **Health Check**: ```bash curl http://localhost:8000/health ``` **Chat Completion** (auto model selection): ```bash curl -X POST http://localhost:8000/chat/completions \ -H "Content-Type: application/json" \ -d '{ "model": "auto", "messages": [{"role": "user", "content": "Write a quicksort function"}], "stream": false }' ``` **Streaming**: ```bash curl -X POST http://localhost:8000/chat/completions \ -H "Content-Type: application/json" \ -d '{ "model": "auto", "messages": [{"role": "user", "content": "Hello"}], "stream": true }' ``` ## Configuration Edit `~/.mas/config.json` (auto-created on
Download .txt