A Django-based proxy router for DeepSeek with API keys dashboard and OpenAI-compatible interface. Create an account or setup locally to use.
- OpenAI-Compatible Interface: Fully drop-in compatible with standard OpenAI SDKs (Python, Node.js, and cURL).
- Unified Developer Dashboard:
- Secure API key generation, status toggling, and deletion.
- Real-time request volume analytics powered by ApexCharts.
- Clean API Request Logging (tracks latency, endpoints, status codes, and estimated tokens).
- Interactive Docs & Playground:
- Live JSON Request Body playground.
- Real-time client code snippet updates (Python, Node.js, and cURL) as you edit parameters.
- Prism.js syntax highlighting for all blocks.
- Session Threading: Maintains conversation context automatically across stateless API calls when a
session_idis supplied. - Models Support: Fully supports
deepseek-chatanddeepseek-reasoner(R1) with token-by-token streaming, reasoning processes, and web search configurations.
git clone https://github.com/izaart95-jpg/DeepRouter.git
cd DeepRouterpython -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txtCreate a .env file by copying the example template:
cp .env.example .envEdit .env to configure your SECRET_KEY and database settings.
For PostgreSQL / MySQL / other external databases, configure the split DB variables:
DB_ENGINE=django.db.backends.postgresql # or django.db.backends.mysql
DB_NAME=your_db_name
DB_USER=your_db_user
DB_PASSWORD=your_db_password
DB_HOST=your_db_host
DB_PORT=5432
# PostgreSQL SSL settings (optional)
DB_SSLMODE=requireIf these variables are omitted, DeepRouter will automatically fallback to SQLite.
Apply migrations to set up database schemas for keys and request logs:
python manage.py migrate
python manage.py runserverThe server will start at http://127.0.0.1:8000/.
To routing requests successfully, you must configure a valid DeepSeek account token:
- Create a Django Superuser:
python manage.py createsuperuser
- Access the Django Admin:
Navigate to
http://127.0.0.1:8000/admin/and log in with the superuser credentials. - Obtain your DeepSeek Token:
- Go to chat.deepseek.com and log in.
- Open browser DevTools (
F12or right-click ->Inspect), then select the Console tab. - Run the following code snippet and copy the returned string value:
JSON.parse(localStorage.getItem("userToken")).value
- Register the Token:
- In the Django Admin, go to Deep seek tokens -> Add deep seek token.
- Paste the copied token value into the form field, ensure Is active is checked, and click Save.
The router endpoints are accessible at http://127.0.0.1:8000/api/v1.
Headers:
Content-Type: application/jsonAuthorization: Bearer ds-live-YOUR_API_KEY(Generate this from your dashboard keys tab)
Request Parameters:
model(string, required):deepseek-chatordeepseek-reasoner.messages(array, required): Array of message objects (role & content).stream(boolean, optional): Set totrueto enable SSE streaming.session_id(string, optional): A unique session ID to enable stateful conversation history tracking.thinking(boolean, optional): Toggle model reasoning processes where supported.search(boolean, optional): Toggle web search integration.