Deepseek 列出模型
2025-02-05 10:59 更新
列出可用的模型列表,并提供相关模型的基本信息。请前往模型 & 价格查看当前支持的模型列表
请参考官方文档: https://api-docs.deepseek.com/zh-cn/api/list-models
Curl 示例
curl -L -X GET 'https://api.deepseek.com/models' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <TOKEN>'
Python 示例
from openai import OpenAI
# for backward compatibility, you can still use `https://api.deepseek.com/v1` as `base_url`.
client = OpenAI(api_key="<your API key>", base_url="https://api.deepseek.com")
print(client.models.list())
Go 示例
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.deepseek.com/models"
method := "GET"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Accept", "application/json")
req.Header.Add("Authorization", "Bearer <TOKEN>")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Node.js 示例
import OpenAI from "openai";
# for backward compatibility, you can still use `https://api.deepseek.com/v1` as `baseURL`.
const openai = new OpenAI({
baseURL: 'https://api.deepseek.com',
apiKey: '<your API key>'
});
async function main() {
const models = await openai.models.list()
for await (const model of models) {
console.log(model);
}
}
main();
以上内容是否对您有帮助:
更多建议: