# Perplexity 2.0 (`winbayai/perplexity-2-0`)

Our advanced API, powered by AI, enables seamless Google、Bing、Wiki... data search and analysis, transforming raw data into actionable insights. It streamlines data retrieval for market research and trend tracking, enhancing decision-making accuracy across diverse industries.

- **URL**: https://beta-securitybyobscurity.apify.com/winbayai/perplexity-2-0.md
- **Developed by:** [Winbay](https://beta-securitybyobscurity.apify.com/winbayai) (community)
- **Categories:** AI, Agents, SEO tools
- **Stats:** 20 total users, 17 monthly users, 47.8% runs succeeded, 5 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $1.00 / 1,000 results

This Actor is paid per result. You are not charged for the Apify platform usage, but only a fixed price for dataset items the Actor outputs.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

# README

## Perplexity 2.0 on Apify

**Project Link**: <https://apify.com/winbayai/perplexity-2-0>

Our advanced API, powered by AI, enables seamless Google data search and analysis, transforming raw data into actionable insights. It streamlines data retrieval for market research and trend tracking, enhancing decision-making accuracy across diverse industries.

Whether for market research, trend analysis, or content optimization, this Actor delivers precise data support, giving you a competitive edge in today's fast-paced digital landscape.

### ✨ Key Features

- **🧠 AI-Powered Analysis**: Leverages a sophisticated AI engine to analyze and organize information, identifying patterns and trends that might otherwise go unnoticed.
- **📈 Market Insights**: Gain a deeper understanding of consumer behavior, market dynamics, and emerging opportunities.
- **🔍 Efficient Data Retrieval**: Streamlines the process of retrieving information from Google's vast database, saving you time.
- **🌐 Versatile Applications**: Ideal for a wide range of industries, including marketing, academic research, content strategy, and more.
- **🤖 Simple to Use**: With a user-friendly interface and robust features, you can get complex analysis with just one simple request.

### 🚀 How to Use on Apify

You can run this Actor in two ways: directly from the Apify Console for ease of use, or programmatically via the API for integration into your own applications.

#### 1. Using Apify Console (The Easy Way)

1. Find this Actor in the [Apify Store](https://apify.com/store).
2. Click **Run**.
3. Go to the **Input** tab.
4. In the JSON editor, enter your query in the `content` field.
5. Click the **Start** button.
6. When the run finishes, check the **Output** tab for your results.

#### 2. Using the API

To use the API, you'll need your **Apify API token**. You can find it in your Apify account settings under the **Integrations** tab.

##### API Endpoint

The endpoint for running this Actor is:

```
https://api.apify.com/v2/acts/winbayai/perplexity-2-0/runs?token=YOUR_APIFY_TOKEN
```

You need to send a `POST` request to this endpoint with your query in the request body.

### ⚙️ Input and Output

#### Input

The Actor requires a JSON object with a single `content` field for your query.

**Example Input**:

```json
{
    "content": "What is today's news in America?"
}
```

#### Output

The Actor returns a JSON object containing the original query, the AI-generated response, and the list of source search results.

**Example Output Structure**:

```json
{
    "query": "What is today's news in America?",
    "choices": "A summary of today's top news stories in America, covering politics, technology, and sports...",
    "results": [
        {
            "title": "Major Tech Bill Passes in Senate",
            "link": "https://example.com/news/tech-bill",
            "snippet": "The Senate passed a landmark bill aimed at regulating artificial intelligence...",
            "position": 1
        },
        {
            "title": "New York Giants Win Thriller Game",
            "link": "https://example.com/news/sports-giants-win",
            "snippet": "In a last-minute victory, the New York Giants defeated their rivals...",
            "position": 2
        }
    ]
}
```

### 💻 Code Examples

Here are some request examples in common languages. Remember to replace `YOUR_APIFY_TOKEN` with your actual Apify API token.

#### cURL

```bash
curl -X POST \
  "https://api.apify.com/v2/acts/winbayai/perplexity-2-0/runs?token=YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "What is today'\''s news in America?"
  }'
```

#### Python (using `requests`)

```python
import requests
import json

## The Actor's run URL
actor_run_url = "https://api.apify.com/v2/acts/winbayai/perplexity-2-0/runs?token=YOUR_APIFY_TOKEN"

payload = {
    "content": "What is today's news in America?"
}

headers = {
    "Content-Type": "application/json"
}

response = requests.post(actor_run_url, json=payload, headers=headers)

if response.status_code == 200:
    ## The actual Actor output is nested in the 'data' field
    data = response.json().get('data', {})
    print(json.dumps(data, indent=4))
else:
    print(f"Error: {response.status_code}")
    print(response.text)
```

#### JavaScript (using `fetch`)

```javascript
const actorRunUrl = 'https://api.apify.com/v2/acts/winbayai/perplexity-2-0/runs?token=YOUR_APIFY_TOKEN';

const payload = {
    content: "What is today's news in America?"
};

const options = {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json'
    },
    body: JSON.stringify(payload)
};

async function runActor() {
    try {
        const response = await fetch(actorRunUrl, options);
        if (!response.ok) {
            throw new Error(`HTTP error! status: ${response.status}`);
        }
        // The actual Actor output is nested in the 'data' field
        const result = await response.json();
        console.log(JSON.stringify(result.data, null, 4));
    } catch (error) {
        console.error('Error:', error);
    }
}

runActor();
```

### 🌐 Links

- **Official Website**: [Winbay](https://winbay.io)
- **GitHub**: [Perplexity-API](https://github.com/winbayai/Perplexity-API)

# Actor input Schema

## `content` (type: `string`):

Enter the question you want to ask the AI.

## Actor input object example

```json
{
  "content": "What is todays news in america?"
}
```

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("winbayai/perplexity-2-0").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("winbayai/perplexity-2-0").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{}' |
apify call winbayai/perplexity-2-0 --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=winbayai/perplexity-2-0",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Perplexity 2.0",
        "description": "Our advanced API, powered by AI, enables seamless Google、Bing、Wiki... data search and analysis, transforming raw data into actionable insights. It streamlines data retrieval for market research and trend tracking, enhancing decision-making accuracy across diverse industries.",
        "version": "0.0",
        "x-build-id": "gRtgVz0vsoLj37WlH"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/winbayai~perplexity-2-0/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-winbayai-perplexity-2-0",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/winbayai~perplexity-2-0/runs": {
            "post": {
                "operationId": "runs-sync-winbayai-perplexity-2-0",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/winbayai~perplexity-2-0/run-sync": {
            "post": {
                "operationId": "run-sync-winbayai-perplexity-2-0",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "content"
                ],
                "properties": {
                    "content": {
                        "title": "Your Question",
                        "type": "string",
                        "description": "Enter the question you want to ask the AI.",
                        "default": "What is todays news in america?"
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
