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

# Compare brands across models

> Share of mentions for each model.

Each AI model picks different brands for the same prompt. This recipe runs a prompt set on every model, then gives, per model, the share of answers that name each brand.

5 prompts on 5 models is 25 tasks: \$0.325.

```python compare.py theme={null}
import os, time, requests
from collections import Counter

API = "https://api.apiforgeo.com/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['AFG_API_KEY']}"}
MODELS = ["chatgpt", "google-ai-mode", "google-ai-overview", "gemini", "copilot"]
PROMPTS = [
    "best running shoes for flat feet",
    "best trail running shoes",
    "most durable running shoes",
    "best running shoes for beginners",
    "best cushioned running shoes",
]

# 1. Create one task per prompt and model.
tasks = []
for prompt in PROMPTS:
    for model in MODELS:
        res = requests.post(f"{API}/tasks", headers=HEADERS,
                            json={"prompt": prompt, "model": model, "country": "US", "language": "en"})
        res.raise_for_status()
        tasks.append(res.json())

# 2. Wait until each one ends.
done = []
for task in tasks:
    while task["status"] in ("queued", "processing"):
        time.sleep(5)
        task = requests.get(f"{API}/tasks/{task['id']}", headers=HEADERS).json()
    if task["status"] == "completed":
        done.append(task)

# 3. Share of mentions: the percent of a model's answers that name the brand.
for model in MODELS:
    answers = [t for t in done if t["model"] == model]
    if not answers:
        continue
    named = Counter(name for t in answers
                    for name in {e["name"] for e in t["result"]["entities"] if e["type"] == "brand"})
    top = ", ".join(f"{brand} {100 * n // len(answers)}%" for brand, n in named.most_common(5))
    print(f"{model:20} {top}")
```

The output has one line per model, for example:

```text theme={null}
chatgpt              Brooks 100%, ASICS 100%, Hoka 80%, New Balance 60%, Saucony 40%
google-ai-mode       Brooks 100%, Hoka 100%, ASICS 80%, Saucony 60%, Nike 40%
...
```

## Go further

* **Rank, not only presence.** `position` is `1` for the brand named first. Average it per model to see who leads.
* **Tone.** `sentiment` goes from `-1` to `+1`, and `stance` says if the answer recommends (`chosen`) or criticizes (`criticized`) the brand.
* **Why.** `sources` lists the pages each model cited. The domains that come back often are the ones to work on.
* **Other markets.** Change `country` and `language`, for example `"country": "FR", "language": "fr"`. [`GET /v1/models`](https://docs.apiforgeo.com/api-reference/list-models) lists where each model runs.
* **Over time.** Run it every day with [Track a prompt set every day](https://docs.apiforgeo.com/recipes/daily-prompt-set.md).

See [Task results](https://docs.apiforgeo.com/concepts/task-results.md) for every field.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.