Chat API Reference

This document provides detailed information about the Chat Completion API endpoints and their usage.

Chat Completions

Create a chat completion response for the given conversation messages.

Endpoint

Headers

HeaderDescription
AuthorizationRequired. Your API key in the format: Bearer YOUR_API_KEY
Content-TypeRequired. Must be application/json

Request Body

FieldTypeDescription
modelstringThe model to use for completion. Default: deepseek-r1
messagesarrayAn 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 message

Example Request

Response Format

The API returns a JSON object with the following structure:

Response Fields

FieldTypeDescription
idstringUnique identifier for the completion
objectstringType of object, always "text_completion"
creatednumberUnix timestamp of when the completion was created
modelstringThe model used for completion
system_fingerprintstringSystem fingerprint identifier
choicesarrayArray of completion choices
usageobjectToken usage information for the request

Choices Object

FieldTypeDescription
indexnumberIndex of the choice in the array
finish_reasonstringReason for finishing the completion
message.contentstringThe completion text, The content of deep thinking will be placed within the think tags, which you can render on HTML to customize special effects.
logprobsobjectLog probabilities object containing tokens, token_logprobs, top_logprobs, and text_offset

Usage Object

FieldTypeDescription
prompt_tokensnumberNumber of tokens in the prompt
completion_tokensnumberNumber of tokens in the completion
total_tokensnumberTotal number of tokens used
prompt_tokens_detailsnull/objectDetailed token information for the prompt
completion_tokens_detailsnull/objectDetailed token information for the completion