Guide
Can the ChatGPT API search the web?
Yes. OpenAI's API can search the web: the Responses API has a web_search tool and Chat Completions has a search model (as of November 2026). But the API's answer is not the answer chatgpt.com shows: with the API you choose the model, instructions and tool settings, while the ChatGPT app uses its own. To measure what people read in ChatGPT, ask the app.
Updated
How does web search work in the OpenAI API?
Per OpenAI's web search guide: add a tool of type web_search to a Responses API call. The output has a web_search_call item and a message whose text carries url_citation annotations (url, title, start_index, end_index). include: ["web_search_call.action.sources"] adds every URL the search consulted. A user_location with type: "approximate" and country, city, region or timezone localizes the search. In Chat Completions the search model is gpt-5-search-api.
# OpenAI's Responses API with the web_search tool (pip install openai).
# Field names from OpenAI's web search guide, read on 2026-11-27.
import os
from openai import OpenAI
client = OpenAI() # reads OPENAI_API_KEY
response = client.responses.create(
model=os.environ["OPENAI_MODEL"], # a model that supports the web_search tool
tools=[{
"type": "web_search",
"user_location": {"type": "approximate", "country": "GB", "city": "London"},
}],
include=["web_search_call.action.sources"],
input="best coffee subscription for home espresso",
)
print(response.output_text)
for item in response.output:
if item.type == "message":
for part in item.content:
for a in getattr(part, "annotations", []) or []:
if a.type == "url_citation":
print(a.url, a.title)Pricing (as of November 2026): web search tool calls are listed per 1,000 calls, with search content tokens billed at model rates (OpenAI pricing).
Why is the API's answer different from the ChatGPT app's?
| OpenAI API (web_search) | ChatGPT app | |
|---|---|---|
| Who picks the model and instructions | You, in each request | The app |
| When it searches | When the tool is enabled and the model calls it | ChatGPT searches automatically or when the user picks Web search |
| Location | user_location you send (approximate) | May be estimated from the IP address; precise location is optional |
| Output | JSON: text with url_citation annotations | A page with the answer, citations and links |
| Billing | Per token and per tool call | ChatGPT plans; billed separately from the API |
Sources: ChatGPT search describes search in the app; billing says API usage is not included in ChatGPT subscriptions. OpenAI does not say the two return the same answer, and since the settings differ, you should not expect them to. If your question is "what does ChatGPT tell my customers?", the app is the thing to measure.
Is the ChatGPT API cheaper than ChatGPT Plus?
They are not the same purchase. A ChatGPT plan is a subscription to the app for a person. The API is billed per token and per tool call, on a separate account, and a ChatGPT subscription does not include API usage (per OpenAI's billing help). Which costs less depends entirely on how much you call the API.
How do I get the answer chatgpt.com shows, as JSON?
Ask the app. PromptGale opens chatgpt.com in a real browser from the country you choose and returns the answer, its sources and a brand analysis, for 1.5 credits per answer.
curl -X POST https://promptgale.com/v1/sync/task \
-H "Authorization: Bearer $PROMPTGALE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"taskType": "CHATGPT",
"payload": {
"prompt": "best coffee subscription for home espresso",
"country": "GB",
"brand": "Acme Coffee"
}
}'import os
import requests
res = requests.post(
"https://promptgale.com/v1/sync/task",
headers={"Authorization": f"Bearer {os.environ['PROMPTGALE_API_KEY']}"},
json={"taskType": "CHATGPT", "payload": {"prompt": "best coffee subscription for home espresso", "country": "GB", "brand": "Acme Coffee"}},
timeout=300,
)
task = res.json()["data"]
print(task["status"], task["result"]["text"][:300])const res = await fetch('https://promptgale.com/v1/sync/task', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.PROMPTGALE_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ taskType: 'CHATGPT', payload: {prompt: "best coffee subscription for home espresso", country: "GB", brand: "Acme Coffee"} }),
});
const { data: task } = await res.json();
console.log(task.status, task.result.text.slice(0, 300));{
"success": true,
"data": {
"id": "tsk_3Xb8Kq0Lm2Np4Rs6Tu8Vw0Yz",
"taskType": "CHATGPT",
"status": "COMPLETED",
"country": "US",
"credits": 1.5,
"creditsCharged": 1.5,
"result": {
"engine": "CHATGPT",
"text": "For home espresso, these are the subscriptions people recommend most often: 1. Acme Coffee roasts to order and lets you pick the grind for your machine. 2. Northwind Roasters has a wide range of single-origin espresso roasts. 3. Bluebird Beans ships every two weeks and is easy to pause.",
"sources": [
{
"position": 1,
"url": "https://acmecoffee.example/espresso-subscription",
"title": "Acme Coffee: espresso subscription",
"domain": "acmecoffee.example",
"cited": true,
"citationNumber": 1
},
{
"position": 2,
"url": "https://reddit.com/threads/home-espresso",
"title": "Home espresso subscriptions, compared",
"domain": "reddit.com",
"cited": true,
"citationNumber": 2
},
{
"position": 3,
"url": "https://northwind.example/espresso-subscription",
"title": "Northwind Roasters: espresso subscription",
"domain": "northwind.example",
"cited": true,
"citationNumber": 3
},
{
"position": 4,
"url": "https://homebarista.example/threads/home-espresso",
"title": "Home espresso subscriptions, compared",
"domain": "homebarista.example",
"cited": true,
"citationNumber": 4
}
],
"analysis": {
"status": "ok",
"brands": [
{
"name": "Acme Coffee",
"role": "target",
"mentioned": true,
"mentions": 1,
"firstPosition": 79,
"rank": 1,
"cited": true,
"citedUrls": [
"https://acmecoffee.example/espresso-subscription"
],
"shareOfVoice": 33.3
},
{
"name": "Northwind Roasters",
"role": "competitor",
"mentioned": true,
"mentions": 1,
"firstPosition": 156,
"rank": 2,
"cited": true,
"citedUrls": [
"https://northwind.example/espresso-subscription"
],
"shareOfVoice": 33.3
},
{
"name": "Bluebird Beans",
"role": "competitor",
"mentioned": true,
"mentions": 1,
"firstPosition": 229,
"rank": 3,
"cited": false,
"citedUrls": [],
"shareOfVoice": 33.3
}
]
},
"location": {
"country": "US",
"locale": "en-US",
"timezone": "America/New_York"
}
}
}
}Sample output: the brands, domains and answer are made up (Acme Coffee and its competitors do not exist). The field names and shapes are the real API.
How do I compare the API and the app for the same prompt?
Run the prompt both ways from the same country, then compare what each one cites. The domains that appear only in the app are the ones a person in that market actually sees.
// Same prompt, two answers: which domains does each one cite?
const appDomains = new Set(appTask.result.sources.filter((s) => s.cited).map((s) => s.domain)); // PromptGale, CHATGPT
const apiDomains = new Set(apiCitations.map((c) => new URL(c.url).hostname.replace(/^www\./, ''))); // OpenAI url_citation
const both = [...appDomains].filter((d) => apiDomains.has(d));
console.log({ onlyInApp: [...appDomains].filter((d) => !apiDomains.has(d)), onlyInApi: [...apiDomains].filter((d) => !appDomains.has(d)), both });Questions, answered
Can the ChatGPT API search the web?
Yes. OpenAI's Responses API has a web_search tool that returns url_citation annotations, and Chat Completions has the gpt-5-search-api model, per OpenAI's docs in November 2026.
Does the API give the same answer as ChatGPT?
Not necessarily. In the API you choose the model, instructions and tool settings; the app uses its own. Treat them as two different answers to the same question.
Is ChatGPT Plus usage included in the API?
No. OpenAI's help center says API usage is not included in ChatGPT subscriptions and the two are billed separately.
How do I get the chatgpt.com answer programmatically?
Ask the app itself. PromptGale opens chatgpt.com from the country you pick and returns the answer, sources and brand analysis as JSON, for 1.5 credits per answer.
Sources
Statements about other companies come from their own pages, read on . Prices and products change; check the source before you decide.