Overview
Here is the list of the different parameters you can use with ScrapingBee's GPT API.
You can also discover this API using our Postman collection covering every ScrapingBee's features.
Our Chat GPT API allows you to send prompts to a GPT model and receive AI-generated responses in realtime.
We provide one endpoint:
- GPT endpoint (
/api/v1/chatgpt
) - Send prompts to GPT and receive AI-generated responses
Quick start
To use the GPT API, you only need two things:
- your API key, available here
- a prompt to send to the GPT model (learn more about prompts)
Then, simply do this.
curl "https://app.scrapingbee.com/api/v1/chatgpt?api_key=YOUR-API-KEY&prompt=Explain+the+benefits+of+renewable+energy+in+100+words"
# Install the Python Requests library:
# pip install requests
import requests
def send_request():
response = requests.get(
url='https://app.scrapingbee.com/api/v1/chatgpt',
params={
'api_key': 'YOUR-API-KEY',
'prompt': 'Explain the benefits of renewable energy in 100 words',
},
)
print('Response HTTP Status Code: ', response.status_code)
print('Response HTTP Response Body: ', response.content)
send_request()
// Install the Node Axios package
// npm install axios
const axios = require('axios');
axios.get('https://app.scrapingbee.com/api/v1/chatgpt', {
params: {
'api_key': 'YOUR-API-KEY',
'url': 'YOUR-URL',
'prompt': Explain the benefits of renewable energy in 100 words,
}
}).then(function (response) {
// handle success
console.log(response);
})
import java.io.IOException;
import org.apache.http.client.fluent.*;
public class SendRequest
{
public static void main(String[] args) {
sendRequest();
}
private static void sendRequest() {
// Classic (GET )
try {
// Create request
Content content = Request.Get("https://app.scrapingbee.com/api/v1/chatgpt?api_key=YOUR-API-KEY&url=YOUR-URL&prompt=Explain+the+benefits+of+renewable+energy+in+100+words")
// Fetch request and return content
.execute().returnContent();
// Print content
System.out.println(content);
}
catch (IOException e) { System.out.println(e); }
}
}
require 'net/http'
require 'net/https'
# Classic (GET )
def send_request
uri = URI('https://app.scrapingbee.com/api/v1/chatgpt?api_key=YOUR-API-KEY&url=YOUR-URL&prompt=Explain+the+benefits+of+renewable+energy+in+100+words')
# Create client
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
# Create Request
req = Net::HTTP::Get.new(uri)
# Fetch Request
res = http.request(req)
puts "Response HTTP Status Code: #{ res.code }"
puts "Response HTTP Response Body: #{ res.body }"
rescue StandardError => e
puts "HTTP Request failed (#{ e.message })"
end
send_request()
<?php
// get cURL resource
$ch = curl_init();
// set url
curl_setopt($ch, CURLOPT_URL, 'https://app.scrapingbee.com/api/v1/chatgpt?api_key=YOUR-API-KEY&url=YOUR-URL&prompt=Explain+the+benefits+of+renewable+energy+in+100+words');
// set method
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
// return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// send the request and save response to $response
$response = curl_exec($ch);
// stop if fails
if (!$response) {
die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}
echo 'HTTP Status Code: ' . curl_getinfo($ch, CURLINFO_HTTP_CODE) . PHP_EOL;
echo 'Response Body: ' . $response . PHP_EOL;
// close curl resource to free up system resources
curl_close($ch);
>
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
func sendClassic() {
// Create client
client := &http.Client{}
// Create request
req, err := http.NewRequest("GET", "https://app.scrapingbee.com/api/v1/chatgpt?api_key=YOUR-API-KEY&url=YOUR-URL&prompt=Explain+the+benefits+of+renewable+energy+in+100+words", nil)
parseFormErr := req.ParseForm()
if parseFormErr != nil {
fmt.Println(parseFormErr)
}
// Fetch Request
resp, err := client.Do(req)
if err != nil {
fmt.Println("Failure : ", err)
}
// Read Response Body
respBody, _ := ioutil.ReadAll(resp.Body)
// Display Results
fmt.Println("response Status : ", resp.Status)
fmt.Println("response Headers : ", resp.Header)
fmt.Println("response Body : ", string(respBody))
}
func main() {
sendClassic()
}
Here is a breakdown of all the parameters you can use with the GPT API:
type
]
(default
)Response Example
The API will then respond with formatted JSON data:
{
"full_html": "" # Full HTML response, including all formatting, included if add_html=true
"llm_model": "gpt-4o",
"prompt": "Explain the benefits of renewable energy in 100 words",
# The result in Markdown format
"results_markdown": "Renewable energy offers numerous benefits, including reduced greenhouse gas emissions, which help combat climate change. It provides a sustainable and inexhaustible source of power from natural resources like sunlight, wind, and water. By decreasing reliance on fossil fuels, renewable energy enhances energy security and reduces air and water pollution, leading to better public health. It also creates jobs in manufacturing, installation, and maintenance. As technology advances, costs continue to decline, making renewable energy more accessible and economically viable. Additionally, decentralized renewable systems can empower communities, particularly in remote areas, by providing reliable electricity and promoting energy independence.\n\n",
# The result in plain text format
"results_text": "Renewable energy offers numerous benefits, including reduced greenhouse gas emissions, which help combat climate change. It provides a sustainable and inexhaustible source of power from natural resources like sunlight, wind, and water. By decreasing reliance on fossil fuels, renewable energy enhances energy security and reduces air and water pollution, leading to better public health. It also creates jobs in manufacturing, installation, and maintenance. As technology advances, costs continue to decline, making renewable energy more accessible and economically viable. Additionally, decentralized renewable systems can empower communities, particularly in remote areas, by providing reliable electricity and promoting energy independence.\n\n\n",
# The result in structured JSON format
"results_json": [
{
"type": "blank_line"
},
{
"children": [
{
"raw": "Renewable energy offers numerous benefits, including reduced greenhouse gas emissions, which help combat climate change. It provides a sustainable and inexhaustible source of power from natural resources like sunlight, wind, and water. By decreasing reliance on fossil fuels, renewable energy enhances energy security and reduces air and water pollution, leading to better public health. It also creates jobs in manufacturing, installation, and maintenance. As technology advances, costs continue to decline, making renewable energy more accessible and economically viable. Additionally, decentralized renewable systems can empower communities, particularly in remote areas, by providing reliable electricity and promoting energy independence.",
"type": "text"
}
],
"type": "paragraph"
},
{
"type": "blank_line"
}
],
}
Keep in mind that each successful API call will cost you 10 api credits.
Every request that failed will be tried as many times as possible for 30 seconds.
So please be aware of this maximum timeout when writing your own code.
API key
api_key
[string
]
(default= ""
)
required
All requests are authenticated by using your private API key.
To get access to your API key, just create an account here and confirm your email.
Prompt
prompt
[string
]
(default= ""
)
required
The prompt
parameter is the text you want to send to the GPT model for processing. This is required for the GPT endpoint.
The prompt should be clear and specific to get the best results from the AI model. You can ask questions, request content generation, or seek analysis on various topics.
Prompt Best Practices
Here are some tips for writing effective prompts:
- Be specific: Clear, detailed prompts yield better results
- Provide context: Include relevant background information when needed
- Set expectations: Specify the format or style of response you want
- Use examples: Show the model what kind of output you're looking for
Example prompts:
"Summarize the following text in 3 bullet points: [your text]"
"Write a professional email response to a customer complaint about delayed shipping"
"Explain quantum computing in simple terms suitable for a high school student"
"Generate 5 creative product names for an eco-friendly water bottle"
curl "https://app.scrapingbee.com/api/v1/chatgpt?api_key=YOUR-API-KEY&prompt=Explain+the+benefits+of+renewable+energy+in+100+words"
# Install the Python Requests library:
# pip install requests
import requests
def send_request():
response = requests.get(
url='https://app.scrapingbee.com/api/v1/chatgpt',
params={
'api_key': 'YOUR-API-KEY',
'prompt': 'Explain the benefits of renewable energy in 100 words',
},
)
print('Response HTTP Status Code: ', response.status_code)
print('Response HTTP Response Body: ', response.content)
send_request()
// Install the Node Axios package
// npm install axios
const axios = require('axios');
axios.get('https://app.scrapingbee.com/api/v1/chatgpt', {
params: {
'api_key': 'YOUR-API-KEY',
'url': 'YOUR-URL',
'prompt': Explain the benefits of renewable energy in 100 words,
}
}).then(function (response) {
// handle success
console.log(response);
})
import java.io.IOException;
import org.apache.http.client.fluent.*;
public class SendRequest
{
public static void main(String[] args) {
sendRequest();
}
private static void sendRequest() {
// Classic (GET )
try {
// Create request
Content content = Request.Get("https://app.scrapingbee.com/api/v1/chatgpt?api_key=YOUR-API-KEY&url=YOUR-URL&prompt=Explain+the+benefits+of+renewable+energy+in+100+words")
// Fetch request and return content
.execute().returnContent();
// Print content
System.out.println(content);
}
catch (IOException e) { System.out.println(e); }
}
}
require 'net/http'
require 'net/https'
# Classic (GET )
def send_request
uri = URI('https://app.scrapingbee.com/api/v1/chatgpt?api_key=YOUR-API-KEY&url=YOUR-URL&prompt=Explain+the+benefits+of+renewable+energy+in+100+words')
# Create client
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
# Create Request
req = Net::HTTP::Get.new(uri)
# Fetch Request
res = http.request(req)
puts "Response HTTP Status Code: #{ res.code }"
puts "Response HTTP Response Body: #{ res.body }"
rescue StandardError => e
puts "HTTP Request failed (#{ e.message })"
end
send_request()
<?php
// get cURL resource
$ch = curl_init();
// set url
curl_setopt($ch, CURLOPT_URL, 'https://app.scrapingbee.com/api/v1/chatgpt?api_key=YOUR-API-KEY&url=YOUR-URL&prompt=Explain+the+benefits+of+renewable+energy+in+100+words');
// set method
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
// return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// send the request and save response to $response
$response = curl_exec($ch);
// stop if fails
if (!$response) {
die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}
echo 'HTTP Status Code: ' . curl_getinfo($ch, CURLINFO_HTTP_CODE) . PHP_EOL;
echo 'Response Body: ' . $response . PHP_EOL;
// close curl resource to free up system resources
curl_close($ch);
>
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
func sendClassic() {
// Create client
client := &http.Client{}
// Create request
req, err := http.NewRequest("GET", "https://app.scrapingbee.com/api/v1/chatgpt?api_key=YOUR-API-KEY&url=YOUR-URL&prompt=Explain+the+benefits+of+renewable+energy+in+100+words", nil)
parseFormErr := req.ParseForm()
if parseFormErr != nil {
fmt.Println(parseFormErr)
}
// Fetch Request
resp, err := client.Do(req)
if err != nil {
fmt.Println("Failure : ", err)
}
// Read Response Body
respBody, _ := ioutil.ReadAll(resp.Body)
// Display Results
fmt.Println("response Status : ", resp.Status)
fmt.Println("response Headers : ", resp.Header)
fmt.Println("response Body : ", string(respBody))
}
func main() {
sendClassic()
}
Credit cost for your requests
Each ScrapingBee plan provides a certain amount of API credits per month.
It costs 15 credits per GPT API request.
Here is a breakdown of ScrapingBee API credit costs: