Function Calling
Function calling provides a powerful and flexible way for some models to interface with your code or external services. This guide will explain how to connect the models to your own custom code to fetch data or take action.
from openai import OpenAI client = OpenAI( base_url="https://api.livrouter.com/v1") tools = [{ "type": "function", "name": "get_weather", "description": "Get current temperature for a given location.", "parameters": { "type": "object", "properties": { "location": { "type": "string", "description": "City and country e.g. Bogota, Colombia" } }, "required": ["location"], "additionalProperties": False }}] response = client.responses.create( model="gpt-6-sol", input=[{"role": "user", "content": "What is the weather like in Paris today?"}], tools=tools) print(response.output)Note: Support depends on your plan and selected model. Check the model catalog or the dashboard page before sending requests.