DeepSeek API
πŸ‡ΊπŸ‡Έ English
  • πŸ‡ΊπŸ‡Έ English
  • πŸ‡―πŸ‡΅ Japanese
  • πŸ‡°πŸ‡· Korea
  • πŸ‡΅πŸ‡Ή Portuguese
  1. API Reference
DeepSeek API
πŸ‡ΊπŸ‡Έ English
  • πŸ‡ΊπŸ‡Έ English
  • πŸ‡―πŸ‡΅ Japanese
  • πŸ‡°πŸ‡· Korea
  • πŸ‡΅πŸ‡Ή Portuguese
  • Start quickly
    • Your First API Call
    • Models & Pricing
    • The Temperature Parameter
    • Token & Token Usage
    • Rate Limit
    • Error Codes
  • API Reference
    • Introduction
    • Create Chat Completion
      POST
    • Create FIM Completion (Beta)
      POST
    • Lists Models
      GET
    • Get User Balance
      GET
  • API Guides
    • Reasoning Model (deepseek-reasoner)
    • Multiple rounds of conversations
    • Chat Prefix Completion (Beta)
    • FIM Completion (Beta)
    • JSON Output
    • Function Calling
    • Context Caching
  • FAQ
    • FAQ
  1. API Reference

Create Chat Completion

POST
/chat/completions
Creates a model response for the given chat conversation.

Request

Authorization
Bearer Token
Provide your bearer token in the
Authorization
header when making requests to protected resources.
Example:
Authorization: Bearer ********************
or
Body Params application/json

Examples

Responses

🟒200No streaming
application/json
OK, returns a chat completion object
Body

🟒200Streaming
Request Request Example
Shell
JavaScript
Java
Swift
cURL
curl --location --request POST 'https://api.deepseek.com/chat/completions' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data-raw '{
  "messages": [
    {
      "content": "You are a helpful assistant",
      "role": "system"
    },
    {
      "content": "Hi",
      "role": "user"
    }
  ],
  "model": "deepseek-chat",
  "frequency_penalty": 0,
  "max_tokens": 2048,
  "presence_penalty": 0,
  "response_format": {
    "type": "text"
  },
  "stop": null,
  "stream": false,
  "stream_options": null,
  "temperature": 1,
  "top_p": 1,
  "tools": null,
  "tool_choice": "none",
  "logprobs": false,
  "top_logprobs": null
}'
Response Response Example
200 - No streaming - Success
{
  "id": "930c60df-bf64-41c9-a88e-3ec75f81e00e",
  "choices": [
    {
      "finish_reason": "stop",
      "index": 0,
      "message": {
        "content": "Hello! How can I help you today?",
        "role": "assistant"
      }
    }
  ],
  "created": 1705651092,
  "model": "deepseek-chat",
  "object": "chat.completion",
  "usage": {
    "completion_tokens": 10,
    "prompt_tokens": 16,
    "total_tokens": 26
  }
}
Modified atΒ 2025-09-19 07:37:02
Previous
Introduction
Next
Create FIM Completion (Beta)
Built with