This document provides detailed information about the Chat Completion API endpoints and their usage.
Create a chat completion response for the given conversation messages.
Header | Description |
---|---|
Authorization | Required. Your API key in the format: Bearer YOUR_API_KEY |
Content-Type | Required. Must be application/json |
Field | Type | Description |
---|---|---|
model | string | The model to use for completion. Default: deepseek-r1 |
messages | array | An array of message objects representing the conversation |
Each message in the messages
array should have:
role
: string - The role of the message sender (user
or assistant
)content
: string - The content of the messageThe API returns a JSON object with the following structure:
Field | Type | Description |
---|---|---|
id | string | Unique identifier for the completion |
object | string | Type of object, always "chat.completion" |
created | number | Unix timestamp of when the completion was created |
model | string | The model used for completion |
system_fingerprint | string | System fingerprint identifier |
choices | array | Array of completion choices |
usage | object | Token usage information for the request |
Field | Type | Description |
---|---|---|
index | number | Index of the choice in the array |
finish_reason | string | Reason for finishing the completion |
message | object | The completion message with content and role |
logprobs | null/object | Log probabilities for the completion |
Field | Type | Description |
---|---|---|
prompt_tokens | number | Number of tokens in the prompt |
completion_tokens | number | Number of tokens in the completion |
total_tokens | number | Total number of tokens used |