体验deepseek
Last updated
Was this helpful?
Last updated
Was this helpful?
Was this helpful?
const axios = require('axios')
const token = 'sk-xxx'
let config = {
method: 'get',
maxBodyLength: Infinity,
url: 'https://api.deepseek.com/models',
headers: {
'Accept': 'application/json',
'Authorization': `Bearer ${token}`
}
}
axios(config)
.then((response) => {
console.log(JSON.stringify(response.data))
})
.catch((error) => {
console.log(error)
})const axios = require('axios')
const token = 'sk-xxx'
let data = JSON.stringify({
"messages": [
{
"content": "You are a helpful assistant",
"role": "system"
},
{
"content": "比较Vue和React,以及未来前端发展趋势",
"role": "user"
}
],
"model": "deepseek-chat",
"frequency_penalty": 0,
"max_tokens": 2048,
"presence_penalty": 0,
"stop": null,
"stream": false,
"temperature": 1,
"top_p": 1,
"logprobs": false,
"top_logprobs": null
})
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://api.deepseek.com/chat/completions',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': `Bearer ${token}`
},
data : data
}
axios(config)
.then((response) => {
console.log(JSON.stringify(response.data))
})
.catch((error) => {
console.log(error)
})