Tool Calling with the AI API in India | unoblox
Add function and tool calling to your app using unoblox's rupee-billed AI API — request shape, model picks, and common patterns explained.
Tool calling — also called function calling — lets a model decide when to invoke one of the functions you describe to it, instead of only replying in prose. It is what turns a chat model into an agent that can look up an order, query a database, or fetch live data before answering. On unoblox this works with the same request shape the OpenAI SDK already uses, against one rupee-billed endpoint, so an India-based team can build agentic features without juggling separate credentials or currencies per provider.
What tool calling actually does
You pass a list of tools (name, description, JSON-schema parameters) alongside your messages. Instead of only returning text, the model can return a structured call — which tool to run and with what arguments — and your application executes it and feeds the result back in the next turn. The model itself never runs the function; it only decides when to ask for it.
Defining a tool in the request
curl https://api.unoblox.ai/v1/chat/completions \
-H "Authorization: Bearer ub-gw-your-key-here" \
-H "Content-Type: application/json" \
-d '{
"model":"openai/gpt-5-mini",
"messages":[{"role":"user","content":"What is the delivery status for order 4021?"}],
"tools":[{"type":"function","function":{"name":"get_order_status","description":"Look up an order by id","parameters":{"type":"object","properties":{"order_id":{"type":"string"}},"required":["order_id"]}}}]
}'
The response, when the model chooses to call the tool, includes the function name and arguments instead of a plain-text answer — your code runs get_order_status, then sends the result back as a follow-up message.
Picking a model for tool-heavy workflows
Tool calling is broadly supported, but reliability at following a schema varies by model tier. A reasonable spread by budget:
- Everyday agents: DeepSeek V4 Flash (₹9.07 / ₹18.14 per 1M tokens) for cheap, frequent tool checks.
- General-purpose agents: GPT-5 mini (₹25.2 / ₹201.6) or Qwen3 235B-A22B (₹9.07 / ₹55.44).
- Complex, multi-step tool chains: Claude Sonnet (₹201.6 / ₹1008) or GPT-5 (₹126 / ₹1008).
- Anything not listed here, including o3-mini and Claude Haiku, still supports tools — check
/modelsfor live ₹ pricing before you commit a workload to it.
Common tool-calling patterns
- Single lookup: one tool, one call, answer the user directly with the result.
- Multi-tool routing: give the model several tools and let it pick the right one per request — useful for a support bot that can check orders, refunds, or account status.
- Chained calls: the model calls a tool, reads the result, and decides whether a second tool call is needed before replying — common in research or data-gathering agents.
- Parallel calls: some models can request more than one tool in a single turn, which your application executes concurrently before responding.
Frequently asked questions
Do I need a different request format per model provider?
No. unoblox normalises the OpenAI-style tools parameter across the catalog, so the same request body works whether the underlying model is GPT, Claude, DeepSeek, or Qwen.
What happens if the model calls a tool that doesn't exist?
It won't, as long as you only reference tools you declared in the request — the model is constrained to the list you pass in tools.
Is tool calling billed differently from a normal chat completion? No — the tokens used to describe your tools and read back the results are billed the same as any other input and output tokens, in ₹, on your monthly invoice.
Can smaller, cheaper models handle tool calling reliably? Smaller models can call tools, but the more steps or the more tools you offer at once, the more a stronger model tends to help — start cheap and move up only where you see failures.
Does unoblox support parallel tool calls?
Where the underlying model supports it, yes — check the individual model page under /models for its specific tool-calling behaviour.
Get started in rupees → https://unoblox.ai/sign-in
More from unoblox
Developer Guides
AI API Rate Limits Explained (India Guide)
Developer Guides
How to Get an AI API Key in India
Developer Guides
Migrate from Azure OpenAI to unoblox (India)
Developer Guides
JSON Mode with the AI API in India | unoblox
Developer Guides
Streaming AI API Responses in India | unoblox
Developer Guides
AI API for Agencies in India | unoblox
Start building in rupees
Call every major model through one OpenAI-compatible endpoint, billed in ₹ on a GST invoice.