For the complete documentation index, see llms.txt. This page is also available as Markdown.

Gemini

Extract Gemini responses by submitting prompts and receive parsed data as structured JSON, plain text or Markdown.

The gemini source lets you submit a prompt to Google Gemini and receive a parsed, structured response, including the plain text and Markdown answers.

Request samples

The following code examples show how to submit a prompt to Gemini using Push-Pull.

curl 'https://data.oxylabs.io/v1/queries' \
--user 'USERNAME:PASSWORD' \
-H 'Content-Type: application/json' \
-d '{
        "source": "gemini",
        "prompt": "best supplements for better sleep",
        "parse": true,
        "geo_location": "United States",
        "callback_url": "https://your-server.com/oxylabs-callback"
    }'
import requests
from pprint import pprint

# Structure payload.
payload = {
    'source': 'gemini',
    'prompt': 'best supplements for better sleep',
    'parse': True,
    'geo_location': "United States",
    'callback_url': "https://your-server.com/oxylabs-callback"
}

# Get response.
response = requests.request(
    'POST',
    'https://data.oxylabs.io/v1/queries',
    auth=('USERNAME', 'PASSWORD'),
    json=payload,
)

# Print prettified response to stdout.
pprint(response.json())

Note: JavaScript rendering is enabled by default for all LLM sources. You do not need to include rendering parameters in your request payload.

Submitting a job with Push-Pull integration (including batch queries) method returns the job ID immediately – not the result. Once the job status is done, retrieve the parsed response. See Integration method on the LLMs and AI page for the full submit-and-retrieve flow.

Request parameters

Basic setup and customization options for scraping Gemini.

Parameter
Description
Default Value

source

Sets the scraper target. Use gemini.

–

prompt

The prompt or question to submit to Gemini. Up to 8,000 characters.

–

callback_url

Recommended. URL where we deliver a notification once the job completes. More info.

–

parse

Set to true for structured JSON data.

false

geo_location

Specify a country to route the request from. More info.

–

browser_instructions

Optional custom browser instructions when rendering JavaScript. More info.

–

- mandatory parameter

Structured data

Once the job is retrieved via the Push-Pull results endpoint, Web Scraper API is capable of extracting a JSON object that contains Gemini output, offering structured data on various elements of the results page.

gemini structured output

Output data dictionary

All LLM targets return the same top-level job and results[] envelope. See LLMs and AI for the full metadata reference.

The following table shows Gemini-specific results[].content fields:

Field Name
Description
Type

prompt

Submitted prompt.

string

raw_response

Raw streamed response from Gemini, one line per item.

array of strings

response_text

Plain text response from Gemini.

string

markdown_text

Complete response in Markdown.

string

citations

Source citations referenced in the response. Each object contains title, url, text, and description.

array

parse_status_code

12000 – successful. Otherwise, parser failed to extract some or all structured fields.

integer

model

AI model used to generate the response.

string

– conditional, returned only when content is in the LLM's response.

Last updated

Was this helpful?