promptstringआवश्यक
Question or research prompt for ChatGPT to answer using web search.
https://api.sandbase.ai/v1/api/chatgpt/searchAsk ChatGPT a web-grounded question and receive an answer with source citations. ChatGPT composes each answer per request, so the same prompt returns different wording and a different source set.
आपका आउटपुट यहाँ दिखाई देगा
इनपुट पूरा करें, फिर Run पर क्लिक करें।
Ask ChatGPT a web-grounded question and receive an answer with source citations. ChatGPT composes each answer per request, so the same prompt returns different wording and a different source set.
curl -X POST "https://api.sandbase.ai/v1/run" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "chatgpt/search", "prompt": "What are the best practices for home composting?"}'
The result is returned in outputs[0].data. Lookups that find nothing fail with a not-found error.
| Name | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes | Question or research prompt for ChatGPT to answer using web search. |
country | string | No | ISO-3166 alpha-2 country to ask from, e.g. US, GB, DE. ChatGPT localizes both the pages it retrieves and the answer it writes, so this is the difference between what a US buyer and a UK buyer are told. Default "US". |
requireAds | boolean | No | Serve only from a source that can return sponsored placements shown with the answer. One source currently qualifies, so the request cannot fall back when it is unavailable. Default false. |
requireEntities | boolean | No | Serve only from a source that can return brands and other named entities recognized in the answer. One source currently qualifies, so the request cannot fall back when it is unavailable. Default false. |
requireFields | array | No | Optional; omit it and routing is unchanged, with the cheapest source serving. Name the output fields this request must be able to return, for example cited or ads, and it is served only by a source that returns every |
requirePlaces | boolean | No | Serve only from a source that can return places shown with the answer. Leaving this off still returns places whenever the source that answered can. Turning it on selects the single source that guarantees them, which cost |
requireShoppingCards | boolean | No | Serve only from a source that can return shopping cards shown with the answer. Leaving this off still returns shopping cards whenever the source that answered can. Turning it on selects the single source that guarantees |
webSearch | string | No | Whether to insist ChatGPT browses the web. force instructs it to search and is the default; auto lets ChatGPT decide, which is cheaper and answers from memory roughly half the time. Check webSearchTriggered for what actu |
Billed at the actual cost of each call, about $0.0018 per request. A call can cost more when the first data source fails and another one answers. Failed calls and lookups that find nothing are not charged.
बिल्डिंग शुरू करें
एकीकृत authentication और usage tracking के साथ Platform API endpoint.
curl -X POST "https://api.sandbase.ai/v1/api/chatgpt/search" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "What are the best practices for home composting?",
"country": "US",
"webSearch": "force",
"requireAds": false,
"requirePlaces": false,
"requireEntities": false,
"requireShoppingCards": false
}'अपने SandBase API key को अपने सर्वर environment में सेट करें। Requests Bearer authentication का उपयोग करती हैं।
export SANDBASE_API_KEY="YOUR_API_KEY"अपना key सर्वर पर रखें। इसे browser code में expose न करें।
promptstringआवश्यकQuestion or research prompt for ChatGPT to answer using web search.
countrystringISO-3166 alpha-2 country to ask from, e.g. US, GB, DE. ChatGPT localizes both the pages it retrieves and the answer it writes, so this is the difference between what a US buyer and a UK buyer are told.
डिफ़ॉल्ट: "US"
webSearchstringWhether to insist ChatGPT browses the web. force instructs it to search and is the default; auto lets ChatGPT decide, which is cheaper and answers from memory roughly half the time. Check webSearchTriggered for what actually happened - an answer written without a search is not web-grounded.
डिफ़ॉल्ट: "force"
संभावित मान: force, auto
requireAdsbooleanServe only from a source that can return sponsored placements shown with the answer. One source currently qualifies, so the request cannot fall back when it is unavailable.
डिफ़ॉल्ट: false
requireFieldsarrayOptional; omit it and routing is unchanged, with the cheapest source serving. Name the output fields this request must be able to return, for example `cited` or `ads`, and it is served only by a source that returns every one of them. Fields you do not name are still returned whenever the serving source has them. This can raise your price: when the cheapest source cannot return a named field, a dearer source serves, and you are quoted and charged its price. A named field can still be absent on a result that genuinely lacks it. Naming a combination that no single source returns together is refused as invalid input, with no charge.
requirePlacesbooleanServe only from a source that can return places shown with the answer. Leaving this off still returns places whenever the source that answered can. Turning it on selects the single source that guarantees them, which costs more and has nothing to fall back to if it is unavailable.
डिफ़ॉल्ट: false
requireEntitiesbooleanServe only from a source that can return brands and other named entities recognized in the answer. One source currently qualifies, so the request cannot fall back when it is unavailable.
डिफ़ॉल्ट: false
requireShoppingCardsbooleanServe only from a source that can return shopping cards shown with the answer. Leaving this off still returns shopping cards whenever the source that answered can. Turning it on selects the single source that guarantees them, which costs more and has nothing to fall back to if it is unavailable.
डिफ़ॉल्ट: false
इस API के लिए सेव किया गया example response; इसे देखते समय कोई live request नहीं की जाती।
कोई सेव response प्रकाशित नहीं किया गया है। इसका response देखने के लिए Playground में API चलाएँ।
और जानें
| API | कीमत | प्रतिक्रिया |
|---|---|---|
ChatGPT Searchयह API ChatGPT | $0.0018 प्रति कॉल से | JSON |
प्रश्न
https://api.sandbase.ai/v1/api/chatgpt/search पर Authorization header (Bearer) में अपनी SandBase API key और parameters को JSON body के रूप में भेजें। आप इस पेज के Playground में बिना code लिखे भी इसे आज़मा सकते हैं।
$0.0018 से प्रति call, आपकी SandBase balance से बिल किया जाएगा। आपसे केवल आपके किए गए calls के लिए शुल्क लिया जाता है; कोई subscription नहीं है।
आवश्यक: prompt (string)। वैकल्पिक: country (string), webSearch (force, auto में से एक), requireAds (boolean), requireFields (array), requirePlaces (boolean) और requireEntities (boolean) और 1 और। Parameters table और इस पेज का Playground हर field सूचीबद्ध करते हैं।
एक JSON response जो उसी HTTP request में लौटाया जाता है (synchronous)।
नहीं। ChatGPT Search SandBase के माध्यम से चलता है, इसलिए एक SandBase API key इस endpoint और catalog के हर अन्य API और model को कवर करती है। आपको अलग से ChatGPT API access के लिए आवेदन करने की आवश्यकता नहीं है।