DeepSeek R1 API Documentation

Learn how to integrate DeepSeek R1 into your applications using our API.

Authentication

To use the DeepSeek R1 API, you need to include your API key in the Authorization header:

Authorization: Bearer sk-525c3e8176914a559d22577ef1accc99

Endpoints

POST /v1/chat/completions

Generate a response based on a series of messages.

curl https://api.deepseek.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-525c3e8176914a559d22577ef1accc99" \
  -d '{
    "model": "deepseek-chat",
    "messages": [
      {"role": "user", "content": "Hello, how are you?"}
    ]
  }'

Response Format

The API returns a JSON object with the following structure:

{
  "id": "chatcmpl-123",
  "object": "chat.completion",
  "created": 1677652288,
  "choices": [{
    "index": 0,
    "message": {
      "role": "assistant",
      "content": "Hello! As an AI language model, I don't have feelings, but I'm functioning well and ready to assist you. How can I help you today?"
    },
    "finish_reason": "stop"
  }],
  "usage": {
    "prompt_tokens": 9,
    "completion_tokens": 33,
    "total_tokens": 42
  }
}

Rate Limits

The API is rate-limited to 60 requests per minute. If you exceed this limit, you'll receive a 429 Too Many Requests response.