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 "chat.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
messageobjectThe completion message with content and role
logprobsnull/objectLog probabilities for the completion

Usage Object

FieldTypeDescription
prompt_tokensnumberNumber of tokens in the prompt
completion_tokensnumberNumber of tokens in the completion
total_tokensnumberTotal number of tokens used