pi-web-providers 2.1.0 β†’ 2.3.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.
Files changed (3) hide show
  1. package/README.md +145 -64
  2. package/dist/index.js +3409 -15374
  3. package/package.json +11 -6
package/README.md CHANGED
@@ -1,7 +1,8 @@
1
1
  # 🌍 pi-web-providers
2
2
 
3
3
  A _meta_ web extension for [pi](https://pi.dev) that routes search, content
4
- extraction, answers, and research through configurable per-tool providers.
4
+ extraction, answers, and research through configurable per-tool providers, with
5
+ explicit provider-specific option schemas for each managed tool.
5
6
 
6
7
  ## Why?
7
8
 
@@ -12,12 +13,15 @@ off entirely.
12
13
 
13
14
  ## ✨ Features
14
15
 
15
- - **Multiple providers**: Claude, Cloudflare, Codex, Exa, Firecrawl,
16
- Gemini, Linkup, Perplexity, Parallel, [Tavily](https://tavily.com), Valyu
17
- - **Batched search and answers**: run several related queries in a single
18
- `web_search` or `web_answer` call and get grouped results back in one response
19
- - **Async contents prefetch**: optionally start background `web_contents`
20
- extraction from `web_search` results and reuse the cached pages later
16
+ - **Provider-aware tool options**: pi only exposes the provider settings that
17
+ actually apply to the backend you selected, so tool calls are easier to
18
+ discover and harder to get wrong
19
+ - **Batched search and answers**: run several related queries or questions in a
20
+ single `web_search` or `web_answer` call and get grouped results back in one
21
+ response
22
+ - **Background contents prefetch**: optionally start `web_contents`
23
+ extraction from `web_search` results in the background and reuse the cached
24
+ pages later for faster follow-up reads
21
25
 
22
26
  ## πŸ“¦ Install
23
27
 
@@ -38,17 +42,25 @@ settings UI mirrors the three sections below: tools, providers, and settings.
38
42
 
39
43
  Each tool can be routed to any compatible provider:
40
44
 
45
+ **Built-in local providers**
46
+
47
+ | Provider | search | contents | answer | research | Auth |
48
+ | ---------- | :----: | :------: | :----: | :------: | ---------------------- |
49
+ | **Claude** | βœ” | | βœ” | | Local Claude Code auth |
50
+ | **Codex** | βœ” | | | | Local Codex CLI auth |
51
+
52
+ **API-backed providers**
53
+
41
54
  | Provider | search | contents | answer | research | Auth |
42
55
  | -------------- | :----: | :------: | :----: | :------: | ------------------------------------------------ |
43
- | **Claude** | βœ” | | βœ” | | Local Claude Code auth |
44
56
  | **Cloudflare** | | βœ” | | | `CLOUDFLARE_API_TOKEN` + `CLOUDFLARE_ACCOUNT_ID` |
45
- | **Codex** | βœ” | | | | Local Codex CLI auth |
46
57
  | **Exa** | βœ” | βœ” | βœ” | βœ” | `EXA_API_KEY` |
47
58
  | **Firecrawl** | βœ” | βœ” | | | `FIRECRAWL_API_KEY` |
48
59
  | **Gemini** | βœ” | | βœ” | βœ” | `GOOGLE_API_KEY` |
49
60
  | **Linkup** | βœ” | βœ” | | | `LINKUP_API_KEY` |
50
- | **Perplexity** | βœ” | | βœ” | βœ” | `PERPLEXITY_API_KEY` |
61
+ | **OpenAI** | βœ” | | βœ” | βœ” | `OPENAI_API_KEY` |
51
62
  | **Parallel** | βœ” | βœ” | | | `PARALLEL_API_KEY` |
63
+ | **Perplexity** | βœ” | | βœ” | βœ” | `PERPLEXITY_API_KEY` |
52
64
  | **Tavily** | βœ” | βœ” | | | `TAVILY_API_KEY` |
53
65
  | **Valyu** | βœ” | βœ” | βœ” | βœ” | `VALYU_API_KEY` |
54
66
 
@@ -78,17 +90,18 @@ results should arrive as soon as they are ready.
78
90
  <details>
79
91
  <summary><strong>Parameters and behavior</strong></summary>
80
92
 
81
- | Parameter | Type | Default | Description |
82
- | ------------ | -------- | -------- | -------------------------------------------------------------- |
83
- | `queries` | string[] | required | One or more search queries to run (max 10) |
84
- | `maxResults` | integer | `5` | Result count per query, clamped to `1–20` |
85
- | `options` | object | β€” | Provider-specific search options and local `prefetch` settings |
93
+ | Parameter | Type | Default | Description |
94
+ | ------------ | -------- | -------- | ------------------------------------------------------------------------------------------ |
95
+ | `queries` | string[] | required | One or more search queries to run (max 10) |
96
+ | `maxResults` | integer | `5` | Result count per query, clamped to `1–20` |
97
+ | `options` | object | β€” | `provider` settings exposed by the selected provider schema, plus local `runtime` settings |
86
98
 
87
- `web_search.options.prefetch` is local-only and not forwarded into the provider
88
- SDK. It accepts `provider`, `maxUrls`, `ttlMs`, and `contentsOptions`, and
89
- starts a background page-extraction workflow only when `prefetch.provider` is
90
- set. `/web-providers` can also persist default search prefetch settings under
91
- `settings.search`.
99
+ `web_search.options.runtime.prefetch` is local-only and is not forwarded to the
100
+ provider SDK. It accepts `provider`, `maxUrls`, and `ttlMs`, and starts a
101
+ background page-extraction workflow only when `prefetch.provider` is set.
102
+ `/web-providers` can also persist default search prefetch settings under
103
+ `settings.search`. Per-call retry and timeout overrides also live under
104
+ `web_search.options.runtime`.
92
105
 
93
106
  </details>
94
107
 
@@ -102,10 +115,10 @@ each page can be acted on independently.
102
115
  <details>
103
116
  <summary><strong>Parameters and behavior</strong></summary>
104
117
 
105
- | Parameter | Type | Default | Description |
106
- | --------- | -------- | -------- | ------------------------------------ |
107
- | `urls` | string[] | required | One or more URLs to extract |
108
- | `options` | object | β€” | Provider-specific extraction options |
118
+ | Parameter | Type | Default | Description |
119
+ | --------- | -------- | -------- | --------------------------------------------------------------------------------------------------------------- |
120
+ | `urls` | string[] | required | One or more URLs to extract |
121
+ | `options` | object | β€” | `provider` extraction settings exposed by the selected provider schema, plus optional local `runtime` overrides |
109
122
 
110
123
  `web_contents` reuses any matching cached pages already present in the local
111
124
  in-memory cacheβ€”whether they came from prefetch or an earlier readβ€”and only
@@ -123,10 +136,10 @@ calls when earlier independent answers can unblock the next step.
123
136
  <details>
124
137
  <summary><strong>Parameters and behavior</strong></summary>
125
138
 
126
- | Parameter | Type | Default | Description |
127
- | --------- | -------- | -------- | ---------------------------------------------------- |
128
- | `queries` | string[] | required | One or more questions to answer in one call (max 10) |
129
- | `options` | object | β€” | Provider-specific options |
139
+ | Parameter | Type | Default | Description |
140
+ | --------- | -------- | -------- | ---------------------------------------------------------------------------------------------------- |
141
+ | `queries` | string[] | required | One or more questions to answer in one call (max 10) |
142
+ | `options` | object | β€” | `provider` settings exposed by the selected provider schema, plus optional local `runtime` overrides |
130
143
 
131
144
  Responses are grouped into per-question sections when more than one question is
132
145
  provided.
@@ -143,15 +156,15 @@ saved report path.
143
156
  <details>
144
157
  <summary><strong>Parameters and behavior</strong></summary>
145
158
 
146
- | Parameter | Type | Default | Description |
147
- | --------- | ------ | -------- | -------------------------- |
148
- | `input` | string | required | Research brief or question |
149
- | `options` | object | β€” | Provider-specific options |
159
+ | Parameter | Type | Default | Description |
160
+ | --------- | ------ | -------- | ----------------------------------------------------------------------------- |
161
+ | `input` | string | required | Research brief or question |
162
+ | `options` | object | β€” | Provider-specific `provider` settings exposed by the selected provider schema |
150
163
 
151
- `options` are provider-specific. Equivalent concepts can use
152
- different field names across SDKsβ€”for example Perplexity uses `country`, Exa
153
- uses `userLocation`, and Valyu uses `countryCode`. Runtime `options` override
154
- provider config, but managed tool inputs and tool wiring stay fixed.
164
+ `options.provider` is provider-specific. Equivalent concepts can use different
165
+ field names across SDKsβ€”for example Perplexity uses `country`, Exa uses
166
+ `userLocation`, and Valyu uses `countryCode`. Unlike the other managed tools,
167
+ `web_research` does not support per-call `options.runtime` overrides.
155
168
 
156
169
  Unlike the other managed tools, `web_research` does not accept local timeout,
157
170
  retry, polling, or resume controls. Research has one opinionated execution
@@ -170,8 +183,8 @@ The built-in providers below are thin adapters around official SDKs.
170
183
  - SDK: `@anthropic-ai/claude-agent-sdk`
171
184
  - Uses Claude Code's built-in `WebSearch` and `WebFetch` tools behind a
172
185
  structured JSON adapter
173
- - Supports request-shaping `options` such as `model`, `thinking`, `effort`, and
174
- `maxTurns`
186
+ - Exposes `model`, `thinking`, `effort`, `maxThinkingTokens`, `maxTurns`, and
187
+ `maxBudgetUsd` as provider options for search and answer calls
175
188
  - Great for search plus grounded answers if you already use Claude Code locally
176
189
 
177
190
  </details>
@@ -184,8 +197,7 @@ The built-in providers below are thin adapters around official SDKs.
184
197
  endpoint
185
198
  - Good for JavaScript-heavy pages that need a real browser render before
186
199
  extraction
187
- - Supports provider-specific markdown options such as `gotoOptions`,
188
- `waitForSelector`, `waitForTimeout`, `cacheTTL`, and request filtering
200
+ - Exposes `gotoOptions.waitUntil` as the provider-specific contents option
189
201
 
190
202
  **Setup**
191
203
 
@@ -220,8 +232,8 @@ scope, or account ID is usually wrong.
220
232
 
221
233
  - SDK: `@openai/codex-sdk`
222
234
  - Runs in read-only mode with web search enabled
223
- - Supports request-shaping `web_search.options` such as `model`,
224
- `modelReasoningEffort`, and `webSearchMode`
235
+ - Exposes `model`, `modelReasoningEffort`, and `webSearchMode` as provider
236
+ options for `web_search`
225
237
  - Best if you already use the local Codex CLI and auth flow
226
238
 
227
239
  </details>
@@ -234,6 +246,11 @@ scope, or account ID is usually wrong.
234
246
  - `web_research` is exposed through pi's async research workflow
235
247
  - Neural, keyword, hybrid, and deep-research search modes
236
248
  - Inline text-content extraction on search results
249
+ - Exposes search options such as `category`, `type`, date filters,
250
+ `includeDomains`, `excludeDomains`, `userLocation`, and `contents`
251
+ - Persisted Exa defaults are scoped under `providers.exa.options.search`
252
+ - `web_contents`, `web_answer`, and `web_research` currently use fixed adapter
253
+ behavior with no extra per-call provider options
237
254
 
238
255
  </details>
239
256
 
@@ -244,11 +261,10 @@ scope, or account ID is usually wrong.
244
261
  - Supports `web_search` and `web_contents`
245
262
  - Search can optionally include Firecrawl scrape-backed result enrichment
246
263
  - Contents extraction uses Firecrawl scrape with markdown-first defaults
247
- - Supports provider-specific `options.search` such as `sources`, `categories`,
264
+ - Exposes search options such as `lang`, `country`, `sources`, `categories`,
248
265
  `location`, `timeout`, and `scrapeOptions`
249
- - Supports provider-specific `options.scrape` such as `formats`,
250
- `onlyMainContent`, `waitFor`, `headers`, `location`, `mobile`, `proxy`, and
251
- cache controls
266
+ - Exposes contents options such as `formats`, `onlyMainContent`, `includeTags`,
267
+ `excludeTags`, `waitFor`, `headers`, `location`, `mobile`, and `proxy`
252
268
 
253
269
  </details>
254
270
 
@@ -260,8 +276,9 @@ scope, or account ID is usually wrong.
260
276
  - `web_research` is exposed through pi's async research workflow
261
277
  - Google Search grounding for answers
262
278
  - Deep-research agents via Google's Gemini API
263
- - Supports provider-specific request options such as `model`, `config`,
264
- `generation_config`, and `agent_config` depending on the tool
279
+ - Exposes `model` and `generation_config` for search, `model` and `config`
280
+ for answers, and `agent_config`, `store`, `response_format`,
281
+ `response_modalities`, `system_instruction`, and `tools` for research
265
282
 
266
283
  </details>
267
284
 
@@ -271,14 +288,70 @@ scope, or account ID is usually wrong.
271
288
  - SDK: `linkup-sdk`
272
289
  - Supports `web_search` via Linkup Search with fixed `searchResults` output
273
290
  - Supports `web_contents` via Linkup Fetch and always returns markdown
274
- - Supports provider-specific `options.search` such as `depth`, domain filters,
275
- image inclusion, and date filters
276
- - Supports provider-specific `options.fetch` such as `renderJs`,
277
- `includeRawHtml`, and `extractImages`
291
+ - Exposes search options `depth`, `includeImages`, `includeDomains`,
292
+ `excludeDomains`, `fromDate`, and `toDate`
293
+ - Exposes contents options `renderJs`, `includeRawHtml`, and `extractImages`
278
294
  - Good fit for a simple search-plus-markdown setup without extra provider wiring
279
295
 
280
296
  </details>
281
297
 
298
+ <details>
299
+ <summary><strong>OpenAI</strong></summary>
300
+
301
+ - SDK: `openai`
302
+ - Supports `web_search`, `web_answer`, and `web_research`
303
+ - Uses the Responses API for structured web search, grounded answers, and
304
+ deep-research runs
305
+ - Always enables OpenAI's built-in `web_search_preview` tool for search,
306
+ answer, and research calls
307
+ - Exposes `model` and `instructions` for `web_search` and `web_answer`
308
+ - Exposes `model`, `instructions`, and `max_tool_calls` for `web_research`
309
+ - Good fit when you want official OpenAI web-grounded search, answers, and deep
310
+ research behind pi's managed tool abstractions
311
+
312
+ **Setup**
313
+
314
+ 1. Create or reuse an OpenAI API key.
315
+ 2. Configure pi to route `web_search`, `web_answer`, `web_research`, or any
316
+ subset of them to `openai`.
317
+ 3. Optionally set default models under `providers.openai.options.search.model`,
318
+ `providers.openai.options.answer.model`, and
319
+ `providers.openai.options.research.model`.
320
+
321
+ ```json
322
+ {
323
+ "tools": {
324
+ "search": "openai",
325
+ "answer": "openai",
326
+ "research": "openai"
327
+ },
328
+ "providers": {
329
+ "openai": {
330
+ "apiKey": "OPENAI_API_KEY",
331
+ "options": {
332
+ "search": {
333
+ "model": "gpt-4.1"
334
+ },
335
+ "answer": {
336
+ "model": "gpt-4.1"
337
+ },
338
+ "research": {
339
+ "model": "o4-mini-deep-research"
340
+ }
341
+ }
342
+ }
343
+ }
344
+ }
345
+ ```
346
+
347
+ You can also set `instructions` as a provider default under
348
+ `providers.openai.options.search`, `providers.openai.options.answer`, or
349
+ `providers.openai.options.research`, and set `max_tool_calls` under
350
+ `providers.openai.options.research`. All of them can also be overridden per
351
+ call.
352
+
353
+ </details>
354
+
282
355
  <details>
283
356
  <summary><strong>Perplexity</strong></summary>
284
357
 
@@ -287,8 +360,9 @@ scope, or account ID is usually wrong.
287
360
  - `web_research` is exposed through pi's async research workflow
288
361
  - Uses Perplexity Search for `web_search`
289
362
  - Uses Sonar for `web_answer` and `sonar-deep-research` for `web_research`
290
- - Supports provider-specific `web_search.options` such as `country`,
291
- `search_mode`, `search_domain_filter`, and `search_recency_filter`
363
+ - Exposes search options `country`, `search_mode`,
364
+ `search_domain_filter`, and `search_recency_filter`
365
+ - Exposes `model` for answer and research calls
292
366
 
293
367
  </details>
294
368
 
@@ -298,7 +372,8 @@ scope, or account ID is usually wrong.
298
372
  - SDK: `parallel-web`
299
373
  - Agentic and one-shot search modes
300
374
  - Page content extraction with excerpt and full-content toggles
301
- - Supports provider-specific search and extraction options from the Parallel SDK
375
+ - Exposes search option `mode`
376
+ - Exposes contents options `excerpts` and `full_content`
302
377
 
303
378
  </details>
304
379
 
@@ -309,12 +384,11 @@ scope, or account ID is usually wrong.
309
384
  - Supports `web_search` via Tavily Search
310
385
  - Supports `web_contents` via Tavily Extract
311
386
  - Good for pairing LLM-oriented web search with lightweight page extraction
312
- - Supports provider-specific `options.search` such as `searchDepth`, `topic`,
313
- `timeRange`, `includeRawContent`, `includeDomains`, `excludeDomains`,
314
- `country`, `exactMatch`, and `includeFavicon`
315
- - Supports provider-specific `options.extract` such as `extractDepth`,
316
- `format`, `includeImages`, `query`, `chunksPerSource`, and
317
- `includeFavicon`
387
+ - Exposes search options `topic`, `searchDepth`, `timeRange`, `country`,
388
+ `exactMatch`, `includeAnswer`, `includeRawContent`, `includeImages`,
389
+ `includeFavicon`, `includeDomains`, `excludeDomains`, and `days`
390
+ - Exposes contents options `extractDepth`, `format`, `includeImages`, `query`,
391
+ `chunksPerSource`, and `includeFavicon`
318
392
 
319
393
  </details>
320
394
 
@@ -325,9 +399,12 @@ scope, or account ID is usually wrong.
325
399
  - Supports `web_search`, `web_contents`, `web_answer`, and `web_research`
326
400
  - `web_research` is exposed through pi's async research workflow
327
401
  - Web, proprietary, and news search types
328
- - Supports provider-specific options such as `countryCode`, `responseLength`, and
329
- search/source filters
330
- - Configurable response length for answers and research
402
+ - Exposes search options `searchType`, `responseLength`, and `countryCode`
403
+ - Exposes answer and research options `responseLength` and `countryCode`
404
+ - Persisted Valyu defaults are scoped under `providers.valyu.options.search`,
405
+ `providers.valyu.options.answer`, and `providers.valyu.options.research`
406
+ - `web_contents` currently uses fixed adapter behavior with no extra per-call
407
+ provider options
331
408
 
332
409
  </details>
333
410
 
@@ -337,6 +414,10 @@ The `custom` provider lets you bring your own wrapper command for any
337
414
  managed tool. Each capability can point at a different local command under
338
415
  `providers["custom"].options`.
339
416
 
417
+ `custom` does not expose standard per-call `options.provider` fields. Put
418
+ provider-specific behavior in the wrapper configuration or in the wrapper
419
+ implementation.
420
+
340
421
  The repo includes actual wrapper examples under
341
422
  [`examples/custom/wrappers/`](examples/custom/wrappers/). They are
342
423
  small bash scripts that use `jq` for JSON handling. Each one uses a different