# Cited Answers API: Facts with Sources for AI Agents (`superslowsloth/cited-answers`) Actor

Ask a question, get a short factual answer with citations from live Google Search grounding. One row per question: answer, sources with resolved URLs and the exact text each source supports. Questions that return no citations are flagged and never charged.

- **URL**: https://apify.com/superslowsloth/cited-answers.md
- **Developed by:** [Superslow Sloth](https://apify.com/superslowsloth) (community)
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $75.00 / 1,000 grounded answer with citations

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Cited Answers API: Facts with Sources for AI Agents

Send a question, get a short factual answer and the sources behind it. Each answer
comes from a Gemini model with **Google Search grounding** switched on, so the
claims are checked against live search results and every source is returned with
the exact piece of the answer it supports.

Built for agents that make many small calls: one row per question, a stable JSON
shape, and an answer that arrives with its citations or is not charged.

### What you get per question

| field | meaning |
|---|---|
| `question`, `index` | the question and its position in your list |
| `answer` | the answer text |
| `grounded` | `true` only when Google Search backed the answer with at least one citation |
| `status` | `answered`, `ungrounded`, `failed` or `skipped` |
| `error` | why a row is not `answered`, otherwise `null` |
| `citations[]` | the sources, see below |
| `search_count` | how many searches the model chose to run; `null` when none ran or the API did not say |
| `model`, `provider` | the model asked and the provider that answered (always Google on a charged row) |
| `finish_reason` | `stop`, or `length` when the answer was cut at `maxAnswerTokens` |
| `billed` | the pricing event this row was charged as, or `null` |

Each citation:

| field | meaning |
|---|---|
| `url` | the page the source points at, resolved from Google's redirect. `null` if it could not be resolved |
| `grounding_redirect` | Google's original `vertexaisearch.cloud.google.com/grounding-api-redirect/...` link, unmodified |
| `domain` | host of `url` without `www.` |
| `title` | the source name as Google gives it (usually the site's domain, not the page title) |
| `start_index`, `end_index` | **UTF-8 byte offsets** into `answer`, as Google reports them, not character offsets |
| `supported_text` | the slice of `answer` those offsets cover |

`supported_text` is Google's segment, passed through as is. Segments are
sentence-like and can start mid-token (a segmenter that treats `Node.` as a
sentence end starts the next segment at `js:`). One span can have several sources,
and the same page is listed once per distinct span.

### Input

- `questions`: up to 20 per run, up to 1000 characters each.
- `model`: default `google/gemini-3.5-flash-lite`. The list is Gemini 3+ Flash and Flash Lite models that support search grounding.
- `language`, `country`: optional hints added to the instructions. They steer the answer, they do not filter sources.
- `maxAnswerTokens`: 100 to 2000, default 600.

### What is charged

- A small `actor-start` event per run ($0.001).
- One `grounded-answer` event per question ($0.075) whose answer came back from Google with **at least one citation**.
- Nothing for a question that failed, came back from a non-Google provider, came back empty, or came back with no citation. Those rows are still returned, flagged, so you can see why.
- A run never asks a question it cannot bill: the remaining maximum charge is checked before each call.

### Things worth knowing

- **The number of searches is the model's decision.** A simple fact usually takes one search, a comparison or multi-part question two to four, and a nonsense query three. Searches are the main cost of an answer. OpenRouter has no setting that caps them on a Google model (tested: `max_uses`, `max_tool_calls` and `stop_server_tools_when` were all ignored), and asking for a single search in the prompt did not reduce them, so the price is set against a measured spread, not a cap. Over 21 mixed questions the model ran 1 to 4 searches (median 2), and one repeated multi-part question ran up to 6.
- **A question is not always grounded.** The model decides whether to search. A greeting or "reply with OK" runs no search and is returned as `grounded: false`, free. Arithmetic still triggered a search in testing.
- **Citations are returned as Google gave them.** `grounding_redirect` is never altered. `url` is read from the first redirect hop with one request; the destination page is never fetched.
- **Google's grounding terms apply** to the grounded results. Read them before building on the output.

# Actor input Schema

## `questions` (type: `array`):

Questions to answer, one per entry. Up to 20 per run, up to 1000 characters each. Each question gets one row: a short factual answer plus the sources Google Search found for it. A question the search cannot back with at least one citation gets a row flagged grounded=false and is not charged.

## `model` (type: `string`):

Gemini model that writes the answer. All use Google Search grounding. The default is the cheapest and is right for most factual lookups; the larger models write better multi-part answers.

## `language` (type: `string`):

Language the answer is written in, for example Japanese or Thai. Added to the instructions as a hint. Leave empty to answer in the language of the question.

## `country` (type: `string`):

Country the facts should apply to, for example Japan or Brazil. Added to the instructions as a hint, not a filter: sources are still chosen by Google Search. Leave empty for no focus.

## `maxAnswerTokens` (type: `integer`):

Upper bound on the length of each answer, in tokens. 100 to 2000. An answer cut at this limit has finish_reason length. This bounds the answer text only, not the number of searches the model runs.

## Actor input object example

```json
{
  "questions": [
    "What is the latest stable version of Python?",
    "Who won the most recent Formula 1 drivers' championship?"
  ],
  "model": "google/gemini-3.5-flash-lite",
  "maxAnswerTokens": 600
}
```

# Actor output Schema

## `answers` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "questions": [
        "What is the latest stable version of Python?",
        "Who won the most recent Formula 1 drivers' championship?"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("superslowsloth/cited-answers").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "questions": [
        "What is the latest stable version of Python?",
        "Who won the most recent Formula 1 drivers' championship?",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("superslowsloth/cited-answers").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "questions": [
    "What is the latest stable version of Python?",
    "Who won the most recent Formula 1 drivers'\'' championship?"
  ]
}' |
apify call superslowsloth/cited-answers --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,superslowsloth/cited-answers"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/ywuFMRIeVh7nBwyd0/builds/dI1QRGNmwmBe5v5KX/openapi.json
