API
Tool calls
Function calling through DigitSpace in OpenAI or Anthropic format, translated between the two, and routed only to models that support tools.
Send tools as you would to OpenAI (on /v1/chat/completions) or to Anthropic (on /v1/messages). The gateway translates tool definitions, tool calls and tool results between the two formats, so either works with any model that supports tools.
tools = [{
"type": "function",
"function": {
"name": "get_weather",
"description": "Current weather for a city",
"parameters": {
"type": "object",
"properties": {"city": {"type": "string"}},
"required": ["city"],
},
},
}]
reply = client.chat.completions.create(
model="auto",
messages=[{"role": "user", "content": "Is it raining in Singapore?"}],
tools=tools,
)
call = reply.choices[0].message.tool_calls[0]
print(call.function.name, call.function.arguments)Then send the result back as a tool message (or a tool_result block on /v1/messages) and call again, as with OpenAI or Anthropic.
Which models are used
A request with a non-empty tools list only goes to providers whose offer supports tools. With auto, it also goes to a model of at least the standard level, whatever the quality setting; see auto. If you name a model that can't call tools, you get 400 capability_mismatch.
tool_choice
| OpenAI | Anthropic | |
|---|---|---|
"auto" | {"type": "auto"} | The model decides. |
"required" | {"type": "any"} | The model must call a tool. |
"none" | {"type": "none"} | No tool calls. |
{"type": "function", "function": {"name": …}} | {"type": "tool", "name": …} | Call this tool. |
The gateway maps each to the other format when it translates.
Limits
- Tool results are passed as text. Images inside a tool result are dropped when the request is translated between formats.
- On DigitSpace credits, only your own function tools are sent. A provider's built-in tools (such as web search or code execution) are removed; they work on your own provider key.
parallel_tool_callsis sent to OpenAI-format providers and dropped for the others.
Checked against the gateway on 31 October 2026. Something wrong or missing? Tell us.