Function Calling
Define custom functions that the model can invoke. The model returns a tool call with arguments; your application executes the function and returns the result.
curl -X POST http://localhost:18645/v1/chat/completions -H "Authorization: Bearer $API_KEY" -H "Content-Type: application/json" -d '{
"model": "gpt-4o",
"messages": [{"role": "user", "content": "What is the weather in Seoul?"}],
"tools": [{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get current weather for a location",
"parameters": {
"type": "object",
"properties": {
"location": {"type": "string", "description": "City name"}
},
"required": ["location"]
}
}
}]
}'