ChatGPT API
ChatGPT 搜索 API
向 ChatGPT 提出一个基于网页搜索的问题,获得附带来源引用的回答。ChatGPT 每次请求都会重新撰写回答,因此同一提示词会返回不同的措辞和不同的来源组合。
POST/v1/run/chatgpt.search
可用率
97.39%
30d · 613 次调用
请求数
614
30d · 按周,近 12 周
响应时间
32.6s
中位数 · 30d
服务商网络
按流量排序的服务商
试一试
发出你的第一个请求
requireFieldsarray可选;省略时路由不变,由最便宜的数据源处理。列出本次请求必须能返回的输出字段,例如 `cited` 或 `ads`,请求就只会由能返回全部这些字段的数据源处理。未列出的字段,只要处理请求的数据源有,仍会照常返回。这可能提高你的价格:最便宜的数据源无法返回某个列出的字段时,会改由更贵的数据源处理,并按它的价格报价和扣费。如果某个结果确实没有某个列出的字段,该字段仍可能缺失。如果列出的字段组合没有任何单一数据源能同时返回,请求会作为无效输入被拒绝,不扣费。
示例响应
免费运行只返回前 3 条结果。为密钥充值即可获得完整响应。
{
"data": {
"ads": [
{
"advertiserName": "Example title",
"advertiserUrl": "https://example.com/page",
"domain": "example.com",
"image": "https://example.com/image.jpg",
"snippet": "A short example description of this item.",
"title": "Example title",
"url": "https://example.com/page"
}
],
"answer": "example",
"answerMarkdown": "example",
"citations": [
{
"answerPosition": 1,
"title": "Example title",
"url": "https://example.com/page"
}
],
"createdUtc": 12.5,
"entities": [
{
"category": "general",
"domain": "example.com",
"title": "Example title",
"url": "https://example.com/page"
}
],
"model": "example",
"places": [
{
"address": "123 Main St",
"category": "general",
"description": "A short example description of this item.",
"name": "Example title",
"phone": "+1 555-0142",
"position": 1,
"rating": 4.6,
"reviewCount": 12500,
"websiteUrl": "https://example.com/page"
}
],
"prompt": "example",
"searchQueries": [
"example"
],
"searchResults": [
{
"cited": true,
"title": "Example title",
"url": "https://example.com/page"
}
],
"shoppingCards": [
{
"currency": "USD",
"description": "A short example description of this item.",
"image": "https://example.com/image.jpg",
"merchants": "example",
"price": 19.99,
"rating": 4.6,
"title": "Example title",
"url": "https://example.com/page"
}
],
"webSearchTriggered": true
},
"found": true,
"reason": "not_found"
}响应类型定义
interface ChatgptSearchResponse {
data: {
ads?: {
advertiserName?: string | null;
advertiserUrl?: string | null;
domain?: string | null;
image?: string | null;
snippet?: string | null;
title: string;
url?: string | null;
}[] | null;
answer: string;
answerMarkdown: string;
citations: {
answerPosition?: number | null;
title: string;
url: string;
}[];
createdUtc?: number | null;
entities?: {
category?: string | null;
domain?: string | null;
title: string;
url?: string | null;
}[] | null;
model?: string | null;
places?: {
address?: string | null;
category?: string | null;
description?: string | null;
name: string;
phone?: string | null;
position?: number;
rating?: number | null;
reviewCount?: number | null;
websiteUrl?: string | null;
}[] | null;
prompt: string;
searchQueries?: string[] | null;
searchResults?: {
cited?: boolean;
title?: string;
url?: string;
}[] | null;
shoppingCards?: {
currency?: string | null;
description?: string | null;
image?: string | null;
merchants?: string | null;
price?: number | null;
rating?: number | null;
title: string;
url?: string | null;
}[] | null;
webSearchTriggered?: boolean | null;
} | null;
found: boolean;
reason?: "not_found";
}完整的参数与响应参考:这个接口的每个字段、类型和示例。
参考
请求、响应与价格
最近验证于 2026-09-29 · 可用率和延迟按 30d 统计POST /v1/run/chatgpt.search
curl -X POST https://api.getanyapi.com/v1/run/chatgpt.search \
-H "Authorization: Bearer $ANYAPI_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt":"What is AnyAPI at getanyapi.com, and what does it offer?"}'| 字段 | 类型 | 示例值 |
|---|---|---|
| 请求体 | ||
| prompt | string | "What is AnyAPI at getanyapi.com, and what does it offer?"让 ChatGPT 通过网页搜索回答的问题或调研提示词。 |
| country | string | 发起提问的 ISO-3166 alpha-2 国家代码,例如 US、GB、DE。ChatGPT 会同时本地化它检索的页面和撰写的回答,因此这决定了美国买家和英国买家分别会看到什么。 |
| requireAds | boolean | 只由能返回回答中展示的赞助内容的数据源处理。目前只有一个数据源符合条件,因此该数据源不可用时请求无法回退。 |
| requireEntities | boolean | 只由能返回回答中识别出的品牌及其他命名实体的数据源处理。目前只有一个数据源符合条件,因此该数据源不可用时请求无法回退。 |
| requireFields | array | 可选;省略时路由不变,由最便宜的数据源处理。列出本次请求必须能返回的输出字段,例如 `cited` 或 `ads`,请求就只会由能返回全部这些字段的数据源处理。未列出的字段,只要处理请求的数据源有,仍会照常返回。这可能提高你的价格:最便宜的数据源无法返回某个列出的字段时,会改由更贵的数据源处理,并按它的价格报价和扣费。如果某个结果确实没有某个列出的字段,该字段仍可能缺失。如果列出的字段组合没有任何单一数据源能同时返回,请求会作为无效输入被拒绝,不扣费。 |
| requirePlaces | boolean | 只由能返回回答中展示的地点的数据源处理。不开启时,只要作答的数据源能返回地点,仍会返回。开启后会选择唯一保证返回地点的数据源,费用更高,且该数据源不可用时没有可回退的选项。 |
| requireShoppingCards | boolean | 只由能返回回答中展示的购物卡片的数据源处理。不开启时,只要作答的数据源能返回购物卡片,仍会返回。开启后会选择唯一保证返回购物卡片的数据源,费用更高,且该数据源不可用时没有可回退的选项。 |
| webSearch | enum | 是否强制 ChatGPT 浏览网页。force 指示它进行搜索,也是默认值;auto 让 ChatGPT 自行决定,费用更低,但大约一半时间会凭记忆作答。查看 webSearchTriggered 了解实际情况:未经搜索写出的回答并非基于网页搜索。 |
| 响应 | ||
| data | object | The normalized answer and citations, or null when no answer was found. |
| data.ads可设为必填 | object[] | Sponsored placements ChatGPT displayed with the answer. null means the source that answered cannot report ads; an empty array means none were shown. |
| data.ads[].advertiserName可设为必填 | string | Advertiser name. |
| data.ads[].advertiserUrl可设为必填 | string | Advertiser URL, tracking parameters stripped. |
| data.ads[].domain可设为必填 | string | Advertised domain. |
| data.ads[].image | string | Sponsored image URL. |
| data.ads[].snippet可设为必填 | string | Sponsored placement text. |
| data.ads[].title | string | Sponsored placement title. |
| data.ads[].url | string | Sponsored destination URL, tracking parameters stripped. |
| data.answer | string | The web-grounded answer as text. Populated whenever the provider has data for the entity. |
| data.answerMarkdown | string | The answer in Markdown when the engine returns a Markdown rendering, otherwise the same text as answer. Populated whenever the provider has data for the entity. |
| data.citations | object[] | Sources cited by the answer. Populated whenever the provider has data for the entity. |
| data.citations[].answerPosition可设为必填 | integer | One-based answer section where ChatGPT cited this source. null means the source that answered cannot report the position. |
| data.citations[].title | string | Source page title when supplied by the search engine. |
| data.citations[].url | string | Source page URL. |
| data.createdUtc | number | UTC epoch timestamp in seconds (Unix time). Multiply by 1000 for a JS Date in milliseconds. null means the source that answered does not report when it answered. |
| data.entities可设为必填 | object[] | Brands and other named entities recognized in the answer. null means the source that answered cannot report them; an empty array means none were identified. |
| data.entities[].category | string | Entity category. |
| data.entities[].domain可设为必填 | string | Entity domain. |
| data.entities[].title | string | Entity name. |
| data.entities[].url | string | Entity URL, tracking parameters stripped. |
| data.model可设为必填 | string | The ChatGPT model that produced the answer. null means the source that answered does not report it, which is not the same as an unknown model. |
| data.places | object[] | Places and local businesses ChatGPT displayed with the answer. null means the source that answered cannot report them; an empty array means none were shown. |
| data.places[].address可设为必填 | string | Place address as displayed. |
| data.places[].category | string | Place category shown by ChatGPT. |
| data.places[].description可设为必填 | string | Place description shown by ChatGPT. |
| data.places[].name | string | Place or business name. |
| data.places[].phone | string | Place phone number as displayed. |
| data.places[].position | integer | One-based position in the places block. |
| data.places[].rating | number | Place rating when the source reports one. |
| data.places[].reviewCount | integer | Number of reviews behind the displayed rating. |
| data.places[].websiteUrl | string | Place website URL, tracking parameters stripped. |
| data.prompt | string | The prompt answered by ChatGPT. |
| data.searchQueries可设为必填 | string[] | The web search queries ChatGPT ran to ground its answer. null means the source that answered cannot report them; an empty array means it searched with none recorded. |
| data.searchResults可设为必填 | object[] | Pages ChatGPT retrieved while answering. A SUPERSET of citations: a page can be read and not cited. null means the source that answered cannot report them. |
| data.searchResults[].cited可设为必填 | boolean | Whether this retrieved page made it into citations. false means ChatGPT read the page and chose not to cite it, which is a different and more actionable fact than the page being absent. |
| data.searchResults[].title | string | Title of the retrieved page, empty when the source did not send one. |
| data.searchResults[].url | string | Canonical URL of the retrieved page, tracking parameters stripped. |
| data.shoppingCards | object[] | Products ChatGPT displayed with the answer. null means the source that answered cannot report shopping cards; an empty array means none were shown. |
| data.shoppingCards[].currency可设为必填 | string | ISO 4217 currency code when the source reports it. |
| data.shoppingCards[].description可设为必填 | string | Product description shown on the shopping card. |
| data.shoppingCards[].image | string | Product image URL. |
| data.shoppingCards[].merchants | string | Merchant name shown on the shopping card. |
| data.shoppingCards[].price | number | Displayed product price as a number when the source reports one. |
| data.shoppingCards[].rating | number | Product rating when the source reports one. |
| data.shoppingCards[].title | string | Product name shown by ChatGPT. |
| data.shoppingCards[].url | string | Product page URL, tracking parameters stripped. |
| data.webSearchTriggered可设为必填 | boolean | Whether ChatGPT actually ran a web search before answering. ChatGPT decides this per session, and an answer written without one is not web-grounded. null means the source that answered cannot report it, which is not the same as false. |
| found | boolean | Whether ChatGPT returned a web-grounded answer. |
| reason | "not_found" | Present only when `found` is false, and says why there is no result. `not_found`: the source states the target does not exist, or returned nothing for it. A `found: false` answer is a successful call, not an error, and `costUsd` is what it actually cost. |
| 价格 | ||
| 每次请求价格 | USD | US$0.0018 |
| 价格(/千次请求) | USD | US$1.80 |
常见问题
关于 ChatGPT 搜索 API
AnyAPI 的 ChatGPT 搜索 API 只需一次 POST 请求 /v1/run/chatgpt.search,就以统一格式的 JSON 返回 ChatGPT 数据。向 ChatGPT 提出一个基于网页搜索的问题,获得附带来源引用的回答。ChatGPT 每次请求都会重新撰写回答,因此同一提示词会返回不同的措辞和不同的来源组合。AnyAPI 会在 2 个数据源之间路由每个请求,某个数据源失败时自动切换。费用:每千次请求 US$1.80 起,以美元计价,无需订阅,也没有每月最低消费。过去 30 天,通过 AnyAPI 发起的 ChatGPT 搜索 API 调用中有 97.4% 成功,响应时间中位数为 32.6 秒,共测量 613 次调用。
费用:每千次请求 US$1.80 起,以美元计价,无需订阅,也没有每月最低消费。你只需为一个美元钱包充值,每次调用从中扣费。部分由钱包付费的失败请求会产生处理费用,我们按成本原价转嫁,不加价;错误响应会显示收取的金额。
向 ChatGPT 提出一个基于网页搜索的问题,获得附带来源引用的回答。ChatGPT 每次请求都会重新撰写回答,因此同一提示词会返回不同的措辞和不同的来源组合。响应是统一格式的 JSON,外层结构与每个 AnyAPI 接口相同,所以解析另一个接口只需换一个 URL,别的都不用改。
过去 30 天,通过 AnyAPI 发起的 ChatGPT 搜索 API 调用中有 97.4% 成功,响应时间中位数为 32.6 秒,共测量 613 次调用。这些是 AnyAPI 对经过网关的流量的自有测量,持续重新计算,并非公开承诺的服务等级目标。