# 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
}'
# With Function Calling (Tools)
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": "What'\''s the weather like in San Francisco?"
}
],
"stream": true,
"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"]
}
}
]
}'
# Enhanced Text Correction Mode
curl --location 'https://api.60db.ai/v1/chat/completions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer your-api-key' \
--data '{
"model": "60db-tiny",
"text": "hello how r u i need help with english",
"dictionary": [
{"term": "r", "replacement": "are"},
{"term": "u", "replacement": "you"}
],
"style": {
"tone": "professional",
"autoCapitalize": true,
"autoPunctuate": true,
"useContractions": false,
"expandAbbreviations": true
},
"appContext": "email",
"stream": true,
"save_chat": true
}'
import { SixtyDBClient } from "60db";
const client = new SixtyDBClient("your-api-key");
// Direct messages mode
const response = await client.chat.completions.create({
model: "60db-tiny",
messages: [
{ role: "system", content: "You are a helpful assistant." },
{ role: "user", content: "How can I improve my English?" },
],
stream: true,
});
// Handle streaming response
for await (const chunk of response) {
console.log(chunk.choices[0]?.delta?.content);
}
from sixtydb import SixtyDBClient
client = SixtyDBClient('your-api-key')
# Text correction mode
response = client.chat.completion(
text='hello how r u i need help with english',
dictionary=[
{'term': 'r', 'replacement': 'are'},
{'term': 'u', 'replacement': 'you'}
],
style={
'tone': 'professional',
'auto_capitalize': True,
'auto_punctuate': True,
'use_contractions': False,
'expand_abbreviations': True
},
app_context='email',
stream=True
)
print(response['choices'][0]['message']['content'])
{
"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
}
data: {"id":"chatcmpl-123","choices":[{"delta":{"content":"I'm"}}]}
data: {"id":"chatcmpl-123","choices":[{"delta":{"content":" doing"}}]}
data: {"id":"chatcmpl-123","choices":[{"delta":{"content":" well!"}}]}
data: {"type":"done","response_time_ms":1250}
data: [DONE]
LLM & Chat
Chat
Generate AI responses using our Small Language Model (SLM) with support for streaming, text correction, and function calling
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
}'
# With Function Calling (Tools)
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": "What'\''s the weather like in San Francisco?"
}
],
"stream": true,
"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"]
}
}
]
}'
# Enhanced Text Correction Mode
curl --location 'https://api.60db.ai/v1/chat/completions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer your-api-key' \
--data '{
"model": "60db-tiny",
"text": "hello how r u i need help with english",
"dictionary": [
{"term": "r", "replacement": "are"},
{"term": "u", "replacement": "you"}
],
"style": {
"tone": "professional",
"autoCapitalize": true,
"autoPunctuate": true,
"useContractions": false,
"expandAbbreviations": true
},
"appContext": "email",
"stream": true,
"save_chat": true
}'
import { SixtyDBClient } from "60db";
const client = new SixtyDBClient("your-api-key");
// Direct messages mode
const response = await client.chat.completions.create({
model: "60db-tiny",
messages: [
{ role: "system", content: "You are a helpful assistant." },
{ role: "user", content: "How can I improve my English?" },
],
stream: true,
});
// Handle streaming response
for await (const chunk of response) {
console.log(chunk.choices[0]?.delta?.content);
}
from sixtydb import SixtyDBClient
client = SixtyDBClient('your-api-key')
# Text correction mode
response = client.chat.completion(
text='hello how r u i need help with english',
dictionary=[
{'term': 'r', 'replacement': 'are'},
{'term': 'u', 'replacement': 'you'}
],
style={
'tone': 'professional',
'auto_capitalize': True,
'auto_punctuate': True,
'use_contractions': False,
'expand_abbreviations': True
},
app_context='email',
stream=True
)
print(response['choices'][0]['message']['content'])
{
"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
}
data: {"id":"chatcmpl-123","choices":[{"delta":{"content":"I'm"}}]}
data: {"id":"chatcmpl-123","choices":[{"delta":{"content":" doing"}}]}
data: {"id":"chatcmpl-123","choices":[{"delta":{"content":" well!"}}]}
data: {"type":"done","response_time_ms":1250}
data: [DONE]
Request
Headers
string
required
Bearer token with your API key
string
required
application/json
Body - Direct Messages Mode (OpenAI Compatible)
string
default:"60db-tiny"
The model to use for completion
array
required
Array of message objects with
role and contentboolean
default:"true"
Enable streaming response (Server-Sent Events)
number
default:"20"
Top-k sampling parameter for response generation
object
Template configuration options
boolean
default:"false"
Enable thinking mode in the model
array
Array of tool/function definitions for function calling
Body - Enhanced Text Correction Mode
string
required
The text to correct/improve
array
Array of term-replacement pairs for custom corrections
string
The term to find and replace
string
The replacement text
object
Style configuration for text correction
string
Tone to apply (e.g., “professional”, “casual”, “friendly”)
boolean
Automatically capitalize sentences
boolean
Add proper punctuation
boolean
Whether to use contractions (false to expand them)
boolean
Expand abbreviations to full form
string
Application context (e.g., “email”, “chat”, “document”)
boolean
default:"true"
Save conversation to chat history
string
Existing chat ID to continue conversation
Response
array
Array of completion choices
object
The generated message with role and content
object
Streaming delta with incremental content (stream mode only)
string
ID of the chat session (for new chats)
object
Token usage information
number
Total tokens used in the request
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
}'
# With Function Calling (Tools)
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": "What'\''s the weather like in San Francisco?"
}
],
"stream": true,
"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"]
}
}
]
}'
# Enhanced Text Correction Mode
curl --location 'https://api.60db.ai/v1/chat/completions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer your-api-key' \
--data '{
"model": "60db-tiny",
"text": "hello how r u i need help with english",
"dictionary": [
{"term": "r", "replacement": "are"},
{"term": "u", "replacement": "you"}
],
"style": {
"tone": "professional",
"autoCapitalize": true,
"autoPunctuate": true,
"useContractions": false,
"expandAbbreviations": true
},
"appContext": "email",
"stream": true,
"save_chat": true
}'
import { SixtyDBClient } from "60db";
const client = new SixtyDBClient("your-api-key");
// Direct messages mode
const response = await client.chat.completions.create({
model: "60db-tiny",
messages: [
{ role: "system", content: "You are a helpful assistant." },
{ role: "user", content: "How can I improve my English?" },
],
stream: true,
});
// Handle streaming response
for await (const chunk of response) {
console.log(chunk.choices[0]?.delta?.content);
}
from sixtydb import SixtyDBClient
client = SixtyDBClient('your-api-key')
# Text correction mode
response = client.chat.completion(
text='hello how r u i need help with english',
dictionary=[
{'term': 'r', 'replacement': 'are'},
{'term': 'u', 'replacement': 'you'}
],
style={
'tone': 'professional',
'auto_capitalize': True,
'auto_punctuate': True,
'use_contractions': False,
'expand_abbreviations': True
},
app_context='email',
stream=True
)
print(response['choices'][0]['message']['content'])
{
"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
}
data: {"id":"chatcmpl-123","choices":[{"delta":{"content":"I'm"}}]}
data: {"id":"chatcmpl-123","choices":[{"delta":{"content":" doing"}}]}
data: {"id":"chatcmpl-123","choices":[{"delta":{"content":" well!"}}]}
data: {"type":"done","response_time_ms":1250}
data: [DONE]
Streaming Response
Server-Sent Events Format
Server-Sent Events Format
When
stream: true, the response is sent as Server-Sent Events (SSE):- chat_id event - Sent first for new chats
- content chunks - Delta updates with incremental content
- done event - Signals completion with response time
- [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);
}
}
}
}
Function Calling with Tools
Function Calling with Tools
Define tools/functions that the model can call during conversation:The model will respond with tool calls that you can execute and send back the results.
{
"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"]
}
}
]
}
Text Correction Features
Dictionary Replacements
Dictionary Replacements
Define custom term replacements that will always be applied:Up to 100 dictionary entries are supported, each with a maximum length of 200 characters.
{
"dictionary": [
{"term": "pls", "replacement": "please"},
{"term": "thx", "replacement": "thanks"},
{"term": "ASAP", "replacement": "as soon as possible"}
]
}
Style Options
Style Options
Configure how the text should be corrected and styled:
| Option | Type | Description |
|---|---|---|
tone | string | Target tone: “professional”, “casual”, “friendly” |
autoCapitalize | boolean | Automatically capitalize first letter of sentences |
autoPunctuate | boolean | Add proper punctuation marks |
useContractions | boolean | Set to false to expand contractions (can’t → cannot) |
expandAbbreviations | boolean | Expand common abbreviations |
Application Context
Application Context
Provide context to help the model adjust its corrections:Supported contexts: “email”, “chat”, “document”, “message”, “social”
{
"appContext": "email"
}
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.