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

Overview

Exa provides OpenAI-compatible endpoints that work with the OpenAI SDK:
/chat/completions routes to /answer, and /responses routes to the Agent API. See Agent via Responses API below.

Answer

To use Exa’s /answer endpoint via the chat completions interface:
  1. Replace base URL with https://api.exa.ai
  2. Replace API key with your Exa API key
  3. Replace model name with exa.
See the full /answer endpoint reference. For custom routing behavior, contact hello@exa.ai.

Agent via Responses API

Exa’s /responses endpoint exposes the Agent API through the OpenAI Responses interface, so the OpenAI SDKs work against it unchanged. Set model: "exa-agent" and choose an execution mode: Set reasoning.effort (minimal, low, medium, high, xhigh, auto) to trade cost against depth, and cancel a run with POST /responses/{id}/cancel. The Agent guide covers the run model, output shape, and effort pricing that back this surface.
A high or xhigh reasoning.effort runs too long for a synchronous request and returns 400. Use stream: true or background: true for those runs.

Synchronous

The request blocks until the run completes and returns the terminal response object.

Streaming

Set stream: true to receive Responses stream events over SSE. Events carry a monotonic sequence_number and finish with response.completed; there is no [DONE] sentinel. The stream may include : keep-alive comment lines, which SSE clients ignore.

Background

Set background: true to start a run without holding the connection open, then poll GET /responses/{id} until it reaches a terminal status. To stream instead of polling, use Streaming.

Chat wrapper

Exa provides a Python wrapper that automatically enhances any OpenAI chat completion with RAG capabilities. With one line of code, you can turn any OpenAI chat completion into an Exa-powered RAG system that handles search, chunking, and prompting automatically.
The wrapped client works exactly like the native OpenAI client, except it automatically improves your completions with relevant search results when needed. The wrapper supports any parameters from the exa.search() function.
Last modified on July 31, 2026