> ## Documentation Index
> Fetch the complete documentation index at: https://docs.searchcompany.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Overview

> Architecture and internal services for the Analyze Visibility endpoint

## Purpose

Checks if a business is mentioned in AI platform responses for a given prompt. This is the core visibility tracking functionality.

## Architecture

```mermaid theme={null}
flowchart TD
    Request["POST /api/cron/analyze-visibility"]
    
    subgraph orchestrator [Mini Orchestrator]
        AnalyzeSingle["analyze_single_prompt()"]
        GetBusinessInfo["get_business_info()"]
    end
    
    subgraph checkers [Platform Checkers - Parallel]
        ChatGPT["ChatGPT Checker"]
        Claude["Claude Checker"]
        Gemini["Gemini Checker"]
        Perplexity["Perplexity Checker"]
        Copilot["Copilot Checker"]
        DeepSeek["DeepSeek Checker"]
        Grok["Grok Checker"]
        GoogleAI["Google AI Checker"]
    end
    
    subgraph apis [External AI APIs]
        OpenAI["OpenAI API"]
        Anthropic["Anthropic API"]
        Google["Google AI Studio"]
        PerplexityAPI["Perplexity API"]
        Bing["Bing Chat API"]
        DeepSeekAPI["DeepSeek API"]
        xAI["xAI API"]
        GoogleOverview["Google AI Overviews"]
    end
    
    Request --> AnalyzeSingle
    AnalyzeSingle --> GetBusinessInfo
    GetBusinessInfo --> ChatGPT
    GetBusinessInfo --> Claude
    GetBusinessInfo --> Gemini
    GetBusinessInfo --> Perplexity
    GetBusinessInfo --> Copilot
    GetBusinessInfo --> DeepSeek
    GetBusinessInfo --> Grok
    GetBusinessInfo --> GoogleAI
    
    ChatGPT --> OpenAI
    Claude --> Anthropic
    Gemini --> Google
    Perplexity --> PerplexityAPI
    Copilot --> Bing
    DeepSeek --> DeepSeekAPI
    Grok --> xAI
    GoogleAI --> GoogleOverview
```

## 8 AI Platforms

| Platform   | API              | Checker Location                  |
| ---------- | ---------------- | --------------------------------- |
| ChatGPT    | OpenAI           | `chatgpt/mini_orchestrator.py`    |
| Claude     | Anthropic        | `claude/mini_orchestrator.py`     |
| Gemini     | Google AI Studio | `gemini/mini_orchestrator.py`     |
| Perplexity | Perplexity API   | `perplexity/mini_orchestrator.py` |
| Copilot    | Bing Chat        | `copilot/mini_orchestrator.py`    |
| DeepSeek   | DeepSeek API     | `deepseek/mini_orchestrator.py`   |
| Grok       | xAI API          | `grok/mini_orchestrator.py`       |
| Google AI  | AI Overviews     | `google_ai/mini_orchestrator.py`  |

## Internal Services

| Service                                                             | Purpose                             |
| ------------------------------------------------------------------- | ----------------------------------- |
| [analyze\_single\_prompt](analyze-single-prompt)                    | Main orchestrator for single prompt |
| [check\_single\_prompt\_visibility](check-single-prompt-visibility) | Runs all 8 checkers in parallel     |
| [Platform Checkers](platform-checkers)                              | Individual AI platform integrations |
| [Scoring](scoring)                                                  | Calculates visibility scores        |
| [Database Operations](database-operations)                          | Updates entity\_prompts\_tracker    |

## Code Location

```
src/app/apis/cron/analyze_visibility/
├── routes.py              # HTTP endpoint
├── mini_orchestrator.py   # Main orchestrator
├── platform_checkers.py   # Parallel execution
├── database_operations.py # DB updates
├── scoring.py             # Score calculation
├── chatgpt/               # ChatGPT checker
├── claude/                # Claude checker
├── gemini/                # Gemini checker
├── perplexity/            # Perplexity checker
├── copilot/               # Copilot checker
├── deepseek/              # DeepSeek checker
├── grok/                  # Grok checker
└── google_ai/             # Google AI checker
```

## Response Format

```json theme={null}
{
  "status": "success",
  "prompt": "best payment gateway for startups",
  "chatgpt": true,
  "claude": false,
  "gemini": true,
  "perplexity": true,
  "copilot": false,
  "deepseek": false,
  "grok": true,
  "google_ai": false
}
```
