Search1API文档

Ask

Agentic search API. A decision model detects intent from a natural-language request, routes it to up to five engines, and reranks results by relevance.

/ask is the Search1API agentic search endpoint. Use it when you know what you want but not where to look. A request such as "what are developers saying about Bun 1.3 this month" typically goes to community sources with a one-month window, while "recent papers on speculative decoding" goes to arXiv.

Search1API uses a decision model for intent detection, engine routing, and reranking. It currently uses TypeSafe's Jev, and support for more decision models is being added. Decision models return calibrated probabilities rather than generated text, and /ask does not write an answer. Your request, plus the titles and snippets of the results it returns, are sent to the model. For Hacker News, Reddit, and GitHub, the keywords are a phrase copied from your request by Cloudflare's Clairic extraction model, so your request is also sent to Cloudflare Workers AI. Ask is a Search1API product, not an official TypeSafe product.

The request takes one field, query. Search1API makes two decisions from it:

  • Engines. Search1API picks up to five of google, duckduckgo, yandex, hackernews, reddit, github, x, arxiv, wikipedia, imdb, wechat, and youtube. Naming a platform in the request, such as "on Reddit" or "papers", steers the choice.
  • Time window. Search1API applies day, week, month, or year when the request mentions a time. year means the past 365 days, not the current calendar year. No window is applied when it does not.

Every result is scored for relevance to your request. Results scoring below 0.5 are dropped, and duplicates across engines are merged. The response holds at most 10 results, and can hold fewer or none at all. Because off-topic results and duplicates are removed before the response is returned, an agent gets a shorter, on-topic result list from one call instead of reading several engines' raw rankings. intent shows the keywords, engines, and window that were used.

If some engines fail while others complete, the response lists the failures in errors and is still charged. If no engine completes, the API returns 502 and the request is not charged.

Use Search instead when you already know the engine and keywords and want that engine's own ranking.

A completed request costs 5 credits, however many engines are searched. /ask takes an API key or OAuth token, is limited to 30 requests per minute per account, and does not support pay-per-request payments. The official SDKs provide ask(), the CLI provides s1 ask, and the MCP server provides an ask tool.

POST
/ask

Authorization

bearerAuth
headerAuthorizationBearer <token>

Request Body

application/json
  1. body
query*string

What you are looking for, in natural language. Platform hints ("on Reddit", "papers") and time hints ("this week") steer engine and time-range selection.

Length1 <= length <= 500

Response Body

Successful response

application/json
  1. response
query*string

The query as sent.

intent*

How the request was interpreted and searched.

results*array<>

Relevant results from every engine, best first, with duplicates merged. May be empty.

errors*array<>

Engines that failed while others completed. The request is still charged.

curl -X POST 'https://api.search1api.com/ask' \  -H 'Content-Type: application/json' \  -d '{  "query": "What are developers saying about Bun 1.3 this month?"}'
{  "query": "string",  "intent": {    "search_query": "string",    "sources": [      "string"    ],    "time_range": "day"  },  "results": [    {      "title": "string",      "link": "http://example.com",      "snippet": "string",      "published_date": "string",      "source": "string",      "relevance": 0    }  ],  "errors": [    {      "source": "string",      "message": "string"    }  ]}