3,701 prompts from top AI collections
← Back to Market
[LIVE] [dhodhoo/universal-router] 3 endpoint(s)
ChatGPT API Proxy/ChatGPT
2,187 characters
Status: [LIVE] Endpoints found: https://api.b.ai/v1/chat/completions https://api.b.ai/v1/chat https://api.b.ai/v1/chat/completions` Source: https://github.com/dhodhoo/universal-router --- # Universal AI Router Proxy An OpenAI-compatible API proxy built with **FastAPI** and **Uvicorn**. It serves as a gateway to secure internal keys, map client public keys, enforce specific model targets, and fully support real-time data streaming (Server-Sent Events). --- ## 🚀 Key Features * **OpenAI-Compatible Endpoints**: Provides standard OpenAI endpoints like `/v1/models` and `/v1/chat/completions`. * **Credential Isolation**: Uses `PUBLIC_API_KEY` for external client authentication while hiding your confidential `INTERNAL_9ROUTER_KEY`. * **Model Enforcement**: Automatically overrides or forces incoming requests to use a designated target model (`TARGET_MODEL`). * **Full Streaming Support**: Seamlessly handles text/event-stream responses as well as standard JSON responses using `httpx.AsyncClient`. --- ## 📦 Prerequisites & Installation Make sure you have **Python** installed on your system, then install the required dependencies: ```bash pip install fastapi uvicorn httpx ``` --- ## ⚙️ Configuration The main configuration variables are located at the top of your main script (`main.py`): | Variable | Description | | --- | --- | | `ROUTER_URL` | The upstream target endpoint (e.g., `https://api.b.ai/v1/chat/completions`) | | `TARGET_MODEL` | The model enforced for all requests (e.g., `bai/deepseek-v4-flash`) | | `INTERNAL_9ROUTER_KEY` | The secret API key used for upstream authentication | | `PUBLIC_API_KEY` | The API key distributed to clients or users | --- ## 💻 Running the Application Locally Run the server using **Uvicorn** (with `--reload` enabled for development convenience): ```bash uvicorn main:app --host 0.0.0.0 --port 8000 --reload ``` The server will be up and running locally at `http://localhost:8000`. --- ## 🌐 Exposing Publicly via Cloudflare Tunnel To make your local proxy accessible over the public internet with free SSL/TLS protection without port forwarding, you can use **Cloudflare Tunnel (`cloudflared`)**
Download .txt