1 line
13 KiB
JSON
1 line
13 KiB
JSON
{"repo": "agsq11/claude-code-proxy", "files": {"deepseek-chat-proxy/README.md": {"1fb926a341a28cdd8d5e1adb3189fcd92dc8f600": {"t": 1785746511.4574366, "n": 6091, "h": "858539abc9791de7", "c": "# DeepSeek Chat Proxy\n\nAn OpenAI-compatible API wrapper for [chat.deepseek.com](https://chat.deepseek.com), allowing you to use DeepSeek's free chat interface through any OpenAI-compatible client.\n\n## Features\n\n- ✅ OpenAI-compatible `/v1/chat/completions` endpoint\n- ✅ Streaming and non-streaming responses\n- ✅ Free access to DeepSeek chat models\n- ✅ Simple authentication via browser token\n- ✅ No official API key required\n\n## Quick Start\n\n### 1. Get Your Auth Token\n\n1. Go to https://chat.deepseek.com and log in\n2. Open DevTools (Press `F12` or right-click → Inspect)\n3. Navigate to: **Application** → **Local Storage** → **chat.deepseek.com**\n4. Find the `userToken` key\n5. Copy its value (long string starting with your email/ID)\n\n### 2. Install Dependencies\n\n```bash\ncd deepseek-chat-proxy\npip install -r requirements.txt\n```\n\n### 3. Configure\n\n```bash\ncp .env.example .env\n# Edit .env and paste your userToken\n```\n\nYour `.env` should look like:\n```env\nDEEPSEEK_AUTH_TOKEN=\"your_actual_token_here\"\nAPI_KEY=\"sk-deepseek-proxy\"\nPORT=\"8090\"\n```\n\n### 4. Run the Proxy\n\n```bash\npython main.py\n```\n\nThe proxy will start on `http://localhost:8090`\n\n## Usage\n\n### With claude-code-proxy\n\nAdd to your `claude-code-proxy/.env`:\n\n```bash\n# Use DeepSeek for middle tier\nMIDDLE_MODEL=\"deepseek-chat\"\nMIDDLE_MODEL_API_KEY=\"sk-deepseek-proxy\"\nMIDDLE_MODEL_BASE_URL=\"http://localhost:8090/v1\"\n```\n\n### With OpenAI Python SDK\n\n```python\nfrom openai import OpenAI\n\nclient = OpenAI(\n api_key=\"sk-deepseek-proxy\",\n base_url=\"http://localhost:8090/v1\"\n)\n\nresponse = client.chat.completions.create(\n model=\"deepseek-chat\",\n messages=[\n {\"role\": \"user\", \"content\": \"Hello!\"}\n ],\n stream=True\n)\n\nfor chunk in response:\n if chunk.choices[0].delta.content:\n print(chunk.choices[0].delta.content, end=\"\")\n```\n\n### With curl\n\n```bash\ncurl -X POST http://localhost:8090/v1/chat/completions \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer sk-deepseek-proxy\" \\\n -d '{\n \"model\": \"deepseek-chat\",\n \"messages\": [{\"role\": \"user\", \"content\": \"Hello!\"}],\n \"stream\": true\n }'\n```\n\n## Available Models\n\n- `deepseek-chat` - General chat model\n- `deepseek-coder` - Coding-focused model\n\n## API Endpoints\n\n- `POST /v1/chat/completions` - Chat completions (OpenAI-compatible)\n- `GET /v1/models` - List available models\n- `GET /health` - Health check\n- `GET /` - API information\n\n## Configuration\n\n### Environment Variables\n\n| Variable | Required | Default | Description |\n|----------|----------|---------|-------------|\n| `DEEPSEEK_AUTH_TOKEN` | **Yes** | - | Your userToken from chat.deepseek.com localStorage |\n| `API_KEY` | No | `sk-deepseek-proxy` | API key for client authentication |\n| `PORT` | No | `8090` | Server port |\n\n## How It Works\n\nThis proxy:\n1. Accepts OpenAI-formatted requests\n2. Authenticates with chat.deepseek.com using your browser token\n3. Creates a chat session\n4. Streams responses back in OpenAI SSE format\n5. Handles token refresh and session management\n\n## Important Notes\n\n### Token Expiration\n\nYour `DEEPSEEK_AUTH_TOKEN` may expire after some time. If you get authentication errors:\n1. Log out and log back into chat.deepseek.com\n2. Get a fresh `userToken` from localStorage\n3. Update your `.env` file\n\n### Rate Limits\n\nDeepSeek's chat interface may have rate limits. If you encounter limits:\n- Wait a few minutes between requests\n- Consider using multiple accounts (not recommended)\n- Upgrade to DeepSeek's official API for production use\n\n### Legal Disclaimer\n\n⚠️ **Use at your own risk**\n\nThis is a reverse-engineered proxy for educational purposes. It may:\n- Violate DeepSeek's Terms of Service\n- Stop working if DeepSeek changes their API\n- Result in account suspension\n\nFor production use, consider:\n- DeepSeek's official API: https://platform.deepseek.com/\n- OpenRouter: https://openrouter.ai/deepseek/deepseek-chat (has free tier)\n\n## Troubleshooting\n\n### \"DeepSeek client not configured\"\n- Make sure `DEEPSEEK_AUTH_TOKEN` is set in `.env`\n- Verify the token is correct (copy from browser localStorage)\n\n### \"Invalid auth token\" (401 error)\n- Your token has expired - get a fresh one from chat.deepseek.com\n- Make sure you copied the entire token value\n\n### \"Rate limit exceeded\" (429 error)\n- You're sending too many requests\n- Wait a few minutes before trying again\n\n### No response / Timeout\n- DeepSeek servers may be down or slow\n- Try again later\n- Check https://chat.deepseek.com is accessible\n\n## Development\n\n### Project Structure\n\n```\ndeepseek-chat-proxy/\n├── main.py # FastAPI server\n├── requirements.txt # Python dependencies\n├── .env.example # Environment template\n└── README.md # This file\n```\n\n### Testing\n\n```bash\n# Test health endpoint\ncurl http://localhost:8090/health\n\n# Test chat completion\ncurl -X POST http://localhost:8090/v1/chat/completions \\\n -H \"Content-Type: application/json\" \\\n -d '{\"model\": \"deepseek-chat\", \"messages\": [{\"role\": \"user\", \"content\": \"Hi\"}]}'\n```\n\n## Comparison with Official API\n\n| Feature | This Proxy (Free) | Official API (Paid) |\n|---------|------------------|-------------------|\n| Cost | Free | $0.14/1M tokens |\n| Rate Limits | Browser limits | API tier limits |\n| Reliability | Depends on chat.deepseek.com | Production SLA |\n| Features | Basic chat | Full API features |\n| ToS Compliance | ⚠️ Unclear | ✅ Official |\n\n## Alternative Solutions\n\n1. **DeepSeek Official API** - https://platform.deepseek.com/\n - Cheap ($0.14/1M tokens)\n - Official, reliable\n - Full features\n\n2. **OpenRouter** - https://openrouter.ai/deepseek/deepseek-chat\n - Free tier: 50 messages/day\n - $10 credit: 1,000 messages/day\n - OpenAI-compatible\n\n3. **Together.ai** - https://together.ai\n - DeepSeek models available\n - Free tier + paid plans\n\n## License\n\nThis project is for educational purposes only. Use at your own risk.\n\n## Credits\n\nInspired by:\n- [xtekky/deepseek4free](https://github.com/xtekky/deepseek4free) - Reverse-engineered DeepSeek API\n- [qwen-code-oai-proxy](https://github.com/aptdnfapt/qwen-code-oai-proxy) - Similar proxy for Qwen\n"}, "73017192a06a235ce1f5ba9a1a3bcce4a80d5068": {"t": 1785765095.8303933, "n": 6091, "h": "858539abc9791de7", "c": "# DeepSeek Chat Proxy\n\nAn OpenAI-compatible API wrapper for [chat.deepseek.com](https://chat.deepseek.com), allowing you to use DeepSeek's free chat interface through any OpenAI-compatible client.\n\n## Features\n\n- ✅ OpenAI-compatible `/v1/chat/completions` endpoint\n- ✅ Streaming and non-streaming responses\n- ✅ Free access to DeepSeek chat models\n- ✅ Simple authentication via browser token\n- ✅ No official API key required\n\n## Quick Start\n\n### 1. Get Your Auth Token\n\n1. Go to https://chat.deepseek.com and log in\n2. Open DevTools (Press `F12` or right-click → Inspect)\n3. Navigate to: **Application** → **Local Storage** → **chat.deepseek.com**\n4. Find the `userToken` key\n5. Copy its value (long string starting with your email/ID)\n\n### 2. Install Dependencies\n\n```bash\ncd deepseek-chat-proxy\npip install -r requirements.txt\n```\n\n### 3. Configure\n\n```bash\ncp .env.example .env\n# Edit .env and paste your userToken\n```\n\nYour `.env` should look like:\n```env\nDEEPSEEK_AUTH_TOKEN=\"your_actual_token_here\"\nAPI_KEY=\"sk-deepseek-proxy\"\nPORT=\"8090\"\n```\n\n### 4. Run the Proxy\n\n```bash\npython main.py\n```\n\nThe proxy will start on `http://localhost:8090`\n\n## Usage\n\n### With claude-code-proxy\n\nAdd to your `claude-code-proxy/.env`:\n\n```bash\n# Use DeepSeek for middle tier\nMIDDLE_MODEL=\"deepseek-chat\"\nMIDDLE_MODEL_API_KEY=\"sk-deepseek-proxy\"\nMIDDLE_MODEL_BASE_URL=\"http://localhost:8090/v1\"\n```\n\n### With OpenAI Python SDK\n\n```python\nfrom openai import OpenAI\n\nclient = OpenAI(\n api_key=\"sk-deepseek-proxy\",\n base_url=\"http://localhost:8090/v1\"\n)\n\nresponse = client.chat.completions.create(\n model=\"deepseek-chat\",\n messages=[\n {\"role\": \"user\", \"content\": \"Hello!\"}\n ],\n stream=True\n)\n\nfor chunk in response:\n if chunk.choices[0].delta.content:\n print(chunk.choices[0].delta.content, end=\"\")\n```\n\n### With curl\n\n```bash\ncurl -X POST http://localhost:8090/v1/chat/completions \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer sk-deepseek-proxy\" \\\n -d '{\n \"model\": \"deepseek-chat\",\n \"messages\": [{\"role\": \"user\", \"content\": \"Hello!\"}],\n \"stream\": true\n }'\n```\n\n## Available Models\n\n- `deepseek-chat` - General chat model\n- `deepseek-coder` - Coding-focused model\n\n## API Endpoints\n\n- `POST /v1/chat/completions` - Chat completions (OpenAI-compatible)\n- `GET /v1/models` - List available models\n- `GET /health` - Health check\n- `GET /` - API information\n\n## Configuration\n\n### Environment Variables\n\n| Variable | Required | Default | Description |\n|----------|----------|---------|-------------|\n| `DEEPSEEK_AUTH_TOKEN` | **Yes** | - | Your userToken from chat.deepseek.com localStorage |\n| `API_KEY` | No | `sk-deepseek-proxy` | API key for client authentication |\n| `PORT` | No | `8090` | Server port |\n\n## How It Works\n\nThis proxy:\n1. Accepts OpenAI-formatted requests\n2. Authenticates with chat.deepseek.com using your browser token\n3. Creates a chat session\n4. Streams responses back in OpenAI SSE format\n5. Handles token refresh and session management\n\n## Important Notes\n\n### Token Expiration\n\nYour `DEEPSEEK_AUTH_TOKEN` may expire after some time. If you get authentication errors:\n1. Log out and log back into chat.deepseek.com\n2. Get a fresh `userToken` from localStorage\n3. Update your `.env` file\n\n### Rate Limits\n\nDeepSeek's chat interface may have rate limits. If you encounter limits:\n- Wait a few minutes between requests\n- Consider using multiple accounts (not recommended)\n- Upgrade to DeepSeek's official API for production use\n\n### Legal Disclaimer\n\n⚠️ **Use at your own risk**\n\nThis is a reverse-engineered proxy for educational purposes. It may:\n- Violate DeepSeek's Terms of Service\n- Stop working if DeepSeek changes their API\n- Result in account suspension\n\nFor production use, consider:\n- DeepSeek's official API: https://platform.deepseek.com/\n- OpenRouter: https://openrouter.ai/deepseek/deepseek-chat (has free tier)\n\n## Troubleshooting\n\n### \"DeepSeek client not configured\"\n- Make sure `DEEPSEEK_AUTH_TOKEN` is set in `.env`\n- Verify the token is correct (copy from browser localStorage)\n\n### \"Invalid auth token\" (401 error)\n- Your token has expired - get a fresh one from chat.deepseek.com\n- Make sure you copied the entire token value\n\n### \"Rate limit exceeded\" (429 error)\n- You're sending too many requests\n- Wait a few minutes before trying again\n\n### No response / Timeout\n- DeepSeek servers may be down or slow\n- Try again later\n- Check https://chat.deepseek.com is accessible\n\n## Development\n\n### Project Structure\n\n```\ndeepseek-chat-proxy/\n├── main.py # FastAPI server\n├── requirements.txt # Python dependencies\n├── .env.example # Environment template\n└── README.md # This file\n```\n\n### Testing\n\n```bash\n# Test health endpoint\ncurl http://localhost:8090/health\n\n# Test chat completion\ncurl -X POST http://localhost:8090/v1/chat/completions \\\n -H \"Content-Type: application/json\" \\\n -d '{\"model\": \"deepseek-chat\", \"messages\": [{\"role\": \"user\", \"content\": \"Hi\"}]}'\n```\n\n## Comparison with Official API\n\n| Feature | This Proxy (Free) | Official API (Paid) |\n|---------|------------------|-------------------|\n| Cost | Free | $0.14/1M tokens |\n| Rate Limits | Browser limits | API tier limits |\n| Reliability | Depends on chat.deepseek.com | Production SLA |\n| Features | Basic chat | Full API features |\n| ToS Compliance | ⚠️ Unclear | ✅ Official |\n\n## Alternative Solutions\n\n1. **DeepSeek Official API** - https://platform.deepseek.com/\n - Cheap ($0.14/1M tokens)\n - Official, reliable\n - Full features\n\n2. **OpenRouter** - https://openrouter.ai/deepseek/deepseek-chat\n - Free tier: 50 messages/day\n - $10 credit: 1,000 messages/day\n - OpenAI-compatible\n\n3. **Together.ai** - https://together.ai\n - DeepSeek models available\n - Free tier + paid plans\n\n## License\n\nThis project is for educational purposes only. Use at your own risk.\n\n## Credits\n\nInspired by:\n- [xtekky/deepseek4free](https://github.com/xtekky/deepseek4free) - Reverse-engineered DeepSeek API\n- [qwen-code-oai-proxy](https://github.com/aptdnfapt/qwen-code-oai-proxy) - Similar proxy for Qwen\n"}}}} |