DeepSeek
DeepSeek Anthropic Messages
Call DeepSeek models via the Anthropic Messages compatible endpoint, supporting streaming, thinking, and tool calling.
POST
v1/messagesAuthorizations
x-api-keystringheaderrequired
sk-pat-YourAccessToken
anthropic-versionstringheaderrequired
API version, currently 2023-06-01
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 Anthropic Messages API format. For detailed parameter descriptions, refer to the DeepSeek Anthropic Compatible 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/anthropic/v1/messages \
-H "Content-Type: application/json" \
-H "x-api-key: sk-pat-YOUR_ACCESS_TOKEN" \
-H "anthropic-version: 2023-06-01" \
-d '{
"model": "deepseek-v4-flash",
"stream": true,
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": "Describe Hangzhou in one sentence"
}
]
}'