Tool Calling

The Infron supports Anthropic-compatible function calling, allowing models to call tools and functions.

Example request

import os
import anthropic
 
client = anthropic.Anthropic(
    api_key="<API_KEY>",
    base_url='https://llm.onerouter.pro'
)
 
message = client.messages.create(
    model='claude-sonnet-4-5@20250929',
    max_tokens=1024,
    tools=[
        {
            'name': 'get_weather',
            'description': 'Get the current weather in a given location',
            'input_schema': {
                'type': 'object',
                'properties': {
                    'location': {
                        'type': 'string',
                        'description': 'The city and state, e.g. San Francisco, CA'
                    },
                    'unit': {
                        'type': 'string',
                        'enum': ['celsius', 'fahrenheit'],
                        'description': 'The unit for temperature'
                    }
                },
                'required': ['location']
            }
        }
    ],
    messages=[
        {
            'role': 'user',
            'content': 'What is the weather like in San Francisco?'
        }
    ],
)
 
print('Response:', message.content)

Tool call response format

When the model makes tool calls, the response includes tool use blocks:

Last updated