Tool Calling
import requests
import json
url = "https://llm.onerouter.pro/v1/responses"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer <API_KEY>",
}
data = {
"model": "google/gemini-3-flash",
"input": [
{
"type": "message",
"role": "user",
"content": "What is the weather like in New York?",
}
],
"tools": [
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get the current weather in a location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA",
},
},
"required": ["location"],
},
},
}
],
"tool_choice": "auto",
}
response = requests.post(url, headers=headers, json=data)
response.raise_for_status()
result = response.json()
print(json.dumps(result, indent=2))Tool call response
Tool choice options
Last updated