DeepSeek
DeepSeek Chat Completions
Call DeepSeek models via the OpenAI-compatible endpoint, supporting streaming, tool calling, thinking, and JSON mode.
POST
v1/chat/completionsAuthorizations
Authorizationstringheaderrequired
OpenAI compatible endpoint: Bearer sk-pat-YourAccessToken
Use your HAI Gateway personal access token (starting with sk-pat-). No separate DeepSeek API key is required.
Base URL
Body Parameters
The request body follows the OpenAI Chat Completions API format. For detailed parameter descriptions, refer to the DeepSeek official documentation.
DeepSeek Notes
- Only Chat Completion endpoints are supported: DeepSeek does not support the OpenAI Responses (
/v1/responses) endpoint. Please use/v1/chat/completionsor Anthropic/v1/messages. - Thinking is only available on pro:
enable_thinking(OpenAI endpoint) orthinking(Anthropic endpoint) only works withdeepseek-v4-pro;deepseek-v4-flashignores these parameters and does not return thinking content. - Thinking field location: On the OpenAI endpoint, the reasoning chain is in the
choices[].message.reasoning_contentfield; on the Anthropic endpoint, it appears as athinkingblock in thecontentarray. - Do not pass reasoning in multi-turn context: When building conversation history, only pass back the previous turn's
content(OpenAI) ortextblock (Anthropic) — do not includereasoning_content/thinkingblocks inmessages, otherwise a parameter error will be returned. - developer role not supported: The OpenAI compatible endpoint only accepts
system/user/assistantroles; the Anthropic endpoint follows the officialuser/assistantconversation structure, with system messages passed via the top-levelsystemfield.
cURL
curl https://api.hai.network/compatible-preview/openai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-pat-YOUR_ACCESS_TOKEN" \
-d '{
"model": "deepseek-v4-flash",
"messages": [
{
"role": "user",
"content": "Hello, introduce yourself in one sentence"
}
]
}'200
{
"id": "chatcmpl-...",
"object": "chat.completion",
"model": "deepseek-v4-flash",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "I am DeepSeek, a large language model developed by DeepSeek."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 14,
"completion_tokens": 20,
"total_tokens": 34
}
}