> ## Documentation Index
> Fetch the complete documentation index at: https://openai-hd4n6.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Built-in tools

> Use built-in tools like web search and file search to extend the model's capabilities.

When generating model responses, you can extend model capabilities using built-in **tools**. These tools help models access additional context and information from the web or your files. The example below uses the [web search tool](/docs/guides/tools-web-search) to use the latest information from the web to generate a model response.

<CodeGroup>
  ```javascript javascript theme={"system"}
  import OpenAI from "openai";
  const client = new OpenAI();

  const response = await client.responses.create({
      model: "gpt-4.1",
      tools: [ { type: "web_search_preview" } ],
      input: "What was a positive news story from today?",
  });

  console.log(response.output_text);
  ```

  ```python python theme={"system"}
  from openai import OpenAI
  client = OpenAI()

  response = client.responses.create(
      model="gpt-4.1",
      tools=[{"type": "web_search_preview"}],
      input="What was a positive news story from today?"
  )

  print(response.output_text)
  ```

  ```bash curl theme={"system"}
  curl "https://api.openai.com/v1/responses" \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer $OPENAI_API_KEY" \
      -d '{
          "model": "gpt-4.1",
          "tools": [{"type": "web_search_preview"}],
          "input": "what was a positive news story from today?"
      }'
  ```
</CodeGroup>

## Available tools

Here's an overview of the tools available in the OpenAI platform—select one of them for further guidance on usage.

<CardGroup cols={1}>
  <Card title="Web search" icon="globe" iconType="solid" href="/docs/guides/tools-web-search" horizontal>
    Include data from the Internet in model response generation.
  </Card>

  <Card title="File search" icon="file" iconType="solid" href="/docs/guides/tools-file-search" horizontal>
    Search the contents of uploaded files for context when generating a response.
  </Card>

  <Card title="Computer use" icon="computer" iconType="solid" href="/docs/guides/tools-computer-use" horizontal>
    Create agentic workflows that enable a model to control a computer interface.
  </Card>

  <Card title="Function calling" icon="code" iconType="solid" href="/docs/guides/function-calling" horizontal>
    Enable the model to call custom code that you define, giving it access to additional data and capabilities.
  </Card>
</CardGroup>

## Usage in the API

When making a request to generate a [model response](/docs/api-reference/responses/create), you can enable tool access by specifying configurations in the `tools` parameter. Each tool has its own unique configuration requirements—see the [Available tools](/docs/guides/?api-mode=responses#available-tools) section for detailed instructions.

Based on the provided [prompt](/docs/guides/text), the model automatically decides whether to use a configured tool. For instance, if your prompt requests information beyond the model's training cutoff date and web search is enabled, the model will typically invoke the web search tool to retrieve relevant, up-to-date information.

You can explicitly control or guide this behavior by setting the `tool_choice` parameter [in the API request](/docs/api-reference/responses/create).

### Function calling

In addition to built-in tools, you can define custom functions using the `tools` array. These custom functions allow the model to call your application's code, enabling access to specific data or capabilities not directly available within the model.

Learn more in the [function calling guide](/docs/guides/function-calling).
