ScavioScavio
产品定价文档
登录开始使用
  1. 首页
  2. 教程
  3. 如何构建自动化 LLM 可见性扫描仪
教程

如何构建自动化 LLM 可见性扫描仪

扫描您的品牌在法学硕士支持的搜索结果中的可见度。跟踪 AI 引用、有机存在和 AEO 信号。

获取免费API密钥API文档

法学硕士现在为 Google AI Mode、Bing Copilot 和 Perplexity 的搜索体验提供支持。您的品牌在这些人工智能生成的响应中的可见度直接影响流量。该扫描仪会检查您在搜索结果中的品牌形象,这些搜索结果会提供 LLM 回复、跟踪 AI 引文、特色片段和 People Also Ask 数据。每次品牌扫描 5 个关键字的费用为 0.025 美元。

前置条件

  • Python 3.8+
  • 请求库
  • 来自 scavio.dev 的 Scavio API 密钥
  • 目标关键词和品牌域

操作指南

步骤 1: 跨关键字扫描法学硕士可见度信号

检查法学硕士用于生成回复的多种搜索功能。

Python
import os, requests, json
from datetime import datetime
from collections import defaultdict

API_KEY = os.environ['SCAVIO_API_KEY']
SH = {'x-api-key': API_KEY, 'Content-Type': 'application/json'}

BRAND_DOMAIN = 'scavio.dev'
KEYWORDS = [
    'best search api for ai agents',
    'mcp search tool setup',
    'web search api comparison 2026',
    'serp api free tier options',
    'search api for rag pipeline',
]

def scan_llm_visibility(keyword, domain):
    data = requests.post('https://api.scavio.dev/api/v1/search',
        headers=SH, json={'query': keyword, 'country_code': 'us'}, timeout=10).json()
    domain_l = domain.lower()
    # AI Overview / Answer Box (feeds LLM responses)
    ai = data.get('ai_overview', data.get('answer_box', {}))
    ai_cited = domain_l in json.dumps(ai).lower() if ai else False
    # Featured Snippet (high-priority LLM source)
    featured = data.get('featured_snippet', {})
    in_featured = domain_l in json.dumps(featured).lower() if featured else False
    # People Also Ask (LLM follow-up context)
    paa = data.get('people_also_ask', [])
    in_paa = any(domain_l in json.dumps(q).lower() for q in paa)
    # Organic position (base visibility)
    organic = data.get('organic_results', [])
    org_pos = next((i+1 for i, r in enumerate(organic) if domain_l in r.get('link', '').lower()), None)
    # Top 3 domains (who LLMs are citing)
    top3 = [r.get('displayed_link', '').split('/')[0] for r in organic[:3]]
    return {
        'keyword': keyword,
        'ai_cited': ai_cited,
        'has_ai_overview': bool(ai),
        'in_featured': in_featured,
        'in_paa': in_paa,
        'organic_pos': org_pos,
        'top3_domains': top3,
    }

scans = []
for kw in KEYWORDS:
    scan = scan_llm_visibility(kw, BRAND_DOMAIN)
    scans.append(scan)
    signals = []
    if scan['ai_cited']: signals.append('AI')
    if scan['in_featured']: signals.append('FS')
    if scan['in_paa']: signals.append('PAA')
    pos = f'#{scan["organic_pos"]}' if scan['organic_pos'] else '-'
    print(f'  {kw[:40]:40} | {pos:5} | {", ".join(signals) or "none"}')
print(f'\nCost: ${len(KEYWORDS) * 0.005:.3f}')

步骤 2: 计算LLM可见度分数

将扫描数据聚合成综合可见性分数。

Python
def calculate_llm_score(scans, domain):
    total = len(scans)
    # Component scores
    ai_cited = sum(1 for s in scans if s['ai_cited'])
    has_ai = sum(1 for s in scans if s['has_ai_overview'])
    featured = sum(1 for s in scans if s['in_featured'])
    paa = sum(1 for s in scans if s['in_paa'])
    top3 = sum(1 for s in scans if s['organic_pos'] and s['organic_pos'] <= 3)
    top10 = sum(1 for s in scans if s['organic_pos'] and s['organic_pos'] <= 10)
    # Weighted score (100 max)
    ai_score = (ai_cited / max(has_ai, 1)) * 35  # AI citations worth most
    featured_score = (featured / total) * 25  # Featured snippets
    paa_score = (paa / total) * 15  # PAA presence
    organic_score = (top3 / total) * 15 + (top10 / total) * 10  # Organic ranking
    total_score = ai_score + featured_score + paa_score + organic_score
    print(f'\n=== LLM Visibility Score: {domain} ===')
    print(f'  Overall: {total_score:.0f}/100')
    print(f'\n  Component Breakdown:')
    print(f'    AI Citations:    {ai_score:.0f}/35 ({ai_cited}/{has_ai} keywords with AI)')
    print(f'    Featured Snippet: {featured_score:.0f}/25 ({featured}/{total} keywords)')
    print(f'    People Also Ask: {paa_score:.0f}/15 ({paa}/{total} keywords)')
    print(f'    Organic Top 3:   {top3}/{total} keywords')
    print(f'    Organic Top 10:  {top10}/{total} keywords')
    return {
        'total_score': total_score,
        'ai_score': ai_score,
        'featured_score': featured_score,
        'paa_score': paa_score,
        'organic_score': organic_score,
    }

visibility = calculate_llm_score(scans, BRAND_DOMAIN)

步骤 3: 生成可行的建议

找出差距并提供具体行动以提高法学硕士的知名度。

Python
def generate_recommendations(scans, visibility, domain):
    print(f'\n{"=" * 60}')
    print(f'  LLM VISIBILITY SCANNER REPORT')
    print(f'  Brand: {domain} | Date: {datetime.now().strftime("%Y-%m-%d")}')
    print(f'  Score: {visibility["total_score"]:.0f}/100')
    print(f'{"=" * 60}')
    recs = []
    # AI citation gaps
    ai_gaps = [s['keyword'] for s in scans if s['has_ai_overview'] and not s['ai_cited']]
    if ai_gaps:
        recs.append({
            'priority': 'HIGH',
            'action': 'Optimize for AI citations',
            'keywords': ai_gaps,
        })
    # Featured snippet opportunities
    fs_gaps = [s['keyword'] for s in scans if not s['in_featured'] and s['organic_pos'] and s['organic_pos'] <= 5]
    if fs_gaps:
        recs.append({
            'priority': 'MEDIUM',
            'action': 'Target featured snippets (already ranking top 5)',
            'keywords': fs_gaps,
        })
    # Not ranking at all
    absent = [s['keyword'] for s in scans if not s['organic_pos']]
    if absent:
        recs.append({
            'priority': 'HIGH',
            'action': 'Create content (not ranking)',
            'keywords': absent,
        })
    print(f'\n  Recommendations ({len(recs)}):')
    for r in recs:
        print(f'\n  [{r["priority"]:6}] {r["action"]}')
        for kw in r['keywords'][:3]:
            print(f'    - {kw}')
    # Competitor visibility
    print(f'\n  Top Competitors (by AI/organic presence):')
    all_domains = defaultdict(int)
    for s in scans:
        for d in s.get('top3_domains', []):
            if d and domain not in d:
                all_domains[d] += 1
    for d, count in sorted(all_domains.items(), key=lambda x: -x[1])[:5]:
        print(f'    {d:30} | Top 3 in {count}/{len(scans)} keywords')
    print(f'\n  Scan cost: ${len(scans) * 0.005:.3f}')
    print(f'  Monthly (daily): ${len(scans) * 0.005 * 30:.2f}')

generate_recommendations(scans, visibility, BRAND_DOMAIN)

Python 示例

Python
import os, requests, json
SH = {'x-api-key': os.environ['SCAVIO_API_KEY'], 'Content-Type': 'application/json'}

def llm_visibility(keyword, domain):
    data = requests.post('https://api.scavio.dev/api/v1/search',
        headers=SH, json={'query': keyword, 'country_code': 'us'}, timeout=10).json()
    ai = data.get('ai_overview', data.get('answer_box', {}))
    cited = domain.lower() in json.dumps(ai).lower() if ai else False
    pos = next((i+1 for i, r in enumerate(data.get('organic_results', [])) if domain in r.get('link', '')), None)
    print(f'{keyword[:35]:35} | AI: {cited} | Pos: {pos or "-"}')

llm_visibility('best search api', 'scavio.dev')

JavaScript 示例

JavaScript
const SH = { 'x-api-key': process.env.SCAVIO_API_KEY, 'Content-Type': 'application/json' };
const data = await fetch('https://api.scavio.dev/api/v1/search', {
  method: 'POST', headers: SH,
  body: JSON.stringify({ query: 'best search api', country_code: 'us' })
}).then(r => r.json());
const ai = data.ai_overview || data.answer_box || {};
const cited = JSON.stringify(ai).toLowerCase().includes('scavio');
const pos = (data.organic_results || []).findIndex(r => r.link?.includes('scavio.dev'));
console.log(`AI cited: ${cited} | Position: ${pos >= 0 ? pos + 1 : 'absent'}`);

预期输出

JSON
  best search api for ai agents            | #3    | AI
  mcp search tool setup                    | #2    | AI, FS
  web search api comparison 2026           | #5    | none
  serp api free tier options               | #4    | PAA
  search api for rag pipeline              | #6    | none

Cost: $0.025

=== LLM Visibility Score: scavio.dev ===
  Overall: 52/100

  Component Breakdown:
    AI Citations:    18/35 (2/4 keywords with AI)
    Featured Snippet: 5/25 (1/5 keywords)
    People Also Ask: 3/15 (1/5 keywords)
    Organic Top 3:   2/5 keywords

============================================================
  LLM VISIBILITY SCANNER REPORT
  Brand: scavio.dev | Date: 2026-05-21
  Score: 52/100
============================================================

  Recommendations (2):

  [HIGH  ] Optimize for AI citations
    - web search api comparison 2026
    - serp api free tier options

  Scan cost: $0.025
  Monthly (daily): $0.75

相关教程

  • 如何构建自动化 GEO 可见性报告
  • 如何通过 SERP API 跟踪 Google AI 模式响应
  • 如何构建 AI 模式可见性仪表板

常见问题

大多数开发者在15到30分钟内完成本教程。您需要一个Scavio API密钥(免费套餐即可)和可用的Python或JavaScript环境。

Python 3.8+. 请求库. 来自 scavio.dev 的 Scavio API 密钥. 目标关键词和品牌域. Scavio API密钥注册即送50个免费积分。

可以。免费套餐注册即送50个积分,完全足够完成本教程并构建一个可运行的原型解决方案。

Scavio提供原生LangChain包(langchain-scavio)、MCP服务器以及适用于任何HTTP客户端的REST API。本教程使用 the raw REST API, 但您可以根据需要适配您选择的框架。

相关资源

Best Of

2026年5月本地LLM个人知识库工具推荐

Read more
Best Of

2026年本地LLM接地最佳搜索API

Read more
Workflow

每日本地法学硕士搜索接地管道

Read more
Glossary

LLM 流量取代

Read more
Solution

用搜索检测和纠正LLM错误回答

Read more
Solution

用实时搜索数据支撑LLM回答

Read more

开始构建

扫描您的品牌在法学硕士支持的搜索结果中的可见度。跟踪 AI 引用、有机存在和 AEO 信号。

获取免费API密钥阅读文档
ScavioScavio

面向AI智能体的实时搜索API。搜索所有平台,不仅仅是Google。

产品

  • 功能
  • 定价
  • 控制台
  • 联盟计划

开发者

  • 文档
  • API参考
  • 快速开始
  • MCP集成
  • Python SDK

替代方案

  • Tavily替代方案
  • SerpAPI替代方案
  • Firecrawl替代方案
  • Exa替代方案

工具

  • JSON格式化
  • cURL转代码
  • Token计数器
  • 全部工具

© 2026 Scavio. 保留所有权利。

Featured on TAAFT
服务条款隐私政策