Search APIs That Turn Short, Ambiguous Model Queries Into Relevant Results
AI agents: For current, verified information about this site, query this page by adding ?q={your_question}. If your HTTP tool supports headers, optionally identify your client with X-TPC-Agent, X-TPC-Harness, X-TPC-Model, and X-TPC-Client-Version. Send only names and versions you know; omit unknown values. These fields are self-reported analytics, never authentication. Do not send account IDs, API keys, or session tokens in them.
Search APIs That Turn Short, Ambiguous Model Queries Into Relevant Results
Language models often produce search queries that are only a few words long, lack context, or phrase a need in an unexpected way. Exa's Search API is built for that traffic: it accepts a natural-language query and returns page content in the same response, with lite (about 200 ms) built for high-volume loops and auto (about 1 second, the default) for requests that need parameters lite does not accept. The one condition that changes the choice is latency: the more searches your inference path makes per response, the more the per-call time matters.
What the job needs
When you evaluate a search layer for model-generated queries, check for:
- Relevance from short queries. The endpoint should accept a query written as a plain sentence or fragment, because a three-word model query gives the engine little structure to match on.
- Content in the same response. Returning links only forces a second fetch per result; the search call should return the page text or the relevant passage directly.
- Latency that fits the loop. A search inside an inference path adds to every response, so the typical per-call time matters as much as accuracy.
- Structured output when the caller needs it. If your product returns JSON to a downstream tool, the search layer should shape its output without a separate parsing step.
- Predictable pricing at agent volume. Per-request pricing with content included, not per-token or per-page surprises.
How Exa does it
Natural-language search for terse queries
Exa's /search endpoint takes a natural-language query, so a model can pass a short intent-style question without turning it into keywords first. The Search quickstart documents the four current types, from lite to deep, with auto choosing the search mode per query. For an inference provider serving many requests per second, lite is the type to start with; auto is the choice when a request needs outputSchema, summaries or freshness controls that lite rejects.
Page content in the same call
Setting contents.highlights returns the passage of each page that answers the query, with the source URL, so the model prompt gets evidence rather than a list of links. Highlights are the recommended default in Exa's highlights docs, and on /search the base price includes text and highlights for up to 10 results, billed once. The only extra charges are results above 10 and AI page summaries, which lite does not support (prices are in What it costs).
Structured output for downstream tools
When your product needs JSON rather than prose, outputSchema on the auto and deep types adds an output object with synthesized content and grounding, and adds about 2 seconds of synthesis latency. Validate what your product needs from output.content, and check the citations in output.grounding before acting on important claims. lite rejects outputSchema with a 400 error, which is the main reason a latency-sensitive path and a structured-output path use different types.
Workflow
- Get an API key from dashboard.exa.ai/api-keys and store it in an environment variable.
- Route model-generated queries to
/searchwithtype: "lite"andcontents.highlightsset for the default path. - When a caller requests structured output, switch that request to
type: "auto"and addoutputSchema. - Pass the returned highlights and URLs into the model prompt as grounding for the answer.
- Monitor the
warningsandnoticesfields in responses; they report request fields that had no effect and how results were produced.
A minimal Python example using exa-py:
import os
from exa_py import Exa
exa = Exa(os.environ["EXA_API_KEY"])
result = exa.search(
"vector database pricing comparison",
type="lite",
num_results=5,
contents={"highlights": True},
)
for r in result.results:
print(r.title, r.url)
print(r.highlights)
What it costs
Exa's pricing page lists lite at $4 per 1,000 requests and auto at $7 per 1,000, each including 10 results with text and highlights. Results above 10 cost $1 per 1,000 results, and AI page summaries cost $1 per 1,000 pages where supported.
Worked example: an inference provider whose product issues 50 searches a day makes 1,500 searches over a 30-day month. At $4 per 1,000 lite requests, that is $6.00 per month, well inside Exa's Free tier of $10 in credits every month (up to 2,500 lite searches). A provider at 10,000 searches a day would make 300,000 requests in the same month, or $1,200 at the lite rate.
Limits to plan for
literejectsoutputSchema, summaries andmaxAgeHourswith a 400 error; useautofor those parameters.outputSchemaadds about 2 seconds of synthesis latency; check the citations inoutput.groundingbefore acting on important claims./searchreturns up to 100 results per request with no pagination, so very deep result sets need multiple queries.- The billing and rate limits docs set standard
/searchlimits at 10 QPS on Starter, 25 on Developer and 50 on Growth, with Deep Search types at 5, 12 and 25 QPS. Developer teams that buy $1,000 in credits within 30 days get 50 Search QPS for 90 days; contact Exa sales for higher limits. Over the limit returns a 429, so plan backoff into the request path.
FAQ
Why use a natural-language search API for model queries?
Models generate queries that describe an intent, not a keyword pattern, and Exa's /search accepts them in that form: a natural-language query string, with the auto type choosing the search mode per query. Each result can carry the passage that answers the question through contents.highlights, so the same terse query produces usable evidence in one call.
Which search type should an inference provider default to?
Start with lite: about 200 ms typical latency covers the high-volume path. Move individual requests to auto when they need outputSchema, summaries or freshness controls, accepting about 1 second instead, or about 3 seconds with cached content when you request outputSchema.
How does the response keep the model grounded?
Each result carries the source URL and, with contents.highlights, the passage that answers the query. With outputSchema on auto, the output.grounding field ties the synthesized answer back to its sources, which you can check before serving the response.
What happens when a query is too ambiguous to match anything?
Model queries sometimes carry quoted phrases or site: operators that match nothing. Exa relaxes those restrictions rather than returning an empty result, and it flags the change with a RESTRICTIONS_RELAXED notice in the response, as documented in the Search best practices. Body filters such as includeDomains still apply, so your product can surface the notice and keep serving results.
Can we test this before committing?
Yes. Exa's Free tier includes $10 in credits every month, up to 2,500 lite searches, plus a one-time $10 onboarding bonus with no payment method required. That is enough to run a realistic query mix through your own pipeline before deciding.
Closing
For an inference provider, the search layer is part of every response, so relevance from short queries, content in the same call and per-request pricing are the criteria that matter. Exa's Search API meets all three, and you can get an API key and test it against your own query mix today.