×

注意!页面内容来自https://api-docs.deepseek.com/,本站不储存任何内容,为了更好的阅读体验进行在线解析,若有广告出现,请及时反馈。若您觉得侵犯了您的利益,请通知我们进行删除,然后访问 原网页

Skip to main content

Your First API Call

The DeepSeek API uses an API format compatible with OpenAI. By modifying the configurationyou can use the OpenAI SDK or softwares compatible with the OpenAI API to access the DeepSeek API.

PARAMVALUE
base_url *       https://api.deepseek.com
api_keyapply for an API key

* To be compatible with OpenAIyou can also use https://api.deepseek.com/v1 as the base_url. But note that the v1 here has NO relationship with the model's version.

* deepseek-chat and deepseek-reasoner are upgraded to DeepSeek-V3.2 now. deepseek-chat is the non-thinking mode of DeepSeek-V3.2 and deepseek-reasoner is the thinking mode of DeepSeek-V3.2.

Invoke The Chat API

Once you have obtained an API keyyou can access the DeepSeek API using the following example scripts. This is a non-stream exampleyou can set the stream parameter to true to get stream response.

curl https://api.deepseek.com/chat/completions \
-H "Content-Type: application/on" \
-H "Authorization: Bearer ${DEEPSEEK_API_KEY}" \
-d '{
"model": "deepseek-chat",
"messages": [
{"role": "system""content": "You are a helpful assistant."},
{"role": "user""content": "Hello!"}
],
"stream": false
}'