PrivateMind forwards tools and tool_choice directly to the underlying engine. The wire shape is identical to OpenAI's.
cURL
curl -s "https://api.privatemind.com/v1/chat/completions" \
-H "Authorization: Bearer $PMIND_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "fast",
"messages": [{"role": "user", "content": "What is the weather in Paris?"}],
"tools": [{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get current weather for a city",
"parameters": {
"type": "object",
"properties": {"city": {"type": "string"}},
"required": ["city"]
}
}
}],
"tool_choice": "auto"
}'Response when the model calls a tool
finish_reason is tool_calls and message.tool_calls contains the call(s):
JSON
{
"choices": [{
"index": 0,
"message": {
"role": "assistant",
"content": null,
"tool_calls": [{
"id": "call_abc123",
"type": "function",
"function": {
"name": "get_weather",
"arguments": "{\"city\":\"Paris\"}"
}
}]
},
"finish_reason": "tool_calls"
}]
}arguments is a string containing JSON. Parse it before use.
Sending the tool result back
Append the assistant's tool-call message and a role: "tool" message with the result, then call the API again:
JSON
{
"model": "<tool-capable-model>",
"messages": [
{"role": "user", "content": "What is the weather in Paris?"},
{"role": "assistant", "content": null, "tool_calls": [
{"id": "call_abc123", "type": "function", "function": {"name": "get_weather", "arguments": "{\"city\":\"Paris\"}"}}
]},
{"role": "tool", "tool_call_id": "call_abc123", "content": "{\"temp_c\": 18, \"conditions\": \"overcast\"}"}
]
}The model continues from there with a natural-language answer.
Tool choice
| Value | Behaviour |
|---|---|
"auto" (default) |
Model decides whether to call a tool |
"none" |
Model never calls a tool |
"required" |
Model must call at least one tool |
{"type": "function", "function": {"name": "..."}} |
Model must call this specific tool |
Which models support tools?
Check supported_parameters in GET /v1/models. Tool-capable models include "tools" in that array. Calling tools on a model that doesn't support them returns a 400.
Where next
- Chat completions for the request shape
toolsrides on top of. - Streaming for how
tool_callsarrive in SSE chunks. - Models to feature-detect which models accept
tools.