Updated
Tool calling with an abliterated LLM API
Describe your functions in tools, and the model replies with tool_calls that your code runs. Send the results back after the assistant turn, unchanged, reasoning_content included.
https://api.silkcompute.com
tools = [{
"type": "function",
"function": {
"name": "get_order_status",
"description": "Status of one order by id.",
"parameters": {
"type": "object",
"properties": {"order_id": {"type": "string"}},
"required": ["order_id"],
},
},
}]
messages = [{"role": "user", "content": "Where is order 8812?"}]
first = client.chat.completions.create(model="deepseek-v4.1-flash-1017-uncensored", messages=messages, tools=tools)
message = first.choices[0].message
# Send the assistant turn back as it came, then one result per call.
messages.append(message)
for call in message.tool_calls:
messages.append({"role": "tool", "tool_call_id": call.id, "content": '{"status": "shipped"}'})
final = client.chat.completions.create(model="deepseek-v4.1-flash-1017-uncensored", messages=messages, tools=tools)
print(final.choices[0].message.content)Example first reply
{
"choices": [{
"message": {
"role": "assistant",
"reasoning_content": "Need the order status first.",
"content": null,
"tool_calls": [{
"id": "call_1",
"type": "function",
"function": {"name": "get_order_status", "arguments": "{\"order_id\": \"8812\"}"}
}]
},
"finish_reason": "tool_calls"
}]
}const tools = [{
type: 'function',
function: {
name: 'get_order_status',
description: 'Status of one order by id.',
parameters: {
type: 'object',
properties: { order_id: { type: 'string' } },
required: ['order_id'],
},
},
}]
const messages = [{ role: 'user', content: 'Where is order 8812?' }]
const first = await client.chat.completions.create({ model: 'deepseek-v4.1-flash-1017-uncensored', messages, tools })
const message = first.choices[0].message
// Send the assistant turn back as it came, then one result per call.
messages.push(message)
for (const call of message.tool_calls ?? []) {
messages.push({ role: 'tool', tool_call_id: call.id, content: '{"status": "shipped"}' })
}
const final = await client.chat.completions.create({ model: 'deepseek-v4.1-flash-1017-uncensored', messages, tools })
console.log(final.choices[0].message.content)Example first reply
{
"choices": [{
"message": {
"role": "assistant",
"reasoning_content": "Need the order status first.",
"content": null,
"tool_calls": [{
"id": "call_1",
"type": "function",
"function": {"name": "get_order_status", "arguments": "{\"order_id\": \"8812\"}"}
}]
},
"finish_reason": "tool_calls"
}]
}curl https://api.silkcompute.com/chat/completions \
-H "Authorization: Bearer $SILK_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-v4.1-flash-1017-uncensored",
"messages": [{"role": "user", "content": "Where is order 8812?"}],
"tools": [{
"type": "function",
"function": {
"name": "get_order_status",
"description": "Status of one order by id.",
"parameters": {
"type": "object",
"properties": {"order_id": {"type": "string"}},
"required": ["order_id"]
}
}
}]
}'Example first reply
{
"choices": [{
"message": {
"role": "assistant",
"reasoning_content": "Need the order status first.",
"content": null,
"tool_calls": [{
"id": "call_1",
"type": "function",
"function": {"name": "get_order_status", "arguments": "{\"order_id\": \"8812\"}"}
}]
},
"finish_reason": "tool_calls"
}]
}How it works
Round tripSend the turn back as it cameThe model needs its own thinking to continue after a result, so never strip
reasoning_content.ResultsOne result per callAppend a
tool message for each call id, then ask again.LimitsYour functions onlyHosted tools such as web search are not available.
In each format
| Format | Model asks with | You answer with |
|---|---|---|
| Chat Completions | tool_calls | A tool message per call |
| Messages | tool_use blocks | tool_result blocks |
| Responses | Function call items | Function call output items |