Skip to main content
POST
/
v1
/
chat
/
completions
# Direct Messages Mode (OpenAI Compatible)
curl --location 'https://api.60db.ai/v1/chat/completions' \
--header 'Authorization: Bearer your-api-key' \
--header 'Content-Type: application/json' \
--data '{
  "model": "60db-tiny",
  "messages": [
    {
      "role": "system",
      "content": "You are a helpful assistant."
    },
    {
      "role": "user",
      "content": "How are you? How can I improve my English communication?"
    }
  ],
  "top_k": 20,
  "chat_template_kwargs": {
    "enable_thinking": false
  },
  "stream": true
}'
{
  "id": "chatcmpl-123",
  "object": "chat.completion",
  "created": 1677652288,
  "model": "60db-tiny",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "I'm doing well, thank you! Here are some tips to improve your English communication skills..."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 25,
    "completion_tokens": 150,
    "total_tokens": 175
  },
  "chat_id": "550e8400-e29b-41d4-a716-446655440000",
  "response_time_ms": 1250
}

Request

Headers

Authorization
string
required
Bearer token with your API key
Content-Type
string
required
application/json

Body - Direct Messages Mode (OpenAI Compatible)

model
string
default:"60db-tiny"
The model to use for completion
messages
array
required
Array of message objects with role and content
stream
boolean
default:"true"
Enable streaming response (Server-Sent Events)
top_k
number
default:"20"
Top-k sampling parameter for response generation
chat_template_kwargs
object
Template configuration options
chat_template_kwargs.enable_thinking
boolean
default:"false"
Enable thinking mode in the model
tool
array
Array of tool/function definitions for function calling

Body - Enhanced Text Correction Mode

text
string
required
The text to correct/improve
dictionary
array
Array of term-replacement pairs for custom corrections
dictionary[].term
string
The term to find and replace
dictionary[].replacement
string
The replacement text
style
object
Style configuration for text correction
style.tone
string
Tone to apply (e.g., “professional”, “casual”, “friendly”)
style.autoCapitalize
boolean
Automatically capitalize sentences
style.autoPunctuate
boolean
Add proper punctuation
style.useContractions
boolean
Whether to use contractions (false to expand them)
style.expandAbbreviations
boolean
Expand abbreviations to full form
appContext
string
Application context (e.g., “email”, “chat”, “document”)
save_chat
boolean
default:"true"
Save conversation to chat history
chat_id
string
Existing chat ID to continue conversation

Response

choices
array
Array of completion choices
choices[0].message
object
The generated message with role and content
choices[0].delta
object
Streaming delta with incremental content (stream mode only)
chat_id
string
ID of the chat session (for new chats)
usage
object
Token usage information
usage.total_tokens
number
Total tokens used in the request
response_time_ms
number
Response time in milliseconds
# Direct Messages Mode (OpenAI Compatible)
curl --location 'https://api.60db.ai/v1/chat/completions' \
--header 'Authorization: Bearer your-api-key' \
--header 'Content-Type: application/json' \
--data '{
  "model": "60db-tiny",
  "messages": [
    {
      "role": "system",
      "content": "You are a helpful assistant."
    },
    {
      "role": "user",
      "content": "How are you? How can I improve my English communication?"
    }
  ],
  "top_k": 20,
  "chat_template_kwargs": {
    "enable_thinking": false
  },
  "stream": true
}'
{
  "id": "chatcmpl-123",
  "object": "chat.completion",
  "created": 1677652288,
  "model": "60db-tiny",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "I'm doing well, thank you! Here are some tips to improve your English communication skills..."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 25,
    "completion_tokens": 150,
    "total_tokens": 175
  },
  "chat_id": "550e8400-e29b-41d4-a716-446655440000",
  "response_time_ms": 1250
}

Streaming Response

When stream: true, the response is sent as Server-Sent Events (SSE):
  1. chat_id event - Sent first for new chats
  2. content chunks - Delta updates with incremental content
  3. done event - Signals completion with response time
  4. [DONE] - Final termination signal
// Handling streaming in JavaScript
const response = await fetch('https://api.60db.ai/v1/chat/completions', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer your-api-key'
  },
  body: JSON.stringify({ messages, stream: true })
});

const reader = response.body.getReader();
const decoder = new TextDecoder();
let buffer = '';

while (true) {
  const { done, value } = await reader.read();
  if (done) break;

  buffer += decoder.decode(value, { stream: true });
  const lines = buffer.split('\n');
  buffer = lines.pop() || '';

  for (const line of lines) {
    if (line.startsWith('data: ')) {
      const data = JSON.parse(line.slice(6));
      if (data.type === 'chat_id') {
        console.log('Chat ID:', data.chat_id);
      } else if (data.type === 'done') {
        console.log('Response time:', data.response_time_ms);
      } else if (data.choices?.[0]?.delta?.content) {
        console.log('Content:', data.choices[0].delta.content);
      }
    }
  }
}
Define tools/functions that the model can call during conversation:
{
  "tool": [
    {
      "name": "get_weather",
      "description": "Get the current weather for a location",
      "parameters": {
        "type": "object",
        "properties": {
          "location": {
            "type": "string",
            "description": "The city and state, e.g. San Francisco, CA"
          },
          "unit": {
            "type": "string",
            "enum": ["celsius", "fahrenheit"]
          }
        },
        "required": ["location"]
      }
    }
  ]
}
The model will respond with tool calls that you can execute and send back the results.

Text Correction Features

Define custom term replacements that will always be applied:
{
  "dictionary": [
    {"term": "pls", "replacement": "please"},
    {"term": "thx", "replacement": "thanks"},
    {"term": "ASAP", "replacement": "as soon as possible"}
  ]
}
Up to 100 dictionary entries are supported, each with a maximum length of 200 characters.
Configure how the text should be corrected and styled:
OptionTypeDescription
tonestringTarget tone: “professional”, “casual”, “friendly”
autoCapitalizebooleanAutomatically capitalize first letter of sentences
autoPunctuatebooleanAdd proper punctuation marks
useContractionsbooleanSet to false to expand contractions (can’t → cannot)
expandAbbreviationsbooleanExpand common abbreviations
Provide context to help the model adjust its corrections:
{
  "appContext": "email"
}
Supported contexts: “email”, “chat”, “document”, “message”, “social”
Token costs are calculated based on usage. The current rate is approximately $0.00002 per token. Costs are deducted from your workspace billing balance.
Chat history is automatically saved when save_chat: true. Use chat_id to continue existing conversations or create new chats by omitting this parameter.