Guides
Tool calling

Tool calling

Routify supports OpenAI-style tools parameter on capable models.

Capable models

ModelSupportedQuality
kimi-k2.5Excellent
glm-4.6Excellent (most agent-tuned in CN)
qwen3-maxGood
deepseek-v3.2OK (slightly flaky)
claude-sonnet-4-6 / opus-4-7Excellent
gpt-4oExcellent
o1Not yet supported by OpenAI

Example

tools = [{
    "type": "function",
    "function": {
        "name": "get_weather",
        "description": "Get the current weather for a location",
        "parameters": {
            "type": "object",
            "properties": {
                "location": {"type": "string", "description": "City name"},
                "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]}
            },
            "required": ["location"]
        }
    }
}]
 
resp = client.chat.completions.create(
    model="kimi-k2.5",
    messages=[{"role": "user", "content": "Weather in Shanghai?"}],
    tools=tools,
)
 
# Check if model wants to call a tool
if resp.choices[0].finish_reason == "tool_calls":
    tool_call = resp.choices[0].message.tool_calls[0]
    # tool_call.function.name == "get_weather"
    # tool_call.function.arguments == '{"location": "Shanghai", "unit": "celsius"}'
    pass

Forcing a specific tool

tool_choice={"type": "function", "function": {"name": "get_weather"}}

Forcing JSON mode (no tools, just structured output)

response_format={"type": "json_object"}