{"id":48842558,"url":"https://github.com/honwhy/dpnp","last_synced_at":"2026-04-15T03:02:26.984Z","repository":{"id":350619607,"uuid":"1205113190","full_name":"honwhy/dpnp","owner":"honwhy","description":null,"archived":false,"fork":false,"pushed_at":"2026-04-11T07:00:32.000Z","size":36,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-11T09:07:59.409Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/honwhy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-04-08T16:41:36.000Z","updated_at":"2026-04-11T07:00:36.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/honwhy/dpnp","commit_stats":null,"previous_names":["honwhy/dpnp"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/honwhy/dpnp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/honwhy%2Fdpnp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/honwhy%2Fdpnp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/honwhy%2Fdpnp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/honwhy%2Fdpnp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/honwhy","download_url":"https://codeload.github.com/honwhy/dpnp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/honwhy%2Fdpnp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31824118,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-14T18:05:02.291Z","status":"online","status_checked_at":"2026-04-15T02:00:06.175Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-04-15T03:02:22.735Z","updated_at":"2026-04-15T03:02:26.965Z","avatar_url":"https://github.com/honwhy.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DeepSeek Proxy Service\n\nA Hono + TypeScript proxy service that forwards OpenAI-compatible API requests to the DeepSeek API, supporting both streaming and non-streaming modes.\n\n## Features\n\n- ✅ Full OpenAI API compatibility\n- ✅ Streaming support (Server-Sent Events)\n- ✅ Non-streaming request support\n- ✅ Request/response transformation\n- ✅ Authentication middleware\n- ✅ CORS support\n- ✅ Comprehensive error handling\n- ✅ TypeScript strict mode\n- ✅ Request validation with Zod\n\n## Quick Start\n\n### 1. Install Dependencies\n\n```bash\nnpm install\n```\n\n### 2. Configure Environment\n\nCopy `.env.example` to `.env`:\n\n```bash\ncp .env.example .env\n```\n\nEdit `.env`:\n```env\nPORT=3000\nNODE_ENV=development\nDEEPSEEK_BASE_URL=https://api.deepseek.com/v1\n```\n\n**Note:** The API key is now provided by clients through the Authorization header (see Usage section below).\n\n### 3. Run in Development Mode\n\n```bash\nnpm run dev\n```\n\nThe server will start on `http://localhost:3000`\n\n### 4. Build for Production\n\n```bash\nnpm run build\nnpm start\n```\n\n## API Endpoints\n\n### Chat Completions\n\n**POST** `/v1/chat/completions`\n\nSend chat completion requests in OpenAI format.\n\n#### Non-Streaming Request\n\n```bash\ncurl -X POST http://localhost:3000/v1/chat/completions \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer sk-your-deepseek-api-key\" \\\n  -d '{\n    \"model\": \"deepseek-chat\",\n    \"messages\": [\n      {\"role\": \"user\", \"content\": \"Hello!\"}\n    ],\n    \"stream\": false,\n    \"temperature\": 0.7,\n    \"max_tokens\": 100\n  }'\n```\n\n#### Streaming Request\n\n```bash\ncurl -N -X POST http://localhost:3000/v1/chat/completions \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer sk-your-deepseek-api-key\" \\\n  -d '{\n    \"model\": \"deepseek-chat\",\n    \"messages\": [\n      {\"role\": \"user\", \"content\": \"Hello!\"}\n    ],\n    \"stream\": true\n  }'\n```\n\n**Important:** Replace `sk-your-deepseek-api-key` with your actual DeepSeek API key. The proxy will forward this key to authenticate with the DeepSeek API.\n\n#### Response Format\n\n```json\n{\n  \"id\": \"chatcmpl-xxx\",\n  \"object\": \"chat.completion\",\n  \"created\": 1234567890,\n  \"model\": \"deepseek-chat\",\n  \"choices\": [\n    {\n      \"index\": 0,\n      \"message\": {\n        \"role\": \"assistant\",\n        \"content\": \"Hello! How can I help you?\"\n      },\n      \"finish_reason\": \"stop\"\n    }\n  ],\n  \"usage\": {\n    \"prompt_tokens\": 10,\n    \"completion_tokens\": 15,\n    \"total_tokens\": 25\n  }\n}\n```\n\n## Usage with OpenAI SDK\n\n```\nimport OpenAI from 'openai';\n\nconst openai = new OpenAI({\n  baseURL: 'http://localhost:3000/v1',\n  apiKey: 'sk-your-deepseek-api-key', // Provide your DeepSeek API key\n});\n\n// Non-streaming\nconst completion = await openai.chat.completions.create({\n  model: 'deepseek-chat',\n  messages: [{ role: 'user', content: 'Hello!' }],\n});\n\nconsole.log(completion.choices[0].message.content);\n\n// Streaming\nconst stream = await openai.chat.completions.create({\n  model: 'deepseek-chat',\n  messages: [{ role: 'user', content: 'Hello!' }],\n  stream: true,\n});\n\nfor await (const chunk of stream) {\n  process.stdout.write(chunk.choices[0].delta.content || '');\n}\n```\n\n**Note:** The `apiKey` you provide here will be used to authenticate with the DeepSeek API. Make sure to use a valid DeepSeek API key.\n\n## Project Structure\n\n```\nsrc/\n├── index.ts              # Entry point and server setup\n├── config/\n│   └── index.ts          # Configuration manager\n├── routes/\n│   └── chat.ts           # Chat completion routes\n├── services/\n│   ├── proxy.ts          # Core proxy logic\n│   └── transformer.ts    # Request/response transformers\n├── middleware/\n│   ├── auth.ts           # Authentication middleware\n│   └── logger.ts         # Request logging\n└── types/\n    ├── openai.ts         # TypeScript type definitions\n    └── validation.ts     # Zod validation schemas\n```\n\n## Environment Variables\n\n| Variable | Description | Default | Required |\n|----------|-------------|---------|----------|\n| `DEEPSEEK_API_KEY` | Your DeepSeek API key | - | ✅ |\n| `DEEPSEEK_BASE_URL` | DeepSeek API base URL | `https://api.deepseek.com/v1` | ❌ |\n| `PORT` | Server port | `3000` | ❌ |\n| `NODE_ENV` | Environment | `development` | ❌ |\n\n## Development\n\n### Available Scripts\n\n- `npm run dev` - Start development server with hot reload\n- `npm run build` - Build for production\n- `npm start` - Start production server\n\n### Code Quality\n\nThe project uses:\n- TypeScript strict mode\n- ESLint (recommended)\n- Prettier (recommended)\n- Zod for runtime validation\n\n## Error Handling\n\nThe proxy returns errors in OpenAI format:\n\n```json\n{\n  \"error\": {\n    \"message\": \"Error description\",\n    \"type\": \"invalid_request_error\",\n    \"param\": null,\n    \"code\": \"validation_error\"\n  }\n}\n```\n\n## Security Notes\n\n- Never expose your DeepSeek API key to clients\n- The proxy handles authentication internally\n- Consider adding rate limiting in production\n- Use HTTPS in production environments\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhonwhy%2Fdpnp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhonwhy%2Fdpnp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhonwhy%2Fdpnp/lists"}