pi-web-providers 2.2.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +109 -10
- package/dist/index.js +1263 -418
- package/package.json +6 -3
package/README.md
CHANGED
|
@@ -14,13 +14,17 @@ off entirely.
|
|
|
14
14
|
## ✨ Features
|
|
15
15
|
|
|
16
16
|
- **Multiple providers**: Claude, Cloudflare, Codex, Exa, Firecrawl,
|
|
17
|
-
Gemini, Linkup, Perplexity, Parallel,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
- **
|
|
23
|
-
|
|
17
|
+
Gemini, Linkup, OpenAI, Perplexity, Parallel, Serper,
|
|
18
|
+
[Tavily](https://tavily.com), Valyu
|
|
19
|
+
- **Provider-aware tool options**: pi only exposes the provider settings that
|
|
20
|
+
actually apply to the backend you selected, so tool calls are easier to
|
|
21
|
+
discover and harder to get wrong
|
|
22
|
+
- **Batched search and answers**: run several related queries or questions in a
|
|
23
|
+
single `web_search` or `web_answer` call and get grouped results back in one
|
|
24
|
+
response
|
|
25
|
+
- **Background contents prefetch**: optionally start `web_contents`
|
|
26
|
+
extraction from `web_search` results in the background and reuse the cached
|
|
27
|
+
pages later for faster follow-up reads
|
|
24
28
|
|
|
25
29
|
## 📦 Install
|
|
26
30
|
|
|
@@ -41,17 +45,26 @@ settings UI mirrors the three sections below: tools, providers, and settings.
|
|
|
41
45
|
|
|
42
46
|
Each tool can be routed to any compatible provider:
|
|
43
47
|
|
|
48
|
+
**Built-in local providers**
|
|
49
|
+
|
|
50
|
+
| Provider | search | contents | answer | research | Auth |
|
|
51
|
+
| ---------- | :----: | :------: | :----: | :------: | ---------------------- |
|
|
52
|
+
| **Claude** | ✔ | | ✔ | | Local Claude Code auth |
|
|
53
|
+
| **Codex** | ✔ | | | | Local Codex CLI auth |
|
|
54
|
+
|
|
55
|
+
**API-backed providers**
|
|
56
|
+
|
|
44
57
|
| Provider | search | contents | answer | research | Auth |
|
|
45
58
|
| -------------- | :----: | :------: | :----: | :------: | ------------------------------------------------ |
|
|
46
|
-
| **Claude** | ✔ | | ✔ | | Local Claude Code auth |
|
|
47
59
|
| **Cloudflare** | | ✔ | | | `CLOUDFLARE_API_TOKEN` + `CLOUDFLARE_ACCOUNT_ID` |
|
|
48
|
-
| **Codex** | ✔ | | | | Local Codex CLI auth |
|
|
49
60
|
| **Exa** | ✔ | ✔ | ✔ | ✔ | `EXA_API_KEY` |
|
|
50
61
|
| **Firecrawl** | ✔ | ✔ | | | `FIRECRAWL_API_KEY` |
|
|
51
62
|
| **Gemini** | ✔ | | ✔ | ✔ | `GOOGLE_API_KEY` |
|
|
52
63
|
| **Linkup** | ✔ | ✔ | | | `LINKUP_API_KEY` |
|
|
53
|
-
| **
|
|
64
|
+
| **OpenAI** | ✔ | | ✔ | ✔ | `OPENAI_API_KEY` |
|
|
54
65
|
| **Parallel** | ✔ | ✔ | | | `PARALLEL_API_KEY` |
|
|
66
|
+
| **Perplexity** | ✔ | | ✔ | ✔ | `PERPLEXITY_API_KEY` |
|
|
67
|
+
| **Serper** | ✔ | | | | `SERPER_API_KEY` |
|
|
55
68
|
| **Tavily** | ✔ | ✔ | | | `TAVILY_API_KEY` |
|
|
56
69
|
| **Valyu** | ✔ | ✔ | ✔ | ✔ | `VALYU_API_KEY` |
|
|
57
70
|
|
|
@@ -286,6 +299,63 @@ scope, or account ID is usually wrong.
|
|
|
286
299
|
|
|
287
300
|
</details>
|
|
288
301
|
|
|
302
|
+
<details>
|
|
303
|
+
<summary><strong>OpenAI</strong></summary>
|
|
304
|
+
|
|
305
|
+
- SDK: `openai`
|
|
306
|
+
- Supports `web_search`, `web_answer`, and `web_research`
|
|
307
|
+
- Uses the Responses API for structured web search, grounded answers, and
|
|
308
|
+
deep-research runs
|
|
309
|
+
- Always enables OpenAI's built-in `web_search_preview` tool for search,
|
|
310
|
+
answer, and research calls
|
|
311
|
+
- Exposes `model` and `instructions` for `web_search` and `web_answer`
|
|
312
|
+
- Exposes `model`, `instructions`, and `max_tool_calls` for `web_research`
|
|
313
|
+
- Good fit when you want official OpenAI web-grounded search, answers, and deep
|
|
314
|
+
research behind pi's managed tool abstractions
|
|
315
|
+
|
|
316
|
+
**Setup**
|
|
317
|
+
|
|
318
|
+
1. Create or reuse an OpenAI API key.
|
|
319
|
+
2. Configure pi to route `web_search`, `web_answer`, `web_research`, or any
|
|
320
|
+
subset of them to `openai`.
|
|
321
|
+
3. Optionally set default models under `providers.openai.options.search.model`,
|
|
322
|
+
`providers.openai.options.answer.model`, and
|
|
323
|
+
`providers.openai.options.research.model`.
|
|
324
|
+
|
|
325
|
+
```json
|
|
326
|
+
{
|
|
327
|
+
"tools": {
|
|
328
|
+
"search": "openai",
|
|
329
|
+
"answer": "openai",
|
|
330
|
+
"research": "openai"
|
|
331
|
+
},
|
|
332
|
+
"providers": {
|
|
333
|
+
"openai": {
|
|
334
|
+
"apiKey": "OPENAI_API_KEY",
|
|
335
|
+
"options": {
|
|
336
|
+
"search": {
|
|
337
|
+
"model": "gpt-4.1"
|
|
338
|
+
},
|
|
339
|
+
"answer": {
|
|
340
|
+
"model": "gpt-4.1"
|
|
341
|
+
},
|
|
342
|
+
"research": {
|
|
343
|
+
"model": "o4-mini-deep-research"
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
You can also set `instructions` as a provider default under
|
|
352
|
+
`providers.openai.options.search`, `providers.openai.options.answer`, or
|
|
353
|
+
`providers.openai.options.research`, and set `max_tool_calls` under
|
|
354
|
+
`providers.openai.options.research`. All of them can also be overridden per
|
|
355
|
+
call.
|
|
356
|
+
|
|
357
|
+
</details>
|
|
358
|
+
|
|
289
359
|
<details>
|
|
290
360
|
<summary><strong>Perplexity</strong></summary>
|
|
291
361
|
|
|
@@ -311,6 +381,35 @@ scope, or account ID is usually wrong.
|
|
|
311
381
|
|
|
312
382
|
</details>
|
|
313
383
|
|
|
384
|
+
<details>
|
|
385
|
+
<summary><strong>Serper</strong></summary>
|
|
386
|
+
|
|
387
|
+
- API: Serper HTTP API
|
|
388
|
+
- Supports `web_search` via Serper's Google search endpoint
|
|
389
|
+
- Good fit for fast, straightforward Google-style organic search results
|
|
390
|
+
- Exposes search options `gl`, `hl`, `location`, `page`, and `autocorrect`
|
|
391
|
+
- Preserves rich metadata from Serper responses, including ranking position,
|
|
392
|
+
sitelinks, attributes, and top-level response context such as
|
|
393
|
+
`knowledgeGraph`, `answerBox`, `peopleAlsoAsk`, and `relatedSearches`
|
|
394
|
+
- Optional `baseUrl` overrides are supported for proxies and testing
|
|
395
|
+
|
|
396
|
+
Minimal config:
|
|
397
|
+
|
|
398
|
+
```json
|
|
399
|
+
{
|
|
400
|
+
"tools": {
|
|
401
|
+
"search": "serper"
|
|
402
|
+
},
|
|
403
|
+
"providers": {
|
|
404
|
+
"serper": {
|
|
405
|
+
"apiKey": "SERPER_API_KEY"
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
</details>
|
|
412
|
+
|
|
314
413
|
<details>
|
|
315
414
|
<summary><strong>Tavily</strong></summary>
|
|
316
415
|
|