Skip to main content
New to Exa? Try the Coding Agent Quickstart to get started in under a minute.

What is Exa?

Use Exa to find information across the web and return links and page content to your model. Exa uses semantic search to match the meaning of a query, not only exact keywords.

Get started

First, you’ll need API keys from both OpenAI and Exa:

Complete example

Both examples show how to:
  1. Set up the OpenAI Response API with Exa as a tool
  2. Make a request to OpenAI
  3. Handle the search function call
  4. Send the search results back to OpenAI
  5. Get the final response
Set OPENAI_API_KEY and EXA_API_KEY in your environment before running these examples.

How tool calling works

Let’s break down how the Exa web search tool works with OpenAI’s Response API:
  1. Tool Definition: First, we define our Exa search as a tool that OpenAI can use:
  2. Initial Request: When you send a message to OpenAI, the API looks at your message and decides if it needs to search the web. If it does, instead of giving a direct answer, it will return a “function call” in its output.
  3. Function Call: If OpenAI decides to search, it returns something like:
  4. Search Execution: Your code then:
    • Takes this search query
    • Calls Exa’s API to perform the actual web search
    • Gets real web results back
  5. Final Response: You send these web results back to OpenAI, and it gives you a final answer using the fresh information from the web.
This back-and-forth process happens automatically in the code above, letting OpenAI use Exa’s web search when it needs to find current information.
Last modified on July 31, 2026