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:
- Replace base URL with
https://api.exa.ai - Replace API key with your Exa API key
- 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.
Synchronous
The request blocks until the run completes and returns the terminalresponse object.
Streaming
Setstream: 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
Setbackground: 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.exa.search() function.