> For clean Markdown of any page on these docs, append `.md` to the page URL
> Full documentation index: https://you.com/docs/llms.txt
> Search over these docs using a free, read-only MCP server (it is the best way to pick the right API(s) for the job and understand how to use them): https://you.com/docs/_mcp/server
> Access web search, web fetch, and deep research tools using our product MCP server: https://api.you.com/mcp (use `/mcp/research` and `/mcp/finance` paths for Research and Finance Research respectively)
> Call live Web Search for free: append `?profile=free` to the MCP server path
> OpenAPI spec index: https://you.com/docs/openapi.json
> How to authenticate: https://you.com/docs/using-the-api/authentication
> Changelog: https://you.com/docs/changelog
> Full onboarding instructions for agents: https://you.com/SKILL.md

# Inference Router Tool Calling

## Declare a Function Tool

Declare function tools as you would for the OpenAI Chat Completions or Anthropic Messages API. The router passes them to the model. When the model calls one, the response has `finish_reason: "tool_calls"` and the calls in `message.tool_calls`.

```bash
curl https://api.you.com/v1/chat/completions \
  -H "Authorization: Bearer $YDC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "kimi-k3",
    "messages": [{"role": "user", "content": "What is the weather in Paris?"}],
    "tools": [{
      "type": "function",
      "function": {
        "name": "get_weather",
        "description": "Get the weather for a city.",
        "parameters": {
          "type": "object",
          "properties": {"city": {"type": "string"}},
          "required": ["city"]
        }
      }
    }]
  }'
```

Run the function yourself, then send its result back in a message with `role: "tool"` and the `tool_call_id` of the call. The model then answers.

Whether a model honors `tool_choice` is up to the model's vendor.

---

## Combine With Web Tools

A request can declare function tools and [web tools](/docs/guides/inference-router/web-tools) together. The router runs a turn that calls only web tools and continues. A turn that calls one of your function tools comes back to you with the tool calls, and the router does not run web tools in that turn. When a request declares both kinds, `parallel_tool_calls` defaults to `true` unless you set it.