Tool calls and function calls

HiWay is tool-calling transparent across every supported provider.

Every supported provider implements tool calling differently under the hood (Anthropic uses tool_use blocks, OpenAI uses tool_calls arrays). HiWay accepts the OpenAI wire format on input and hands whatever the provider returns back to you — unchanged.

Routing implications

Requests with tools in the body are detected by the scoring engine as higher complexity — we bias the routing toward standard or heavy automatically. Simple classification queries that don't declare tools stay in light.

Model compatibility

Not every model supports tool use. If you pin a tier (e.g. light) and the routed model doesn't support tools, HiWay falls back to the next tier that does — transparently. Look at X-HiWay-Model in the response to confirm which model answered.

Example

python
tools = [{
    "type": "function",
    "function": {
        "name": "get_weather",
        "description": "Get current weather for a city",
        "parameters": {
            "type": "object",
            "properties": {"city": {"type": "string"}},
            "required": ["city"],
        },
    },
}]

response = client.chat.completions.create(
    model="auto",
    messages=[{"role": "user", "content": "What's the weather in Paris?"}],
    tools=tools,
)

# tool_calls comes back in the exact OpenAI format, regardless of which
# provider answered (Anthropic, Google, Mistral, etc.)
print(response.choices[0].message.tool_calls)