Skip to content

alakkaya/deepseek-api-integration-node.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 Deepseek API Integration Node.js

A simple Node.js application that integrates with the Deepseek AI API to provide both standard and streaming chat completions.

✨ Features

  • Regular chat completions with Deepseek AI
  • Streaming chat completions with Server-Sent Events (SSE)
  • Express.js API with modular architecture

⚙️ Installation

  1. Clone the repository:
    git clone <repository-url>
    cd deepseek-api-integration-node.js
  2. Install dependencies:
  npm install

3.Add your Deepseek API key to .env file:

 DEEPSEEK_API_KEY=your_api_key_here

🚀 Usage

Start the server:

  npm start

❗️ The server will run at http://localhost:2020 by default.

📡 API Endpoints

Regular Chat Completion

Endpoint:
POST /api/v1/ai/chat-with-deepseek

Request Body:

{
  "message": "Your message here"
}

Response:

  • JSON containing the AI's response

Streaming Chat Completion

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

📦 Dependencies

  • express: ^4.21.2
  • openai: ^4.81.0
  • dotenv: ^16.4.7
  • http: ^0.0.1-security

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published