A simple Node.js application that integrates with the Deepseek AI API to provide both standard and streaming chat completions.
- Regular chat completions with Deepseek AI
- Streaming chat completions with Server-Sent Events (SSE)
- Express.js API with modular architecture
- Clone the repository:
git clone <repository-url> cd deepseek-api-integration-node.js
- Install dependencies:
npm install
3.Add your Deepseek API key to .env file:
DEEPSEEK_API_KEY=your_api_key_here
Start the server:
npm start
❗️ The server will run at http://localhost:2020 by default.
Endpoint:
POST /api/v1/ai/chat-with-deepseek
Request Body:
{
"message": "Your message here"
}
Response:
- JSON containing the AI's response
Endpoint:
POST /api/v1/ai/chat-with-stream-deepseek
Request Body:
{
"message": "Your message here"
}
Response:
- Server-Sent Events (SSE) stream of the AI's response
- express:
^4.21.2
- openai:
^4.81.0
- dotenv:
^16.4.7
- http:
^0.0.1-security