AI Proxy
Give every model behind AI Proxy live web search from SpecStream's Search API. AI Proxy's Web Search plugin takes a SearchXNG engine with a Base URL, and SpecStream answers at that address in SearXNG's own format, so there is no search server to run.
SpecStream for AI ProxyAPI & cloud platformsWhat you need
- An AI Proxy deployment, and its
ADMIN_KEYto sign in to the admin. - A SpecStream API key that can search. Create an account if you have none.
- 1
1. Copy a SpecStream key
Open the Search API screen of your SpecStream workspace and copy a key. A key that searches has the
finds:spendscope and a spending limit above 0. - 2
2. Turn on the Web Search plugin
Sign in to the AI Proxy admin with your
ADMIN_KEY. Open Model in the sidebar and select Edit on the model that should search. Under Plugin Configuration, turn on Web Search Plugin. - 3
3. Add SpecStream as a SearchXNG engine
Select Add Search Engine and set Engine Type to SearchXNG. In Base URL, enter the address below, with your key in place of
YOUR_SPECSTREAM_KEY.AI Proxy adds
/search?q=...&format=jsonto the Base URL and sends no key header, so the key goes in the address. Treat the Base URL as a secret.AI Proxy asks every engine in the list for every query, so remove the Bing or Google engine you are replacing once SpecStream answers.
Base URL - 4
4. Save and send a request
Select Update to save the model. With Force search on every request off, a request searches only when it carries
web_search_options. Send one through AI Proxy to check it:POST /v1/chat/completions
The same setting in the model config
The form saves the engine in the model's config under plugin, web-search, search_from, as {"type": "searchxng", "spec": {"base_url": "https://api.specstream.ai/searxng/YOUR_SPECSTREAM_KEY"}}.
The admin API saves a model's config at POST /api/model_config/{model}, with the admin key as a Bearer token. The call saves the object it is sent, so send the model's whole config with the engine added.
How many searches an answer makes
AI Proxy asks each engine once for each search query, for 10 results each time. With SpecStream as the only engine:
- Without query rewriting, a request makes one search.
- With
search_rewriteon,max_countsets the number of queries, 3 by default. search_context_sizein the request overrides it:lowmakes 1 search,medium3 andhigh5.
References in the answer
Set need_reference to true and the answer numbers the pages it used as [1], [2] and so on. reference_location and reference_format set where the list goes and how it prints. SpecStream returns each result's title, url and content, which AI Proxy reads as the page's title, link and text.
Moving off the Google or Bing engine
AI Proxy's Google engine calls Google's Custom Search JSON API at www.googleapis.com, which Google ends for existing customers on January 1, 2027. Its Bing engine calls api.bing.microsoft.com. Neither engine takes another address, so the move is the SearchXNG engine above: add it, send a test request, then remove the old engine.
The web-search MCP server
AI Proxy's built-in web-search MCP server takes the same address in its searchxng_base_url setting (SearchXNG Base URL). Set its default_engine to searchxng to send its searches to SpecStream.
Cost
Each search is one Search API call. A SearXNG search runs the fast search, which costs less than the default search at $5 per 1,000 searches of up to 10 results. Search API lists both prices. A search that returns no results costs nothing. It comes out of your balance, with no quote and no approval. New accounts start with $10 of credit, no card.
If search fails
AI Proxy logs searchxng search failed: with the status and the reply, and the model answers without search results. AI Proxy waits up to 15 seconds for a SearchXNG reply.
401withinvalid_token: the key in the Base URL is wrong, expired or revoked.402: the balance is empty.403: the key has nofinds:spend, or the call would pass the key's spending limit.429withRetry-After: search is busy. Nothing is charged.
Remove SpecStream
Remove the SearchXNG engine in the model's Web Search Plugin settings, then revoke the key under Agents & API in your SpecStream workspace. Questions: [email protected].
More
SpecStream for AI Proxy covers what it does in AI Proxy on one page. Every other tool has its guide in Connect your tools. You see the most a request can cost before it starts, and the matches are paid from your balance. Billing has the details. For help, email [email protected].