websearch.fast
控制台获取密钥

错误

原生路径的错误都用同一种格式,与模型 API 的错误对象相同,所以 OpenAI SDK 的错误处理照常可用,只是顶层多了一个 request_id。

{
  "error": {
    "code": "fetch_failed",
    "message": "The page could not be read. (request id: 20261128120008123456789a1b2c3d4Kx7Qm2Ph)",
    "type": "invalid_request_error",
    "param": "url"
  },
  "request_id": "20261128120008123456789a1b2c3d4Kx7Qm2Ph"
}
字段含义
error.code稳定的机器可读错误码。先看 HTTP 状态码,再看这个错误码。
error.message写给人看的说明。英文,以请求 ID 结尾,内容可能会变。
error.typeinvalid_request_error(大多数 4xx)、authentication_error(401)、permission_error(403)、rate_limit_error(429)、server_error(5xx)。
error.param出错的字段、请求头或查询参数及其完整路径,没有时不返回。
error.detail与错误码相关的可选信息,例如速率限制的 retry_after_seconds 和 limit。
request_id与 X-Request-Id 响应头相同。

兼容路径会在顶层另外返回 message 和 statusCode。MCP 服务器把工具错误作为工具结果返回,带 isError: true 和同样的 code。

错误码

所有错误都不计费。下表只有英文版。

StatusCodeWhen
400invalid_requestA field, header or query parameter is missing, malformed, out of range, or conflicts with another; a duplicate JSON key; an unknown field on a native path. param names it.
400invalid_urlA URL is not http(s), is malformed, points to a private, loopback or reserved address, or to a non-standard port.
400invalid_schemaA JSON Schema of extract breaks its rules. param is the JSON pointer.
400invalid_imagelens could not load or decode the image, or it is too large.
401invalid_tokenThe key is missing, unknown, disabled, expired or exhausted. Message Invalid token.
402insufficient_user_quotaThe balance does not cover the maximum price of the call, or the max_cost_usd of a job.
403pre_consume_token_quota_failedThe spending limit of the key is used up.
403access_deniedThe key has an IP allowlist and the caller is not on it.
403web_not_allowedThe key may not use the Web API (a key restriction set by the account).
404not_foundUnknown or expired job, place_id or page_token.
404invalid_endpointUnknown path under /v1/web.
405method_not_allowedWrong method on a known path.
409idempotency_conflictIdempotency-Key reused with a different request.
409request_in_progressA create with this Idempotency-Key is still running. Has Retry-After.
413read_request_body_failedThe request body is over the size limit; the message states the limit.
415unsupported_contentThe page or file is of a type that is not read: video, archive, executable or unknown binary.
422fetch_failedThe page could not be read: DNS failure, connection refused, TLS failure, the site answered 4xx or 5xx, an empty body, or more than 10 redirects.
422site_refusedThe robots.txt of the site does not allow automated agents to read this URL, or the site declined the request.
422page_too_largeThe page or file is larger than the read limit and could not be read even in part.
422extraction_failedextract could not produce data that validates, or a required value is not in the pages.
429rate_limitedThe key or account is over its rate limit. Has Retry-After and the X-RateLimit-* headers.
429concurrency_limitedToo many calls or jobs of this key at the same time. Has Retry-After: 1.
429api_key_temporarily_frozenThe key is paused for a while after too many invalid requests. Has Retry-After.
500internal_errorSomething failed on our side. Retry; with Idempotency-Key a create retry is safe.
501api_not_implementedThe endpoint, type, option or compatibility path has not shipped yet.
503source_unavailableNo source could answer in time. Has Retry-After.
503web_api_disabledThe Web API or this endpoint is switched off for the moment, or no price is set for it.
503billing_busyThe charge could not be prepared for a moment. Has Retry-After: 1.
503token_cache_busyThe key check is busy for a moment. Has Retry-After: 1.
504timeoutNothing complete before the deadline of the call (timeout_ms or the endpoint maximum).

警告

警告不是错误。200 响应可能带 warnings,这是一个对象列表,每个对象有一个 code。

CodeWhen
no_resultsThe call ran and found nothing. Not charged.
content_partialFewer content pages were read than asked. Only the pages delivered are charged.
partialSome parts of the call could not be delivered. Only the delivered parts are charged.
all_failedNo part of the call could be delivered. Nothing is charged.
reach_reducedThe call ran without the extra attempts for pages and searches that are hard to reach.

如果一个账户最近的调用耗费的工作量超出了计费量(例如大量网页没能读取),响应会带上 reach_reduced。这时调用照常返回,但对难以访问的网页和搜索,本次调用不再换用成本更高的方式重试。每次计费的调用和每天的自动补充,都会让完整的访问范围逐步恢复。用你的密钥调用 GET /v1/web/status,在 key.reach 里可以看到当前状态。

任务失败(research、crawl、异步 batch)记录在任务的 error 里,错误码相同,另外还有 budget_exhausted 和 job_expired。预算用完的任务以 succeeded 结束,并带 stop_reason: "budget"。

什么时候重试

响应是否重试
429重试,等到 Retry-After 之后。
500, 503, 504重试,使用带随机抖动的指数退避,并设上限。遇到 504 时,调大 timeout_ms 或减少 content.pages 可能有用。
409 request_in_progress重试,等到 Retry-After 之后,使用相同的 Idempotency-Key 和请求体。
422 fetch_failed可以稍后再试。目标站点本身可能会暂时出故障。
422 site_refused不重试。重复请求还是同样的结果。
其他 4xx不重试。先修正请求。