# Ai Search (`andrew_babo/ai-search`) Actor

- **URL**: https://apify.com/andrew\_babo/ai-search.md
- **Developed by:** [Andrew Babo](https://apify.com/andrew_babo) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

## 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

## AI Online Search — ask ChatGPT & Gemini, get answers + sources

Ask any question and get the answer from **ChatGPT (web search)** and **Gemini (web grounding)**
side by side, with the **source links each AI actually used**, plus brand-mention and
competitor share-of-voice tracking.

No account. No login. No API key. No cookies.

### What you get per question, per AI

| Field | Meaning |
| --- | --- |
| `answerText` / `answerMarkdown` / `answerHtml` | The full answer in three formats |
| `citations[]` | `title`, `url`, `domain`, `snippet`, `position` for every source the AI cited |
| `citationCount`, `uniqueDomains` | Quick citation stats |
| `brandMentions[]` | Was your brand mentioned, how many times, where in the answer, with context snippets |
| `competitorMentions[]` | Same, for competitors |
| `shareOfVoice` | Your mentions ÷ (yours + competitors') × 100 |
| `citedByBrand` | Did the AI link to your own domain |
| `responseTimeMs`, `costUsd`, `scrapedAt`, `errorCode` | Run metadata |

### Real measured numbers

10-question benchmark (5 questions × 2 AIs, Apify 4 GB, residential proxy, Sept 2026):

| Engine | Success | Answer length | Citations | Time per question | Cost per question |
| --- | --- | --- | --- | --- | --- |
| ChatGPT | 4/5 | 120–520 words | 1–9 sources | 13–28 s | $0.0036–0.0077 |
| Gemini | 5/5 | 288–692 words | 3–5 sources | 29–48 s | $0.008–0.013 |

Both English and Vietnamese questions return native-language answers with local sources
(e.g. `pnj.com.vn`, `vn.investing.com` for Vietnamese finance questions).

### Input

- **queries** — one or more questions, written exactly as a person would ask them.
- **engines** — `chatgpt`, `gemini` (both by default), `googleAiMode` (experimental, often
  blocked by Google's bot check).
- **country / language** — two-letter codes; answers and sources are localized.
- **brandKeywords / competitorKeywords** — what to watch for in the answers.
- **includeScreenshot** — save a PNG of each answer as proof (off by default, faster without).
- **followUpQuestion** — optional second question in the same ChatGPT conversation.
- **maxConcurrency / maxRetries** — throughput and resilience.
- **proxyConfiguration** — residential proxies are strongly recommended.

### Error codes

Failed questions still produce a row, with an empty answer and `errorCode`:

- `LOGIN_WALL` — the AI refused the anonymous session on that attempt (retry usually fixes it).
- `BLOCKED` — bot check / captcha page.
- `EMPTY_ANSWER`, `NO_ANSWER` — the page rendered but produced no usable answer.

Nothing is ever reported as a success with an empty answer.

### Typical uses

- Track whether AI assistants recommend your brand, and which sources they trust.
- Compare how two different AIs answer the same buyer question.
- Feed grounded, cited answers into your own agents and reports.

### Changelog

- **0.3** — Added the Gemini engine (anonymous, web-grounded, full citation extraction).
  Default engines are now ChatGPT + Gemini. Google AI Mode marked experimental.
- **0.2** — Anti-detection browser layer, reliable ChatGPT answer and source extraction.
- **0.1** — First release.

# Actor input Schema

## `queries` (type: `array`):

One or more questions, exactly as a person would ask them.

## `engines` (type: `array`):

ChatGPT + Gemini by default — one row per AI per question, so you can compare answers side by side. Google AI Mode is experimental and often blocked.

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

Two-letter country code (US, VN, GB...) — answers and sources are localized to this market.

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

Two-letter language code for the answer UI (en, vi, de...).

## `brandKeywords` (type: `array`):

Brand or product names to watch. The report tells you if the AI mentioned you, how often, and where in the answer.

## `competitorKeywords` (type: `array`):

Competitor names. Compared against your brand to compute share of voice.

## `includeScreenshot` (type: `boolean`):

Off by default for speed. Turn on to keep a PNG of each answer as proof.

## `followUpQuestion` (type: `string`):

Optional second question asked in the same ChatGPT conversation, after the first answer.

## `maxConcurrency` (type: `integer`):

How many questions are processed in parallel.

## `maxRetries` (type: `integer`):

How many times a failed question is retried with a fresh IP.

## `proxyConfiguration` (type: `object`):

Residential proxies are strongly recommended — datacenter IPs are blocked within minutes.

## Actor input object example

```json
{
  "queries": [
    "What are the best project management tools in 2026?"
  ],
  "engines": [
    "chatgpt",
    "gemini"
  ],
  "country": "US",
  "language": "en",
  "brandKeywords": [],
  "competitorKeywords": [],
  "includeScreenshot": false,
  "maxConcurrency": 5,
  "maxRetries": 2,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

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

One row per question per AI engine: answer text/markdown, citations, brand mentions, cost.

# 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 = {
    "queries": [
        "What are the best project management tools in 2026?"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("andrew_babo/ai-search").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 = { "queries": ["What are the best project management tools in 2026?"] }

# Run the Actor and wait for it to finish
run = client.actor("andrew_babo/ai-search").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 '{
  "queries": [
    "What are the best project management tools in 2026?"
  ]
}' |
apify call andrew_babo/ai-search --silent --output-dataset

```

## MCP server setup

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

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/wWqrvAaZGJh2DbPw7/builds/2yXdxcmMla3P91NfW/openapi.json
