The DeepSeek API offers powerful AI capabilities for developers. This tutorial will guide you through integrating the DeepSeek API into your projects, showcasing how to obtain an API key and use it effectively for debugging using Apifox. Apifox is an integrated API collaboration platform, streamlining the entire API lifecycle from design and documentation to debugging and testing.
Apifox simplifies API debugging and integration. It's an all-in-one API collaboration platform that handles API design, documentation, testing, and mocking.
https://api.deepseek.com
.API_KEY
and assign it the value of the DeepSeek API key you obtained earlier.Create a New API Interface: Within your Apifox project, create a new interface to interact with the DeepSeek API.
Import the cURL Command: Copy the cURL command for the DeepSeek chat API from either the official DeepSeek API documentation or the example below:
curl https://api.deepseek.com/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer {{API_KEY}}" \
-d '{
"model": "deepseek-chat",
"messages": [
{"role": "system", "content": "你是一个全能助手"},
{"role": "user", "content": "广东的省会是哪里?"}
],
"stream": false
}'
Paste cURL into Apifox: Paste the copied cURL command directly into the interface path field in Apifox; Apifox automatically parses the cURL command.
Bearer {{API_KEY}}
. This tells Apifox to use the API key stored in your environment variables.
It's important to use double curly braces {{API_KEY}}
, this will dynamically use the API_KEY you have stored.Ensure that in the top right you are using the "Formal Environment". Click the send button to send the request. You should receive a message from the API. You can modify the value of the messages field in the body to change the output.
To get a live, stream output of the messages, set the stream value in the body to true.
Append the following to specify which model to use:
model='deepseek-chat'
to call DeepSeek-V3model='deepseek-reasoner'
to call DeepSeek-R1By following this tutorial, you have learned how to obtain a DeepSeek API key and successfully integrate it with Apifox for API debugging and testing. Using Apifox simplifies the integration process.