HAI Gateway Docs

DeepSeek

DeepSeek Chat Completions

Call DeepSeek models via the OpenAI-compatible endpoint, supporting streaming, tool calling, thinking, and JSON mode.

POSTv1/chat/completions

Authorizations

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/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:Default
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
200:Default
{
  "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
  }
}