SACHIBOT™ UPDATES
SACHIBOT™ UPDATES
January 30, 2025 at 12:47 PM
> Setting Up the API Connection First, install Axios if you haven’t already: ``` npm install axios ``` Now, let’s set up a *basic request* to communicate with DeepSeek AI: ``` const axios = require('axios'); const api_key = "your-api-key"; // Replace with your API key const url = "https://api.segmind.com/v1/deepseek-reasoner"; const messages = [ { "role": "user", "content": "hi" } ]; async function sendMessage() { try { const response = await axios.post(url, { messages }, { headers: { 'x-api-key': api_key } }); console.log(response.data); } catch (error) { console.log("Error:", error.response?.data || error.message); } } sendMessage(); ``` ✅ If successful, DeepSeek will respond with an AI-generated message!
🙏 ❤️ 😮 👍 115

Comments