# Baidu AI Search & Chat (ERNIE & DeepSeek) API (`dev00/baidu-ai-search-chat-ernie-deepseek-api`) Actor

Query Baidu AI Search and Chat engines (ERNIE & DeepSeek) with multi-turn conversation support and deep research mode in structured JSON format.

- **URL**: https://apify.com/dev00/baidu-ai-search-chat-ernie-deepseek-api.md
- **Developed by:** [dev00](https://apify.com/dev00) (community)
- **Categories:** AI, Agents
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$2.00 / 1,000 baidu ai search queries

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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Baidu AI Search & Chat (ERNIE & DeepSeek) - Apify Actor

Query Baidu AI Search and Chat engines (ERNIE & DeepSeek) with multi-turn conversation support and deep research mode with converted JSON output.

***

### 🤖 Supported AI Models & Version Matrix

| API Model Value | Mode (`deep`) | AI Engine Name | Version |
| :--- | :--- | :--- | :--- |
| `model=ernie` | `deep=false` | Baidu ERNIE Bot | **ERNIE 4.0 Turbo** |
| `model=ernie` | `deep=true` | Baidu ERNIE Deep Search | **ERNIE 4.0 Pro / Ultra** |
| `model=deepseek` | `deep=true` | DeepSeek AI | **DeepSeek R1 / V3** |

***

### 🚀 Key Features

- **Multi-Model Support**: Select between Baidu's flagship ERNIE 4.0 Turbo / Pro models (`ernie`) and DeepSeek R1 / V3 (`deepseek`).
- **Deep Research Mode**: Toggle `deep=true` for multi-source search synthesis and detailed step-by-step reasoning via ERNIE 4.0 Pro/Ultra or DeepSeek R1.
- **Threaded Multi-Turn Conversations**: Pass `log_id` from previous responses to continue multi-turn chat dialogues seamlessly.
- **High Speed & Enterprise Reliability**: Powered by smart HTTP engines for zero IP blocking and fast turnaround (<1s per check).

***

### 🎯 What People Use It For

- **AI Search Assistants & Chatbots**: Integrate Baidu ERNIE 4.0 and DeepSeek R1/V3 conversational AI into search bots, web extensions, and mobile apps.
- **Content Generation & Summarization**: Programmatically answer user prompts, generate research summaries, and synthesize technical topics.
- **Market & Competitor Intelligence**: Analyze Baidu AI's generative search responses and brand recommendations.
- **SaaS & Automation Developers**: Build automated Q\&A pipelines and knowledge retrieval agents.

***

### 📌 Decision Rule & Usage Recommendation

Check if `success === true`. Inspect `answer` string for the generated AI response, and save `log_id` to pass into subsequent queries for multi-turn conversations.

***

### 💡 What Problem Does This Solve?

- *"Integrating Baidu ERNIE and DeepSeek APIs requires complex API keys and sign-up verification."*
- *"Managing chat state and thread context across multi-turn prompts can be cumbersome."*
- *"Difficulty obtaining clean, machine-readable JSON answers for search queries programmatically."*

Baidu AI Search & Chat delivers automated, low-latency AI answers and conversational search synthesis in a single API or Actor run.

***

### 🔍 Queries This Actor Answers

- *How do I query Baidu ERNIE 4.0 and DeepSeek R1 models programmatically in Python, Node.js, or Apify Actors?*
- *What is Baidu AI's response to prompt X using ERNIE Deep Search or DeepSeek R1?*
- *How do I maintain threaded conversation context with log\_id across multiple requests?*
- *What is an accurate API alternative to OpenAI/Claude with Baidu Chinese AI search integration?*

***

### 📥 Input JSON Schema

Pass the prompt string and optional model parameters in the input JSON:

```json
{
  "q": "What is quantum computing",
  "model": "ernie",
  "deep": true,
  "log_id": "9665365950860837560"
}
```

***

### 📤 Dataset Output Format

Each run outputs a clean structured item to the default dataset and key-value store (`OUTPUT`):

```json
{
  "success": true,
  "query": "What is quantum computing",
  "model": "ernie",
  "deep": true,
  "log_id": "9665365950860837560",
  "answer": "Quantum computing is a rapidly-emerging technology that harnesses the laws of quantum mechanics to solve complex problems faster than classical computers..."
}
```

***

### ⚠️ Failure Context & Error Handling

If an empty question string or invalid parameter is provided:

```json
{
  "success": false,
  "error": "Missing required parameter: 'q' or 'query' string cannot be empty."
}
```

***

### 🏷️ Keywords

`baidu ai`, `ernie bot`, `ernie 4.0`, `ernie 4.0 turbo`, `ernie 4.0 pro`, `ernie 4.0 ultra`, `deepseek`, `deepseek r1`, `deepseek v3`, `baidu chat api`, `baidu ask`, `chinese ai model`, `baidu deep search`, `baidu search ai`, `chinese llm`, `ernie api`, `deepseek api`, `apify actor`.

# Actor input Schema

## `q` (type: `string`):

Question, prompt, or search query string (e.g. 'What is quantum computing').

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

Baidu AI model choice ('ernie' or 'deepseek').

## `deep` (type: `boolean`):

Enable deep research mode for detailed multi-source synthesis.

## `log_id` (type: `string`):

Optional thread ID from a previous response to continue multi-turn chat conversations.

## Actor input object example

```json
{
  "q": "What is quantum computing",
  "model": "ernie",
  "deep": false
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `keyValueStoreResult` (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 = {
    "q": "What is quantum computing"
};

// Run the Actor and wait for it to finish
const run = await client.actor("dev00/baidu-ai-search-chat-ernie-deepseek-api").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 = { "q": "What is quantum computing" }

# Run the Actor and wait for it to finish
run = client.actor("dev00/baidu-ai-search-chat-ernie-deepseek-api").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 '{
  "q": "What is quantum computing"
}' |
apify call dev00/baidu-ai-search-chat-ernie-deepseek-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,dev00/baidu-ai-search-chat-ernie-deepseek-api"
        }
    }
}

```

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/xNNRHIbr3pcXzNzJK/builds/cEcIOPRxp4syadKlo/openapi.json
