A documentação da API está disponível em inglês.

Gemini Chat

Get a completed text reply from Gemini.

GET/api/v1/google/gemini

Costs 1 credit per request; failed requests are refunded. Authentication, the search_metadata envelope and error codes are the same as for every endpoint (see the API reference). Try it in the playground.

Parameters

Prompt and language

ParameterTypeDescription
promptrequiredstringText prompt for a new or continued Gemini conversation, up to 32,000 characters.Up to 32,000 characters.Text only. Use subsequent_request_token to continue a conversation. Uploads, Google account cookies and model selection are not accepted.
hlstringGemini web interface language code. Defaults to en; request a reply language in the prompt.Default: en.

Conversation continuation

ParameterTypeDescription
continuablebooleanReturn a subsequent_request_token for continuing this conversation. Defaults to false.Default: false.Set to true on the first request and on each follow-up that needs another token.
subsequent_request_tokenstringToken from the previous reply. Send it with your next prompt using the same API key.Up to 32,768 characters.Use the newest token for each follow-up. Tokens expire one hour after they are issued; an upstream conversation can become unavailable sooner.Treat tokens as sensitive. Invalid, expired or unavailable continuations fail without starting a new conversation and are not billed.

Response

A JSON object with search_metadata (request id, credits used and remaining) and the result groups the page returns. Groups and fields depend on the content of each page, so treat every field as optional.

Examples

cURL
curl "https://serpfast.com/api/v1/google/gemini?prompt=Explain+why+the+sky+is+blue+in+one+sentence.&hl=en" \
  -H "Authorization: Bearer $SERPFAST_KEY"
Node.js 18+
const params = new URLSearchParams({
  "prompt": "Explain why the sky is blue in one sentence.",
  "hl": "en"
});
const res = await fetch(`https://serpfast.com/api/v1/google/gemini?${params}`, {
  headers: { Authorization: `Bearer ${process.env.SERPFAST_KEY}` },
});
const data = await res.json();
console.log(data);
Python
import os, requests

params = {
  "prompt": "Explain why the sky is blue in one sentence.",
  "hl": "en"
}
res = requests.get(
    "https://serpfast.com/api/v1/google/gemini",
    params=params,
    headers={"Authorization": f"Bearer {os.environ['SERPFAST_KEY']}"},
    timeout=120,
)
print(res.json())