@bastani/pi-ai 0.9.80-alpha.1 → 0.9.81-alpha.1

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 (49) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +8 -11
  3. package/dist/api/anthropic-messages.js +3 -1
  4. package/dist/api/anthropic-messages.js.map +1 -1
  5. package/dist/api/constrained-sampling.d.ts.map +1 -1
  6. package/dist/api/constrained-sampling.js +3 -0
  7. package/dist/api/constrained-sampling.js.map +1 -1
  8. package/dist/api/google-generative-ai.d.ts.map +1 -1
  9. package/dist/api/google-generative-ai.js +5 -10
  10. package/dist/api/google-generative-ai.js.map +1 -1
  11. package/dist/api/google-shared.d.ts +0 -4
  12. package/dist/api/google-shared.d.ts.map +1 -1
  13. package/dist/api/google-shared.js +1 -13
  14. package/dist/api/google-shared.js.map +1 -1
  15. package/dist/api/google-vertex.d.ts.map +1 -1
  16. package/dist/api/google-vertex.js +11 -13
  17. package/dist/api/google-vertex.js.map +1 -1
  18. package/dist/env-api-keys.js +7 -7
  19. package/dist/env-api-keys.js.map +1 -1
  20. package/dist/providers/data/.manifest.json +1 -1
  21. package/dist/providers/data/google-vertex.json +1 -1
  22. package/dist/providers/data/google.json +1 -1
  23. package/dist/providers/data/opencode.json +1 -1
  24. package/dist/providers/data/openrouter.json +1 -1
  25. package/dist/providers/data/qwen-token-plan-cn.json +1 -1
  26. package/dist/providers/data/qwen-token-plan-individual-cn.json +1 -1
  27. package/dist/providers/data/qwen-token-plan-individual.json +1 -1
  28. package/dist/providers/data/qwen-token-plan.json +1 -1
  29. package/dist/providers/data/radius.json +1 -1
  30. package/dist/providers/data/vercel-ai-gateway.json +1 -1
  31. package/dist/providers/qwen-token-plan-cn.d.ts.map +1 -1
  32. package/dist/providers/qwen-token-plan-cn.js +8 -3
  33. package/dist/providers/qwen-token-plan-cn.js.map +1 -1
  34. package/dist/providers/qwen-token-plan-individual-cn.d.ts.map +1 -1
  35. package/dist/providers/qwen-token-plan-individual-cn.js +7 -2
  36. package/dist/providers/qwen-token-plan-individual-cn.js.map +1 -1
  37. package/dist/providers/qwen-token-plan-individual.d.ts.map +1 -1
  38. package/dist/providers/qwen-token-plan-individual.js +7 -2
  39. package/dist/providers/qwen-token-plan-individual.js.map +1 -1
  40. package/dist/providers/qwen-token-plan.d.ts.map +1 -1
  41. package/dist/providers/qwen-token-plan.js +8 -3
  42. package/dist/providers/qwen-token-plan.js.map +1 -1
  43. package/dist/utils/retry.d.ts.map +1 -1
  44. package/dist/utils/retry.js +1 -0
  45. package/dist/utils/retry.js.map +1 -1
  46. package/dist/utils/version.d.ts +1 -1
  47. package/dist/utils/version.js +1 -1
  48. package/dist/utils/version.js.map +1 -1
  49. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -4,6 +4,29 @@ This package is a Bastani fork of `@earendil-works/pi-ai`. Upstream history at t
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.9.81-alpha.1] - 2026-11-13
8
+
9
+ ### Added
10
+
11
+ - Added `deepseek-v4.1-flash` and `deepseek-v4.1-flash-1017` to the Qwen Token Plan Individual providers, and per-plan key variables `QWEN_TOKEN_PLAN_TEAM_API_KEY`, `QWEN_TOKEN_PLAN_TEAM_CN_API_KEY`, `QWEN_TOKEN_PLAN_INDIVIDUAL_API_KEY`, and `QWEN_TOKEN_PLAN_INDIVIDUAL_CN_API_KEY`; the shared `QWEN_TOKEN_PLAN_API_KEY` and `QWEN_TOKEN_PLAN_CN_API_KEY` still work as fallbacks (upstream [#11773](https://github.com/earendil-works/pi/issues/11773), [#12112](https://github.com/earendil-works/pi/pull/12112))
12
+
13
+ ### Changed
14
+
15
+ - Updated `@google/genai` to 2.32.0 with automatic continuation turned off, so a `CONTINUATION` finish reason ends the turn with stop reason `length` (upstream [#12103](https://github.com/earendil-works/pi/pull/12103), [#12108](https://github.com/earendil-works/pi/pull/12108))
16
+ - Qwen Token Plan providers now use the current gateways (`token-plan.maas.qwencloudapi.com` international, `token-plan.maas.qianwenaiapi.com` China), and `qwen-token-plan` and `qwen-token-plan-cn` are named "Qwen Token Plan Team" and "Qwen Token Plan Team CN". Provider IDs are unchanged, and the old `aliyuncs.com` hosts still work (upstream [#11773](https://github.com/earendil-works/pi/issues/11773), [#12112](https://github.com/earendil-works/pi/pull/12112))
17
+
18
+ ### Fixed
19
+
20
+ - Fixed tools with `strict: "prefer"` constrained sampling being sent in strict mode when their schema contains a node without a `type`, such as `items: {}`, `Type.Unknown()`, or a bare `const`, which OpenAI rejects with a 400 error; these tools now fall back to non-strict mode, `strict: "require"` fails locally, and nodes with only an `enum` stay strict (upstream [#12049](https://github.com/earendil-works/pi/issues/12049))
21
+ - Fixed provider errors reading `"Connection closed."` not being classified as retryable (upstream [#12093](https://github.com/earendil-works/pi/pull/12093))
22
+ - Fixed non-strict Anthropic tool schemas dropping the root `additionalProperties` keyword, including when `strict: "prefer"` falls back to non-strict mode (upstream [#12100](https://github.com/earendil-works/pi/pull/12100))
23
+ - Fixed the `google-generative-ai` and `google-vertex` adapters rejecting a custom `fetch` option instead of forwarding it through `httpOptions.fetch`, and kept the global undici dispatcher's idle timeouts active when no custom `fetch` is supplied; Vertex ADC token requests still use `google-auth-library`'s own HTTP client (upstream [#12103](https://github.com/earendil-works/pi/pull/12103), [#12108](https://github.com/earendil-works/pi/pull/12108))
24
+
25
+ ### Removed
26
+
27
+ - Removed the unused `mapStopReasonString` export from `@bastani/pi-ai/api/google-shared` (upstream [#12103](https://github.com/earendil-works/pi/pull/12103))
28
+ - Removed the retired `deepseek-v3.2` and `deepseek-v4-flash` from the Qwen Token Plan Team providers; use `deepseek-v4-flash-0731` or `deepseek-v4.1-flash` (upstream [#11773](https://github.com/earendil-works/pi/issues/11773), [#12112](https://github.com/earendil-works/pi/pull/12112))
29
+
7
30
  ## [0.9.79] - 2026-11-12
8
31
 
9
32
  Anthropic message threads follow the endpoint, not the provider name.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @bastani/pi-ai
2
2
 
3
- Bastani-branded fork of [`@earendil-works/pi-ai`](https://www.npmjs.com/package/@earendil-works/pi-ai) from [earendil-works/pi](https://github.com/earendil-works/pi). Originally forked at **v0.84.2** (`914cf1472e715297caa30db4b9535d534a9eb718`); applicable upstream Pi AI fixes and the unified model catalog are synced through [`4b519d3bb19b57a368129b167a48da16e447d9f6`](https://github.com/earendil-works/pi/commit/4b519d3bb19b57a368129b167a48da16e447d9f6). `@bastani/pi-ai` publishes at the same version as Atomic. `npm run build` refreshes the models.dev catalog, same as upstream.
3
+ Bastani-branded fork of [`@earendil-works/pi-ai`](https://www.npmjs.com/package/@earendil-works/pi-ai) from [earendil-works/pi](https://github.com/earendil-works/pi). Originally forked at **v0.84.2** (`914cf1472e715297caa30db4b9535d534a9eb718`); applicable upstream Pi AI fixes and the unified model catalog are synced through [`d36266e06669c6991a7c9509d1da04d18d30378d`](https://github.com/earendil-works/pi/commit/d36266e06669c6991a7c9509d1da04d18d30378d). `@bastani/pi-ai` publishes at the same version as Atomic. `npm run build` refreshes the models.dev catalog, same as upstream.
4
4
 
5
5
  The public API is a drop-in replacement: install `@bastani/pi-ai` and import from `@bastani/pi-ai` instead of `@earendil-works/pi-ai`. See [NOTICE.md](NOTICE.md). This package lives in the Atomic monorepo and publishes from `.github/workflows/publish.yml`. The first npm version must be published by hand so trusted publishing can be attached.
6
6
 
@@ -96,7 +96,7 @@ Unified LLM API with provider collections, automatic auth resolution, token and
96
96
  - **Fireworks** (uses OpenAI- and Anthropic-compatible APIs)
97
97
  - **Kimi For Coding** (Moonshot AI subscription endpoint, uses OpenAI Chat Completions)
98
98
  - **Meta** (Model API, uses OpenAI Responses-compatible API)
99
- - **Qwen Token Plan** (separate Individual and existing catalogs, with a separate China provider)
99
+ - **Qwen Token Plan** (separate Team and Individual providers, each with a China provider)
100
100
  - **Xiaomi MiMo** (defaults to API billing endpoint, with separate Token Plan providers for `cn`/`ams`/`sgp` regions)
101
101
  - **Any OpenAI-compatible API**: Ollama, vLLM, LM Studio, etc.
102
102
 
@@ -527,21 +527,18 @@ Built-in providers resolve these env vars (Node.js; in browsers pass `apiKey` ex
527
527
  | OpenCode Zen / OpenCode Go | `OPENCODE_API_KEY` |
528
528
  | Kimi For Coding | `KIMI_API_KEY` |
529
529
  | Meta | `META_API_KEY` |
530
- | Qwen Token Plan (existing catalog) | `QWEN_TOKEN_PLAN_API_KEY` |
531
- | Qwen Token Plan (Individual) | `QWEN_TOKEN_PLAN_API_KEY` |
532
- | Qwen Token Plan (China) | `QWEN_TOKEN_PLAN_CN_API_KEY` |
533
- | Qwen Token Plan (Individual, China) | `QWEN_TOKEN_PLAN_CN_API_KEY` |
530
+ | Qwen Token Plan (Team) | `QWEN_TOKEN_PLAN_TEAM_API_KEY` |
531
+ | Qwen Token Plan (Individual) | `QWEN_TOKEN_PLAN_INDIVIDUAL_API_KEY` |
532
+ | Qwen Token Plan (Team, China) | `QWEN_TOKEN_PLAN_TEAM_CN_API_KEY` |
533
+ | Qwen Token Plan (Individual, China) | `QWEN_TOKEN_PLAN_INDIVIDUAL_CN_API_KEY` |
534
534
  | Xiaomi MiMo (API billing) | `XIAOMI_API_KEY` |
535
535
  | Xiaomi MiMo Token Plan (China) | `XIAOMI_TOKEN_PLAN_CN_API_KEY` |
536
536
  | Xiaomi MiMo Token Plan (Amsterdam) | `XIAOMI_TOKEN_PLAN_AMS_API_KEY` |
537
537
  | Xiaomi MiMo Token Plan (Singapore) | `XIAOMI_TOKEN_PLAN_SGP_API_KEY` |
538
538
  | GitHub Copilot | `COPILOT_GITHUB_TOKEN` |
539
539
 
540
- `qwen-token-plan-individual` and `qwen-token-plan` share the international endpoint and
541
- `QWEN_TOKEN_PLAN_API_KEY`. The Individual provider exposes only the models documented for Individual
542
- subscriptions, while the existing provider retains its broader catalog for backward compatibility.
543
- `qwen-token-plan-individual-cn` applies the same Individual catalog to the China endpoint and
544
- `QWEN_TOKEN_PLAN_CN_API_KEY`.
540
+ Qwen Token Plan has a Team and an Individual (Personal) provider per region; each exposes only the
541
+ models documented for its subscription. Set the key variable of your plan.
545
542
  Stored credentials remain provider-scoped, so save the key under the provider ID you register.
546
543
 
547
544
  Amazon Bedrock resolves ambient AWS credentials (`AWS_PROFILE`, access key pairs, `AWS_BEARER_TOKEN_BEDROCK`, ECS task roles, web identity tokens); its provider-owned login flow supports bearer tokens, AWS profiles, and the existing credential chain. Vertex AI resolves either an explicit key or gcloud Application Default Credentials plus project/location, with a provider-owned login flow for API keys, ADC, and service-account files.
@@ -1856,8 +1856,10 @@ function convertTools(tools, isOAuthToken, supportsEagerToolInputStreaming, supp
1856
1856
  type: "object",
1857
1857
  properties: projectedUnion?.properties ?? schema.properties ?? {},
1858
1858
  required: projectedUnion?.required ?? schema.required ?? [],
1859
- // Keep shared definitions so property $refs still resolve. Other root keywords stay out:
1859
+ // Keep shared definitions so property $refs still resolve, and additionalProperties so the
1860
+ // model knows whether extra arguments are allowed. Other root keywords stay out:
1860
1861
  // Anthropic rejects root anyOf/oneOf/allOf with a 400.
1862
+ ...(schema.additionalProperties === undefined ? {} : { additionalProperties: schema.additionalProperties }),
1861
1863
  ...(schema.$defs === undefined ? {} : { $defs: schema.$defs }),
1862
1864
  ...(schema.definitions === undefined ? {} : { definitions: schema.definitions }),
1863
1865
  };