Clivern
π° πππππ πππ π΄πππππππ πππ πΎπππππππππ ππππππ.
14 August 2025
Tool calling is a powerful feature in modern Large Language Models that enables them to interact with external systems and APIs. This article demonstrates the difference between a standard LLM request and one that leverages tool calling.
When you ask an LLM about real-time information like Bitcoin prices, it canβt directly access that data. Letβs see what happens with a standard request:
curl https://api.openai.com/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "o4-mini",
"messages": [{"role": "user", "content": "What is the current price of Bitcoin in USD?"}]
}'
{
"choices": [{
"message": {
"role": "assistant",
"content": "I'm not able to pull live market data directly, but you can check Bitcoin's real-time USD price on any major exchange or data provider..."
},
"finish_reason": "stop"
}],
"usage": {
"completion_tokens": 287,
"reasoning_tokens": 128
}
}
Tool calling allows you to define functions that the LLM can βcallβ when it needs external data or actions. The LLM doesnβt actually execute these functionsβit identifies when theyβre needed and returns structured instructions for your application to execute them.
curl https://api.openai.com/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "o4-mini",
"messages": [{"role": "user", "content": "What is the current price of Bitcoin in USD?"}],
"tools": [
{
"type": "function",
"function": {
"name": "get_bitcoin_price",
"description": "Get the current price of Bitcoin",
"parameters": {
"type": "object",
"properties": {
"currency": {
"type": "string",
"description": "The currency to get the price in"
}
},
"required": ["currency"]
}
}
}
]
}'
{
"choices": [{
"message": {
"role": "assistant",
"content": null,
"tool_calls": [{
"id": "call_GxQeC2epvqEUQyJbTn7LzLSE",
"type": "function",
"function": {
"name": "get_bitcoin_price",
"arguments": "{\"currency\":\"USD\"}"
}
}],
"finish_reason": "tool_calls"
}
}],
"usage": {
"completion_tokens": 89,
"reasoning_tokens": 64
}
}
User β LLM
get_bitcoin_price as the appropriate tool{"currency": "USD"}tool_call instruction (not the actual result)Application β External API
tool_call from LLM{"price": 95234.50, "currency": "USD"}LLM β User
It is worth noting that the LLM doesnβt execute functions. it identifies which function to call and what parameters to use. Your application handles the actual execution.