> ## Documentation Index
> Fetch the complete documentation index at: https://docs.geekai.co/llms.txt
> Use this file to discover all available pages before exploring further.

# 函数调用

函数调用的流程和对话完成接口类似，下面我们还是以获取当地天气为例，给出函数调用的 Response API 示例代码：

<CodeGroup>
  ```bash curl theme={null}
  curl --location --request POST 'https://geekai.co/api/v1/responses' \
  --header 'Authorization: Bearer {YOUR_GEEKAI_API_KEY}' \
  --header 'Content-Type: application/json' \
  --data-raw '{
      "model": "gpt-5-mini",
      "input": "杭州今天天气如何?",
      "tools": [
        {
          "type": "function",
          "name": "get_current_weather",
          "description": "Get the current weather in a given location",
          "parameters": {
            "type": "object",
            "properties": {
              "location": {
                "type": "string",
                "description": "The city and state, e.g. 浙江杭州"
              },
              "unit": {
                "type": "string",
                "enum": ["℃", "℉"]
              }
            },
            "required": ["location", "unit"]
          }
        }
      ],
      "tool_choice": "auto"
  }'
  ```
</CodeGroup>
