Metadata-Version: 2.5
Name: promptbeacon
Version: 1.4.0
Summary: Does AI recommend your library or dev product? Measure it across ChatGPT, Claude, Gemini and local models, gate it in CI, and show it as a README badge.
Project-URL: Homepage, https://github.com/yotambraun/promptbeacon
Project-URL: Documentation, https://yotambraun.github.io/promptbeacon/
Project-URL: Repository, https://github.com/yotambraun/promptbeacon
Project-URL: Changelog, https://github.com/yotambraun/promptbeacon/blob/main/CHANGELOG.md
Project-URL: Issues, https://github.com/yotambraun/promptbeacon/issues
Author: Yotam Braun
Maintainer: Yotam Braun
License-Expression: Apache-2.0
License-File: LICENSE
Keywords: aeo,ai,ai-search,ai-visibility,analytics,brand,brand-monitoring,brand-tracking,chatgpt,claude,developer-tools,gemini,generative-engine-optimization,geo,github-action,litellm,llm,llm-brand-monitoring,mcp,monitoring,ollama,open-source,seo,visibility
Classifier: Development Status :: 5 - Production/Stable
Classifier: Framework :: Pytest
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Internet :: WWW/HTTP :: Indexing/Search
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: duckdb<3.0.0,>=0.10.0
Requires-Dist: httpx<1.0.0,>=0.26.0
Requires-Dist: litellm<2.0.0,>=1.106.0
Requires-Dist: pydantic<3.0.0,>=2.0.0
Requires-Dist: python-dotenv<2.0.0,>=1.0.0
Requires-Dist: rich<16.0.0,>=13.0.0
Requires-Dist: tomli>=1.1.0; python_version < '3.11'
Requires-Dist: typer<1.0.0,>=0.9.0
Provides-Extra: all
Requires-Dist: anthropic>=0.40.0; extra == 'all'
Requires-Dist: google-genai>=1.0.0; extra == 'all'
Requires-Dist: mcp>=2.3.0; extra == 'all'
Requires-Dist: openai>=1.40.0; extra == 'all'
Requires-Dist: pandas>=2.0.0; extra == 'all'
Requires-Dist: pillow>=10.1.0; extra == 'all'
Provides-Extra: cli
Provides-Extra: dev
Requires-Dist: mypy>=1.0.0; extra == 'dev'
Requires-Dist: pre-commit>=3.0.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
Requires-Dist: pytest-mock>=3.0.0; extra == 'dev'
Requires-Dist: pytest>=7.0.0; extra == 'dev'
Requires-Dist: pyyaml>=6.0; extra == 'dev'
Requires-Dist: ruff>=0.1.0; extra == 'dev'
Provides-Extra: docs
Requires-Dist: mkdocs-material>=9.5.0; extra == 'docs'
Provides-Extra: grounded
Requires-Dist: anthropic>=0.40.0; extra == 'grounded'
Requires-Dist: google-genai>=1.0.0; extra == 'grounded'
Requires-Dist: openai>=1.40.0; extra == 'grounded'
Provides-Extra: langchain
Requires-Dist: langchain-core>=0.1.0; extra == 'langchain'
Provides-Extra: mcp
Requires-Dist: mcp>=2.3.0; extra == 'mcp'
Provides-Extra: pandas
Requires-Dist: pandas>=2.0.0; extra == 'pandas'
Provides-Extra: share
Requires-Dist: pillow>=10.1.0; extra == 'share'
Description-Content-Type: text/markdown

<p align="center">
  <picture>
    <source media="(prefers-color-scheme: dark)" srcset="assets/logo-dark.svg">
    <img src="assets/logo-wordmark.svg" alt="PromptBeacon" width="420">
  </picture>
</p>

<p align="center">
  <b>Does AI recommend your library or dev product?</b><br>
  PromptBeacon asks ChatGPT, Claude, Gemini or a local model the questions your users ask,
  and turns the answers into a number you can gate in CI and show as a README badge.
</p>

<p align="center">
  <a href="https://pypi.org/project/promptbeacon/"><img src="https://badge.fury.io/py/promptbeacon.svg" alt="PyPI version"></a>
  <a href="https://github.com/yotambraun/promptbeacon/actions/workflows/ci.yml"><img src="https://github.com/yotambraun/promptbeacon/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
  <a href="https://www.python.org/downloads/"><img src="https://img.shields.io/badge/python-3.10%E2%80%933.14-blue.svg" alt="Python 3.10-3.14"></a>
  <a href="LICENSE"><img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" alt="License: Apache 2.0"></a>
  <a href="https://yotambraun.github.io/promptbeacon/"><img src="https://img.shields.io/badge/docs-online-6366f1?logo=readthedocs&logoColor=white" alt="Documentation"></a>
</p>

<p align="center">
  Use it from:
  <a href="#try-it-in-10-seconds-no-api-key">CLI</a> ·
  <a href="https://yotambraun.github.io/promptbeacon/mcp/">your AI assistant</a> (Claude Code, Cursor, VS Code and more) ·
  <a href="#in-ci-pytest-and-the-github-action">GitHub Action</a> ·
  <a href="#in-ci-pytest-and-the-github-action">pytest</a> ·
  <a href="https://yotambraun.github.io/promptbeacon/python/">Python</a>
</p>

---

## Try it in 10 seconds, no API key

```bash
pip install promptbeacon
promptbeacon demo httpx --category "python http client" -c requests -c aiohttp
```

Real output (excerpt; the full report adds a score breakdown, cited domains and a
competitor table):

```text
Running in DEMO mode — canned data, no API calls.

╭────────────────────────── Visibility Score: httpx ───────────────────────────╮
│ 79.0 / 100                                                                   │
╰─────────────────────── Generated: 2026-11-01 20:05:52 ───────────────────────╯
measurement: demo — Demo data — canned responses, not a real measurement.
prompts: 10 · category: python http client
...

Share of Voice: 33% (rank 2, 60% of prompts)
                   Share of Voice
┏━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━━━━┓
┃ Brand    ┃ Appears In ┃ Presence ┃ Share of Voice ┃
┡━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━━━━┩
│ requests │ 8/10       │ 80%      │ 44%            │
│ httpx    │ 6/10       │ 60%      │ 33%            │
│ aiohttp  │ 4/10       │ 40%      │ 22%            │
└──────────┴────────────┴──────────┴────────────────┘
```

`demo` runs the whole pipeline on canned answers built from your inputs, costs nothing,
and labels every result `measurement: demo`. For a real measurement, set an API key and
run `promptbeacon scan` with the same arguments.

## Put the result in your README

In your project's repository, one command sets up a weekly check, previews the workflow
and asks before writing anything; it works without API keys and prints the badge
snippet and the next steps:

```bash
promptbeacon init --dry-run     # reads pyproject.toml / package.json / Cargo.toml and the git remote
```

Or by hand: one scan produces a badge and a 1200×630 share card (SVG in light and dark,
and PNG for networks that need it, with `pip install 'promptbeacon[share]'`):

```bash
promptbeacon scan httpx -t "python http client" -c requests -c aiohttp -f json > report.json
promptbeacon badge --report report.json --endpoint .promptbeacon/badge.json
promptbeacon card  --report report.json --theme both --png card.png
```

<p align="center">
  <img src="assets/badge-example.svg" alt="AI visibility badge (demo data)">
</p>

<p align="center">
  <picture>
    <source media="(prefers-color-scheme: dark)" srcset="assets/card-dark.svg">
    <img src="assets/card-light.svg" alt="Share card: which python http client AI recommends, with mentions per project (demo data)" width="640">
  </picture>
</p>

Both images are unedited output of the demo command above, and say so. The
[weekly workflow template](examples/workflows/ai-visibility-weekly.yml) re-scans and
commits a fresh badge; see [Badges & share cards](https://yotambraun.github.io/promptbeacon/share/).

> **Which tool?**
> **PromptBeacon** is for developers and open-source maintainers: does AI recommend your
> library or dev product — a number in CI and a README badge.
> **[Saylent](https://github.com/yotambraun/saylent)** (npm `saylent`) is for brand and
> website teams: an audit of what AI assistants say about your site, with the answers and
> cited pages as receipts, plus fixes for your site.

## Real scans: keys and models

```bash
export OPENAI_API_KEY="sk-..."      # or ANTHROPIC_API_KEY, GEMINI_API_KEY, ...
promptbeacon providers              # which keys are set, and which model each provider uses
promptbeacon scan httpx -t "python http client" -c requests -c aiohttp -p openai -p anthropic
```

Keys are read from the environment or a `.env` file. Each provider has a low-cost default
model; choose another per provider with `--model provider=model_id` (repeatable), with
`PROMPTBEACON_<PROVIDER>_MODEL`, or with `Beacon.with_models()` in Python:

```bash
promptbeacon scan httpx -t "python http client" -m anthropic=claude-sonnet-5-5 -m openai=gpt-6-sol
```

| Provider (`-p`) | Default model | API key variable |
|-----------------|---------------|------------------|
| `openai` | `gpt-6-luna` | `OPENAI_API_KEY` |
| `anthropic` | `claude-haiku-5-5` | `ANTHROPIC_API_KEY` |
| `google` | `gemini-3.5-flash-lite` | `GOOGLE_API_KEY` or `GEMINI_API_KEY` |
| `mistral` | `mistral-small-latest` | `MISTRAL_API_KEY` |
| `cohere` | `command-r7b-12-2024` | `COHERE_API_KEY` |
| `perplexity` | `sonar` | `PERPLEXITY_API_KEY` |
| `litellm` | none: any [LiteLLM model](https://docs.litellm.ai/docs/providers) you set | read by LiteLLM |

Providers you name with `--model` are the ones queried when you don't pass `-p`. Defaults
change between releases, so pin `--model` (or a [protocol](https://yotambraun.github.io/promptbeacon/advanced/)) when
you track a trend. Costs are estimated from LiteLLM's price map.

### Local models (Ollama)

The `litellm` slot takes any LiteLLM model string, so a local model needs no API key:

```bash
ollama pull llama3.2
promptbeacon scan httpx -t "python http client" -c requests --model litellm=ollama/llama3.2
```

OpenRouter, Azure, Bedrock or a vLLM server work the same way, for example
`--model litellm=openrouter/<model>` with `OPENROUTER_API_KEY` set. See
[Models & local LLMs](https://yotambraun.github.io/promptbeacon/models/).

## In Python

```python
from promptbeacon import Beacon

report = (
    Beacon("httpx")
    .with_category("python http client")
    .with_competitors("requests", "aiohttp")
    .demo()  # keyless; remove for a real scan
    .scan()
)

print(f"Visibility:     {report.visibility_score:.0f}/100")
print(f"Share of voice: {report.share_of_voice.target_share:.0%}")
print(f"Rank:           {report.share_of_voice.target_rank}")
```

For a real scan, drop `.demo()` and optionally choose models:
`.with_models({"anthropic": "claude-sonnet-5-5"})` or `.with_models(litellm="ollama/llama3.2")`.

The category is what makes a scan meaningful: prompts become real questions such as
"Which python http client would you recommend?". Without one, PromptBeacon asks "alternatives to
&lt;competitor&gt;" questions when you give competitors, and otherwise warns you.
`.with_category_inference()` (CLI: `--infer-category`) can name it with one model call.

Cost estimates, async scans, JSON, history and a CI script: [Python API](https://yotambraun.github.io/promptbeacon/python/).

## In CI: pytest and the GitHub Action

```yaml
- uses: yotambraun/promptbeacon@v1
  id: beacon
  with:
    brand: "httpx"
    category: "python http client"
    competitors: |
      requests
      aiohttp
    models: |
      openai=gpt-6-luna
    min-share-of-voice: "0.3"
    comment-on-pr: "true"   # needs permissions: pull-requests: write
  env:
    OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
- run: echo "Score ${{ steps.beacon.outputs.score }}, SoV ${{ steps.beacon.outputs.share-of-voice }}"
```

The Action exposes `score`, `share-of-voice`, `rank`, `presence`, `stability`, `tier`,
`passed` and `report-path`, writes a job summary, and applies the thresholds last, so a
failing check still reports its numbers. Outside GitHub,
`promptbeacon ci --report report.json --min-score 50` does the same.

```python
# pytest plugin: auto-registers, and skips cleanly when no key is configured
import pytest


@pytest.mark.visibility(
    brand="httpx",
    categories=["python http client"],
    competitors=["requests"],
    models={"openai": "gpt-6-luna"},
    min_score=40,
)
def test_httpx_is_visible(): ...
```

Or in plain code: `report.assert_visibility(min_score=50, min_share_of_voice=0.3)`.

## From your AI assistant

PromptBeacon measures; your assistant reasons about the result. Add the MCP server to
Claude Code, Claude Desktop, Cursor, VS Code (GitHub Copilot), Windsurf, Codex CLI or
Gemini CLI; [the setup page](https://yotambraun.github.io/promptbeacon/mcp/) has a
tested snippet for each, and install links for Cursor and VS Code. In Claude Code:

```bash
claude mcp add --transport stdio --scope user promptbeacon -- uvx --from "promptbeacon[mcp]>=1.4.0" promptbeacon mcp
```

or install the plugin, which adds the server and four skills, including a full
`ai-visibility-review`:

```text
/plugin marketplace add yotambraun/promptbeacon
/plugin install promptbeacon@promptbeacon
```

Then ask: *"Does AI recommend this project? Compare it with its main alternatives, and
keep it under 5 cents."* The tools (`providers`, `estimate`, `scan`, `project_scan`,
`sources`, `compare`, `recommendations`, `history`, `answers`, `funnel`, `init_preview`,
`share_assets`) return JSON, say what they cost, and accept `models` and `max_cost`.
With no key configured they use the demo and say so.

## Open-source projects

```bash
promptbeacon scan --repo encode/httpx        # GitHub
promptbeacon scan --pypi httpx               # PyPI
promptbeacon scan --npm express              # npm
promptbeacon scan --crate serde               # crates.io
promptbeacon scan --hf sentence-transformers/all-MiniLM-L6-v2   # Hugging Face
```

PromptBeacon reads the project's public description, topics and README, guesses a category
("python http client") and the projects the README compares itself to, prints both with
where they came from, and scans with developer-oriented prompts. `--category` and
`--competitor` always win. In Python: `Beacon.from_project("pypi:httpx")`.

## Measuring it properly

- **Share of voice**: of all mentions of you and your competitors, how many are yours, and
  your rank.
- **Stability**: answers vary between runs. `--stability 5` repeats each prompt and
  reports a 0–100 stability score, a confidence interval and the prompts that flip-flop.
- **Web-grounded answers**: a plain model call reflects training memory. `--grounded`
  uses each provider's own web search (OpenAI, Anthropic, Gemini, Perplexity) and records
  the pages it cites (`pip install 'promptbeacon[grounded]'`).
- **Sources**: `promptbeacon sources` ranks the domains AI answers cite for your category
  and flags which ones cite you.
- **Funnel**: `promptbeacon funnel` models agentic search (fan-out, retrieve, rerank,
  cite) and shows the stage where you drop out.
- **Honest labels**: every report says how it was measured (`demo`, `base_model` or
  `api_grounded`), which models answered, and how complete its cost estimate is.

## CLI

```bash
promptbeacon demo httpx -t "python http client"              # keyless, instant
promptbeacon scan httpx -t "python http client" -c requests -p openai -p anthropic
promptbeacon scan httpx -t "python http client" -m litellm=ollama/llama3.2   # local model
promptbeacon scan --repo encode/httpx                        # an open-source project
promptbeacon scan httpx -t "python http client" --grounded   # web-grounded answers
promptbeacon scan httpx -t "python http client" --stability 5
promptbeacon scan httpx --prompt-file questions.txt --alias python-httpx   # your own questions
promptbeacon scan httpx -t "python http client" --assert-min-score 50   # CI gate
promptbeacon scan --protocol protocol.json                   # pinned, reproducible run
promptbeacon init --dry-run                                  # set up a weekly workflow + badge
promptbeacon scan httpx -t "python http client" --max-cost 0.05   # cap what a scan may spend
promptbeacon badge httpx -t "python http client" --demo      # README badge
promptbeacon card httpx -t "python http client" --demo --png card.png
promptbeacon ci --report report.json --min-sov 0.3           # summary + gate, any CI
promptbeacon ci --report report.json --baseline main.json --max-drop 5   # gate on a drop
promptbeacon answers --report report.json --missing httpx     # the answers behind it
# also: sources, funnel, dashboard, compare, history, providers, mcp
```

`--format` accepts `text`, `json`, `markdown`, `csv` and `html`. Machine formats go to
stdout and notices to stderr, so `promptbeacon scan ... -f json | jq` works. Real CLI scans
are saved to a local DuckDB file (`~/.promptbeacon/data.db`) for `promptbeacon history`;
nothing leaves your machine except the model requests.

Also included: an HTML [dashboard](assets/sample-dashboard.html), smart LLM-based
extraction (`--smart`), and `BeaconGuard`, which flags chatbot replies that recommend a
competitor ([Advanced](https://yotambraun.github.io/promptbeacon/advanced/)).

Coming next: an [AI Recommendation Index](https://yotambraun.github.io/promptbeacon/recommendation-index/)
of which open-source projects AI assistants recommend, in 30 developer categories.

## Who it's for

- **Open-source maintainers and developer-tool teams**: does ChatGPT recommend *your*
  library, and is that changing?
- **Indie developers and technical founders**: your product's AI visibility, in code and CI.
- **AI and eval engineers**: brand visibility as a check next to your other evals.

Brand, marketing and website teams auditing what assistants say about a site are better
served by [Saylent](https://github.com/yotambraun/saylent).

## Documentation

**[yotambraun.github.io/promptbeacon](https://yotambraun.github.io/promptbeacon/)**:
[Quickstart](https://yotambraun.github.io/promptbeacon/quickstart/) ·
[Use from AI assistants](https://yotambraun.github.io/promptbeacon/mcp/) ·
[Python API](https://yotambraun.github.io/promptbeacon/python/) ·
[Models & local LLMs](https://yotambraun.github.io/promptbeacon/models/) ·
[CLI](https://yotambraun.github.io/promptbeacon/cli/) ·
[Open-source projects](https://yotambraun.github.io/promptbeacon/projects/) ·
[Badges & cards](https://yotambraun.github.io/promptbeacon/share/) ·
[CI & examples](https://yotambraun.github.io/promptbeacon/examples/) ·
[API reference](https://yotambraun.github.io/promptbeacon/api-reference/)

## Contributing

Contributions are welcome. [CONTRIBUTING.md](CONTRIBUTING.md) covers setup
(`uv sync --all-extras`), tests, lint and types; [TODO.md](TODO.md) lists ideas. See
[CHANGELOG.md](CHANGELOG.md) for what changed in each release.

## License

Apache License 2.0. See [LICENSE](LICENSE).

Built with [LiteLLM](https://github.com/BerriAI/litellm), [Pydantic](https://docs.pydantic.dev/),
[DuckDB](https://duckdb.org/), [Typer](https://typer.tiangolo.com/), [Rich](https://rich.readthedocs.io/)
and the [MCP Python SDK](https://github.com/modelcontextprotocol/python-sdk).
