Tool Calling (Function Calling)
ColabHive's OpenAI-compatible Chat Completions API supports tool calling (a.k.a. function
calling): you pass a list of tools, and a capable model decides when to call one and returns a
structured tool_calls response. Your application executes the tool and sends the result back.
This is what powers agentic clients (coding agents, deep-research agents, assistants) on top of ColabHive — the model does the reasoning and decides the calls; your code runs the tools, so sensitive data and side effects stay on your side.
Tool calling runs on ColabHive's Intel Arc (and NVIDIA) fleet — the same OpenAI tool-calling contract, served on Arc GPUs.
Endpoint
POST https://api.colabhive.com/v1/chat/completions
Authorization: Bearer hive_...
Content-Type: application/json
Use any OpenAI-compatible SDK by pointing its base URL at https://api.colabhive.com/v1 and using
your ColabHive API key.
Which models support it
Tool calling is enabled per model (the model must ship a tool-aware chat template). Instruction-tuned
models such as qwen-2.5-7b-instruct support it. See Available Models for
the current list, or query the live catalog at GET /api/builder/v1/inference/models.
Example
A single round trip where the model decides to call get_weather:
curl https://api.colabhive.com/v1/chat/completions \
-H "Authorization: Bearer $COLABHIVE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen-2.5-7b-instruct",
"messages": [
{"role": "user", "content": "What is the weather in Paris right now? Use the get_weather tool."}
],
"tools": [{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get the current weather for a city",
"parameters": {
"type": "object",
"properties": {"city": {"type": "string"}},
"required": ["city"]
}
}
}]
}'
Response (finish_reason: "tool_calls"):
{
"object": "chat.completion",
"model": "qwen-2.5-7b-instruct",
"choices": [{
"index": 0,
"message": {
"role": "assistant",
"content": null,
"tool_calls": [{
"id": "chatcmpl-tool-ac564de1",
"type": "function",
"function": {"name": "get_weather", "arguments": "{\"city\": \"Paris\"}"}
}]
},
"finish_reason": "tool_calls"
}]
}
Completing the loop
Execute the tool in your application, then send the result back as a role: "tool" message
referencing the tool_call_id:
from openai import OpenAI
client = OpenAI(base_url="https://api.colabhive.com/v1", api_key="hive_...")
messages = [{"role": "user", "content": "Weather in Paris? Use the tool."}]
resp = client.chat.completions.create(model="qwen-2.5-7b-instruct", messages=messages, tools=tools)
call = resp.choices[0].message.tool_calls[0]
messages.append(resp.choices[0].message) # the assistant's tool_calls
messages.append({ # your tool's result
"role": "tool",
"tool_call_id": call.id,
"content": '{"tempC": 18, "sky": "clear"}',
})
final = client.chat.completions.create(model="qwen-2.5-7b-instruct", messages=messages, tools=tools)
print(final.choices[0].message.content)
Notes
tool_choice—"auto"(default),"none","required", or a specific function are supported and forwarded to the model.- Streaming —
stream: trueforwards incremental token deltas from current node runtimes and ends with[DONE]. Older nodes fall back to one complete SSE chunk plus[DONE]; clients can detect the mode from thecolabhive-stream-modeSSE comment. - Multi-turn —
role: "tool"and assistant messages carryingtool_callsround-trip correctly.
Use it from an agent
To wire ColabHive into an agentic client (SuperClaw, OpenCode, Claude Code, …) as the cloud model, see Use ColabHive with SuperClaw / OpenCode.