pi-multikey 1.11.0 → 1.11.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 (3) hide show
  1. package/config.ts +5 -1
  2. package/identity.ts +10 -3
  3. package/package.json +1 -1
package/config.ts CHANGED
@@ -396,7 +396,11 @@ export function maskKey(key: string): string {
396
396
 
397
397
  /** OpenCode Zen free tier endpoint that mimics the official OpenCode client. */
398
398
  const OPENCODE_ZEN_BASE_URL = "https://opencode.ai/zen/v1";
399
- const OPENCODE_ZEN_USER_AGENT = "opencode/0.1.50 ai-sdk/openai-compatible/3.0.41";
399
+ // The Zen free tier gates on the client version parsed from User-Agent
400
+ // (HTTP 426 "OpenCode 1.17.0 or newer is required" when too old — seen live
401
+ // 2026-09-17 with 0.1.50). Track the official client's InstallationVersion:
402
+ // packages/opencode/src/session/llm/request.ts sends `opencode/${Version}`.
403
+ const OPENCODE_ZEN_USER_AGENT = "opencode/1.18.31";
400
404
  const OPENCODE_ZEN_CLIENT = "tui";
401
405
 
402
406
  /** True when a baseUrl points at OpenCode Zen (case-insensitive, trailing slash ok). */
package/identity.ts CHANGED
@@ -5,12 +5,19 @@
5
5
  * set in packages/opencode/src/session/llm/request.ts (LLMRequestPrep.prepare)
6
6
  * whenever the provider id starts with "opencode":
7
7
  *
8
- * x-opencode-client flags.client ("tui" for the terminal client)
9
- * User-Agent opencode/<InstallationVersion>
8
+ * x-opencode-client flags.client (official default "cli"; we send "tui",
9
+ * verified accepted live 2026-09-17)
10
+ * User-Agent opencode/<InstallationVersion> (pinned in config.ts:
11
+ * the free tier 426-rejects versions < 1.17.0)
10
12
  * x-opencode-session input.sessionID ("ses_" + Identifier.create(descending))
11
13
  * x-opencode-request input.user.id, the id of the user message being answered
12
14
  * ("msg_" + Identifier.create(ascending))
13
15
  *
16
+ * Server-side gates observed live 2026-09-17: a User-Agent version below 1.17.0
17
+ * draws HTTP 426 UpgradeRequired, and an x-opencode-session that is missing or
18
+ * not `ses_` + 12 lowercase-hex + 14 base62 draws HTTP 403 FreeTierError
19
+ * ("can only be used from within OpenCode"). x-opencode-request is not validated.
20
+ *
14
21
  * prompt.ts resolves `lastUser` once per turn and passes that same message into
15
22
  * every step of the agentic loop, so one user turn — including retries — reuses
16
23
  * one request id. pi exposes neither a session id nor message ids to a custom
@@ -46,7 +53,7 @@ export function createIdentifier(descending: boolean, ts: number = Date.now()):
46
53
  return id;
47
54
  }
48
55
 
49
- /** New session identifier, matching opencode's `SessionID.ascending()` ("ses_" + 26). */
56
+ /** New session identifier, matching opencode's `SessionID.descending()` ("ses_" + 26). */
50
57
  export function createSessionId(): string {
51
58
  return `ses_${createIdentifier(true)}`;
52
59
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-multikey",
3
- "version": "1.11.0",
3
+ "version": "1.11.1",
4
4
  "description": "One pi provider backed by many API keys: automatic 429 rotation, per-request key leases for concurrent subagents, and a /multikey management TUI",
5
5
  "keywords": [
6
6
  "pi-package",