Gateway API
Web search
Web results through the Gateway: a query in, titles, links and snippets out, priced per search and returned with the same receipt headers as chat.
Authenticate with a Lobstack API key as a bearer token, as for Chat Completions. Any key with the inference scope can search, whatever runs the agent's models: Lobstack, your own provider key, or GitHub Copilot. Results come from the Brave Search API's own index and are always served on Lobstack's key, so every search is billed like a call on Lobstack's keys. The Lobstack app uses this endpoint first when an agent searches the web, and falls back to your own search or the browser when it answers 402 or 503.
Request body
- querystringrequired
- What to search for. 1 to 400 characters after trimming.
- countintegerdefault: 5
- How many results, from 1 to 10. Fewer may come back.
- metadataobject
- Not sent to the provider.
metadata.clientis read as the client tag. See Clients.
Response
{
"query": "why did the deploy roll back",
"results": [
{
"title": "Rollbacks and failed health checks",
"url": "https://example.com/rollbacks",
"snippet": "A deploy rolls back when the new version fails its health check…"
}
]
}Snippets are plain text: the provider's highlighting markup is removed and entities are decoded. Every result carries its URL, so an answer built on it can cite its source.
Price and metering
web-search is priced per search, not per token, the same way as model calls on Lobstack's keys. Inside your plan's included usage, and on the Free plan's starting credit, a search costs Brave's published price: $0.005 ($5.00 per 1,000). Past the included usage it is provider price + 50%: $0.00750 a search, from purchased credit. Brave's price was checked on 2026-09-29. A search that fails at the provider costs nothing.
Each search writes a ledger row with zero tokens and that cost, draws down the same allowance as model spend, and counts toward client budgets and the rate limits. The receipt headers are the ones listed on Metering & cost, with x-lobstack-model: web-search and x-lobstack-mode: managed.
The same query (ignoring case and spacing) with the same count, from the same organization within 10 minutes, may be answered from a short cache. A cached answer is free: it carries x-lobstack-cache: hit, a cost of 0 and no ledger row, and still shows in Logs. A fresh answer carries x-lobstack-cache: miss.
Errors
| Status | error_code | When |
|---|---|---|
| 400 | INVALID_PARAMETER | A missing, empty or over-long query, or a count outside 1 to 10. |
| 401 | The API key is missing, invalid or revoked. | |
| 402 | FREE_CREDIT_USED | The Free plan's starting credit is used. |
| 402 | ALLOWANCE_EXHAUSTED | A paid plan's included usage and credit are used. |
| 402 | INSUFFICIENT_ALLOWANCE | What is left will not cover one more search. |
| 402 | KEY_CAP_REACHED, PERSON_CAP_REACHED, CLIENT_BUDGET_EXHAUSTED | A spend cap or the client's budget is spent. |
| 429 | RATE_LIMITED | The Gateway's shared rate limit (120 requests a minute per key). |
| 429 | SEARCH_RATE_LIMITED | Search's own limit: 30 searches a minute per key. |
| 429 | SPEND_IN_FLIGHT | Calls already running have reserved what is left. Retry when they finish. |
| 429 | The search provider's own limit. | |
| 502 | The search provider failed. Nothing is charged. | |
| 503 | SEARCH_UNAVAILABLE | Search is not configured on this deployment. Retry-After is 10 minutes. |
| 503 | MANAGED_DISABLED | Calls on Lobstack's keys are paused. |
| 504 | The search provider did not answer within 10 seconds. |
Examples
curl -i https://www.lobstack.ai/api/gateway/v1/search \
-H "Authorization: Bearer $LOBSTACK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query": "why did the deploy roll back", "count": 5}'