HAI Gateway Docs

DeepSeek

DeepSeek Anthropic Messages

Call DeepSeek models via the Anthropic Messages compatible endpoint, supporting streaming, thinking, and tool calling.

POSTv1/messages

Authorizations

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/completions or Anthropic /v1/messages.
  • Thinking is only available on pro: enable_thinking (OpenAI endpoint) or thinking (Anthropic endpoint) only works with deepseek-v4-pro; deepseek-v4-flash ignores these parameters and does not return thinking content.
  • Thinking field location: On the OpenAI endpoint, the reasoning chain is in the choices[].message.reasoning_content field; on the Anthropic endpoint, it appears as a thinking block in the content array.
  • Do not pass reasoning in multi-turn context: When building conversation history, only pass back the previous turn's content (OpenAI) or text block (Anthropic) — do not include reasoning_content / thinking blocks in messages, otherwise a parameter error will be returned.
  • developer role not supported: The OpenAI compatible endpoint only accepts system / user / assistant roles; the Anthropic endpoint follows the official user / assistant conversation structure, with system messages passed via the top-level system field.
cURL
cURL:Streaming
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"
      }
    ]
  }'