Perplexity nie ma gotowego wbudowanego connektora do PaperClip, ale ma **MCP (Model Context Protocol)** — czyli możesz podpiąć Perplexity jako search tool do PaperClip przez niestandardowy MCP server. To jest **jedyna sensowna droga** i działa świetnie — Researcher agent zamiast „udawać" że searchuje Reddit/YouTube, **faktycznie korzysta z Perplexity API** jako silnika wyszukiwania. [skywork](https://skywork.ai/skypage/en/npm-install-error-guide/2049079959030280192)

## Dwa podejścia

| Podejście | Jak | Dla kogo |
|---|---|---|
| **Perplexity API w PaperClip** | Researcher agent wywołuje `api.perplexity.ai` jako narzędzie HTTP | Twój przypadek — PaperClip jako orchestrator |
| **PaperClip w Perplexity** | PaperClip wystawia MCP server, Perplexity Computer go łączy | Odwrotna integracja — pomijamy |

***

## Krok 1 — Klucz API Perplexity

```
perplexity.ai → Settings → API → Generate API Key
Skopiuj: pplx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
```

Perplexity API jest zgodne z OpenAI SDK — te same endpointy, inny base URL. [skywork](https://skywork.ai/skypage/en/npm-install-error-guide/2049079959030280192)

***

## Krok 2 — Dwa modele do wyboru

W Perplexity API masz dwie kategorie modeli: [skywork](https://skywork.ai/skypage/en/npm-install-error-guide/2049079959030280192)

| Model | Co robi | Dla Researcher agenta |
|---|---|---|
| `sonar` | Szybki web search + odpowiedź | Reddit/YouTube trends — idealne |
| `sonar-deep-research` | Wieloetapowy research z raportami | Głęboka analiza tematu |
| `sonar-pro` | Rozbudowane odpowiedzi + search | Jeśli potrzebujesz więcej kontekstu |

Do Researcher agenta w Twoim pipeline → **`sonar`** lub **`sonar-pro`**.

***

## Krok 3 — Tool `perplexity_search` w PaperClip

W PaperClip definiujesz **custom HTTP tool** dla Researcher agenta. Agenci w PaperClip mogą wywoływać zewnętrzne API jako narzędzia.

### Definicja toola

```json
{
  "name": "perplexity_search",
  "description": "Search the web using Perplexity AI. Returns cited, up-to-date results from Reddit, YouTube, news, and other sources. Use for trend research, engagement data, and content discovery.",
  "method": "POST",
  "url": "https://api.perplexity.ai/chat/completions",
  "headers": {
    "Authorization": "Bearer {{PERPLEXITY_API_KEY}}",
    "Content-Type": "application/json"
  },
  "body": {
    "model": "sonar-pro",
    "messages": [
      {
        "role": "system",
        "content": "You are a research assistant. Return factual, cited findings with real URLs and real engagement data where available. Never fabricate numbers."
      },
      {
        "role": "user",
        "content": "{{query}}"
      }
    ],
    "search_recency_filter": "week",
    "return_citations": true,
    "max_tokens": 2000
  }
}
```

- `PERPLEXITY_API_KEY` → wpisz w Secrets/Env w PaperClip
- `{{query}}` → agent wstawia swoje zapytanie dynamicznie
- `search_recency_filter: "week"` → tylko treści z ostatnich 7 dni (pasuje do Twojej reguły 14 dni)

***

## Krok 4 — Zaktualizuj researcher.skill

Dodaj sekcję na końcu `researcher.skill`:

```markdown
## Search Tool

You have access to: perplexity_search

Use it for every research query. Do NOT rely on internal knowledge
for engagement data, URLs, or trending topics.

Per research query, call perplexity_search with:
- Specific query targeting one platform and topic
- Example: "Reddit r/Entrepreneur AI automation posts high engagement 2025"
- Example: "YouTube trending videos AI workflow for business owners views"
- Example: "r/SaaS Claude n8n automation posts upvotes this week"

Make 5-8 focused calls per pipeline run:
1. "Reddit AI automation for business owners trending posts this week"
2. "Reddit r/ChatGPT solopreneur AI workflow high engagement 2025"
3. "Reddit r/smallbusiness AI tools replace manual work top posts"
4. "YouTube AI business automation workflow results trending 2025"
5. "YouTube solo founder AI stack review high view count this week"
6. "Reddit r/Entrepreneur AI tools time savings concrete results"

Extract from results:
- Real post titles and URLs from citations
- Engagement signals mentioned in content
- Publishing dates
- Discussion themes and sentiment

IMPORTANT: If perplexity_search returns no real URL for an idea
→ do NOT fabricate one. Flag as "URL not verified".
```

***

## Krok 5 — Opcjonalnie: MCP server dla pełnej integracji

Jeśli chcesz żeby **Perplexity Computer używał PaperClip** (odwrotna integracja), musisz wystawić MCP server z PaperClip i dodać go w Perplexity Settings → Custom Remote Connectors. [docs.openclaw](https://docs.openclaw.ai/install/updating)

```
Perplexity Settings → Connectors → + Custom connector → Remote
Name: PaperClip Pipeline
MCP Server URL: https://twoj-paperclip.domain.com/mcp/sse
Authentication: API Key
```

Ale to jest odwrotna integracja — **na razie nie potrzebujesz** tego do pipeline'u bloga. [docs.openclaw](https://docs.openclaw.ai/install/updating)

***

## Jak to działa w praktyce

```
CEO: "Run social media pipeline"
       │
       ▼
Researcher agent ← blog-registry.skill + researcher.skill
       │
       ├── perplexity_search("Reddit AI automation business owners week")
       │   ← zwraca: 5 cytowanych postów z Reddit z datami i URLami
       │
       ├── perplexity_search("YouTube solopreneur AI workflow trending")
       │   ← zwraca: 4 filmy z view count estimates i tematami
       │
       ├── perplexity_search("Claude n8n workflow results business")
       │   ← zwraca: konkretne posty, liczby, engagement signals
       │
       └── Kompiluje ~10 idei z prawdziwymi URLami → Selector
```

***

## Koszty

Perplexity API pricing dla `sonar-pro`: [skywork](https://skywork.ai/skypage/en/npm-install-error-guide/2049079959030280192)

| Co | Koszt |
|---|---|
| Input tokens | $3 / 1M |
| Output tokens | $15 / 1M |
| Search queries | $5 / 1000 requests |

Jeden pipeline run Researcher agenta (5-8 zapytań) → **~$0.04–0.08** za uruchomienie. Przy tygodniowym schedule na 3 blogi → **~$1/miesiąc** za research.

***

## Jeden plik do zaktualizowania

Jedyna zmiana którą musisz zrobić w pakiecie który już masz:

1. Dodaj sekcję `## Search Tool` do `researcher.skill` (kod powyżej)
2. W PaperClip zdefiniuj tool `perplexity_search` z kluczem API
3. Przypisz tool do Researcher agenta

Reszta pipeline'u (Selector, SEO, Writer, QA) działa bez zmian — oni operują na outputach Researchera, nie na zewnętrznych API.

Chcesz żebym zaktualizował `researcher.skill` z tą sekcją i wygenerował nową paczkę plików?