Skip to content

joganubaid/deepseek-proxy

Repository files navigation

DeepSeek API Reverse Proxy 🚀

An enterprise-grade, local Reverse Proxy server that exposes the DeepSeek Chat Web UI as a strictly compliant standard OpenAI/OpenRouter REST API endpoint.

This project orchestrates a hidden Microsoft Edge browser using Playwright to securely solve DeepSeek's Cryptographic WebAssembly Proof-of-Work headers natively. It allows you to use DeepSeek entirely for free inside Cursor, VSCode Extensions, or any standard AI chat client!

Features ✨

  • 100% Free & Unlimited: Uses your actual browser session to interact with the UI.
  • OpenAI Compatible: Exposes exactly the /v1/chat/completions schema so drop-in replacement works anywhere.
  • Smart Stream AI Detection: No hardcoded waits! Actively monitors the Live DOM for text-generation stability length mapping. Supports 5-paragraph essays seamlessly.
  • Anti-Bot Stealth: Automatically deletes navigator.webdriver execution flags to inherently bypass Google authentication blocks.
  • Persistent Sessions: Safely shuts down on SIGINT so your login cookies are securely flushed to your local hard drive.

Prerequisites

  • Node.js installed
  • Microsoft Edge installed (used by default to bypass strict bot filters).

Quick Start 🚀

1. Installation

Clone this repository and install the dependencies: ```bash git clone https://github.com/your-username/deepseek-proxy.git cd deepseek-proxy

npm install ```

2. Configure Environment

Create a `.env` file in the root directory: ```env PORT=3000 PLAYWRIGHT_HEADLESS=false PLAYWRIGHT_CHANNEL=msedge ``` (Tip: Keeping `headless=false` initially helps you log into DeepSeek securely. Once logged in, you can set it to `true` to run silently!)

3. Run the Proxy Server

```bash node server.js ``` (On the very first launch, the Playwright window will open. Please log into Google/DeepSeek manually. The server will keep this session saved forever!)

4. Test the API 🧪

You can now point any script, Extension, or App to http://localhost:3000/v1 just as if it were OpenAI.

Example cURL: ```bash curl -X POST http://localhost:3000/v1/chat/completions \ -H "Content-Type: application/json" \ -d '{ "model": "deepseek-web", "messages": [ { "role": "user", "content": "Write a 3-word poem." } ] }' ```

Architecture & Logic

  1. Request hits Express chatController.js.
  2. The prompt translates into UI clicks pushed perfectly to a queued BrowserManager.js Singleton.
  3. Edge natively solves the x-ds-pow-response requirement in the background.
  4. Smart Poller scans for .ds-markdown DOM changes until consecutive text-length stabilization.
  5. DOM Text scraped -> JSON formatted -> Response returned cleanly.

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors