--- title: DeepSeek Proxy emoji: 🚀 colorFrom: blue colorTo: purple sdk: docker app_port: 7860 --- # 🚀 DeepSeek Proxy for Hugging Face OpenAI-compatible proxy server for **DeepSeek web chat** — run it on Hugging Face Space for free, then connect VS Code/Cline for unlimited AI coding. --- ## ⚡ Quick Start (3 Steps) ### Step 1: Create HF Space 1. Go to [huggingface.co/spaces](https://huggingface.co/spaces) 2. Click **"Create new Space"** 3. Settings: - **Space name**: `deepseek-proxy` (or any name) - **SDK**: `Docker` - **Visibility**: `Private` ⚠️ (important for token security) - **Hardware**: `CPU free` 4. Click **"Create Space"** ### Step 2: Set Your Token 1. In your Space → **Settings** tab → **Secrets** 2. Add a secret: - **Name**: `DEEPSEEK_TOKEN` - **Value**: Your DeepSeek browser token **How to get your token:** 1. Open [chat.deepseek.com](https://chat.deepseek.com) in browser 2. Press `F12` → **Application** → **Cookies** → `chat.deepseek.com` 3. Find the token starting with `oxMs/...` (usually in `Authorization` or `auth-token`) 4. Copy and paste into HF Secrets > ⚠️ Token expires every ~7 days. Update it weekly. ### Step 3: Deploy Upload these files to your Space: - `app.py` - `Dockerfile` - `requirements.txt` Or use git: ```bash git clone https://huggingface.co/spaces/YOURNAME/deepseek-proxy cd deepseek-proxy # copy files here git add . git commit -m "deploy proxy" git push ``` Wait for the build (1-2 minutes), then check `https://YOURNAME-deepseek-proxy.hf.space/health` --- ## 🔌 VS Code / Cline Setup ### 1. Install Cline Extension - VS Code → Extensions → Search "Cline" → Install ### 2. Configure Cline Settings Open VS Code settings (`Ctrl+,`) and add: ```json { "cline.apiConfig": { "apiProvider": "openai-compatible", "openAiBaseUrl": "https://YOURNAME-deepseek-proxy.hf.space/v1", "openAiModelId": "deepseek-chat", "openAiApiKey": "hf-any-key" } } ``` Or use the **Cline Settings UI**: 1. Click Cline icon in sidebar 2. **Settings** → **API Provider**: `OpenAI Compatible` 3. **Base URL**: `https://YOURNAME-deepseek-proxy.hf.space/v1` 4. **Model ID**: `deepseek-chat` 5. **API Key**: `hf-any-key` (any value works, auth is via your HF Space) ### 3. Test Ask Cline: "What is 2+2?" — it should reply in ~5-10 seconds. --- ## 🧠 Available Models | Model | Use Case | |-------|----------| | `deepseek-chat` | Fast coding, general questions | | `deepseek-reasoner` | Deep thinking, debugging, complex logic | --- ## 🔧 Troubleshooting ### "Token not configured" error - Go to Space Settings → Secrets → make sure `DEEPSEEK_TOKEN` is set - Rebuild the Space (Factory Rebuild in Settings) ### "PoW rejected" or timeout - DeepSeek may have changed their PoW — check proxy logs in Space - Try getting a fresh token from browser ### Space goes to sleep - HF Spaces sleep after 48h of inactivity - Use [UptimeRobot](https://uptimerobot.com/) to ping `/health` every 30 minutes - Or use HF Space's "Permanent" upgrade ($5/month) ### Cline timeout errors - Increase Cline timeout: Cline Settings → Request Timeout → 120 seconds - The first request is slow (~20s) because of PoW solving - Subsequent requests are fast (PoW is cached for 5 minutes) --- ## 📡 API Endpoints | Endpoint | Description | |----------|-------------| | `GET /` | Status page | | `GET /health` | Health check (for UptimeRobot) | | `GET /v1/models` | List available models | | `POST /v1/chat/completions` | Chat completion (OpenAI format) | --- ## ⚠️ Disclaimer This uses DeepSeek's web chat via scraping. This is **not an official API**. - Personal use only - Token expires ~7 days - DeepSeek may block this approach at any time - Use at your own risk --- ## 🔗 Links - DeepSeek Web: [chat.deepseek.com](https://chat.deepseek.com) - Hugging Face: [huggingface.co/spaces](https://huggingface.co/spaces) - Cline Extension: [cline.bot](https://cline.bot) --- *Made for free AI coding. Enjoy! 🎉*