@mupt-ai/dari-gateway 1.0.354 → 1.0.355

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 (75) hide show
  1. package/README.md +5 -5
  2. package/dist/link/assets.js +0 -3
  3. package/dist/link/client.d.ts +2 -2
  4. package/dist/link/client.js +2 -2
  5. package/dist/link/endpoints.js +31 -8
  6. package/dist/link/errors.js +0 -1
  7. package/dist/link/self_hosted.js +11 -3
  8. package/dist/link/service.d.ts +3 -1
  9. package/dist/link/service.js +1 -0
  10. package/dist/models/catalog.js +0 -1
  11. package/dist/models/provider_defaults.js +0 -5
  12. package/dist/models/provider_models.json +0 -182
  13. package/dist/models/subscriptions.js +0 -1
  14. package/dist/platform/platform.d.ts +11 -0
  15. package/dist/providers/codex_usage.d.ts +6 -0
  16. package/dist/providers/codex_usage.js +2 -1
  17. package/dist/providers/execution.js +0 -3
  18. package/dist/providers/provider_call.js +1 -5
  19. package/dist/providers/subscription_limits.d.ts +1 -1
  20. package/dist/providers/subscription_limits.js +1 -4
  21. package/dist/providers/subscription_resets.d.ts +53 -0
  22. package/dist/providers/subscription_resets.js +184 -0
  23. package/dist/self_host/connected.d.ts +51 -0
  24. package/dist/self_host/connected.js +197 -0
  25. package/dist/self_host/hosted_sync.d.ts +53 -0
  26. package/dist/self_host/hosted_sync.js +261 -0
  27. package/dist/self_host/main.d.ts +5 -0
  28. package/dist/self_host/main.js +58 -10
  29. package/dist/self_host/platform.js +15 -2
  30. package/dist/self_host/resolve.js +0 -1
  31. package/dist/self_host/subscriptions/http.d.ts +4 -1
  32. package/dist/self_host/subscriptions/http.js +83 -11
  33. package/dist/self_host/subscriptions/index.d.ts +3 -3
  34. package/dist/self_host/subscriptions/index.js +3 -3
  35. package/dist/self_host/subscriptions/oauth.d.ts +3 -4
  36. package/dist/self_host/subscriptions/oauth.js +9 -76
  37. package/dist/self_host/subscriptions/resets.d.ts +41 -0
  38. package/dist/self_host/subscriptions/resets.js +235 -0
  39. package/dist/self_host/subscriptions/store.d.ts +61 -8
  40. package/dist/self_host/subscriptions/store.js +151 -26
  41. package/dist/self_host/subscriptions/usage.d.ts +3 -1
  42. package/dist/self_host/subscriptions/usage.js +12 -7
  43. package/dist/types.d.ts +1 -1
  44. package/package.json +2 -2
  45. package/src/link/assets.ts +0 -3
  46. package/src/link/client.ts +5 -3
  47. package/src/link/endpoints.ts +35 -7
  48. package/src/link/errors.ts +0 -1
  49. package/src/link/self_hosted.ts +9 -3
  50. package/src/link/service.ts +4 -0
  51. package/src/models/catalog.ts +0 -1
  52. package/src/models/provider_defaults.ts +0 -5
  53. package/src/models/provider_models.json +0 -182
  54. package/src/models/subscriptions.ts +0 -1
  55. package/src/platform/platform.ts +9 -0
  56. package/src/providers/codex_usage.ts +2 -1
  57. package/src/providers/execution.ts +0 -3
  58. package/src/providers/provider_call.ts +1 -5
  59. package/src/providers/subscription_limits.ts +1 -3
  60. package/src/providers/subscription_resets.ts +256 -0
  61. package/src/self_host/connected.ts +239 -0
  62. package/src/self_host/hosted_sync.ts +285 -0
  63. package/src/self_host/main.ts +55 -9
  64. package/src/self_host/platform.ts +13 -1
  65. package/src/self_host/resolve.ts +0 -1
  66. package/src/self_host/subscriptions/http.ts +85 -10
  67. package/src/self_host/subscriptions/index.ts +5 -2
  68. package/src/self_host/subscriptions/oauth.ts +8 -91
  69. package/src/self_host/subscriptions/resets.ts +254 -0
  70. package/src/self_host/subscriptions/store.ts +185 -27
  71. package/src/self_host/subscriptions/usage.ts +13 -7
  72. package/src/types.ts +0 -3
  73. package/dist/providers/github_copilot.d.ts +0 -8
  74. package/dist/providers/github_copilot.js +0 -21
  75. package/src/providers/github_copilot.ts +0 -24
package/README.md CHANGED
@@ -28,7 +28,7 @@ The gateway is the runtime behind Dari's hosted routing service, packaged to run
28
28
 
29
29
  - **One endpoint, three protocols.** `/v1/messages`, `/v1/chat/completions`, and `/v1/responses` (plus `/v1/models`) reach API-key providers in the [Pi AI](https://www.npmjs.com/package/@mupt-ai/pi-ai) catalog, such as Anthropic, OpenAI, and OpenRouter, or any OpenAI-compatible server.
30
30
  - **Subscription pooling.** Connect several Claude Code (Max/Pro) or ChatGPT plans. Each conversation stays on one plan so its prompt cache stays warm. Claude Code plans report their usage on every response: once a plan has used 95% of a window, its conversations move to another plan at their next turn, and new conversations start on the plan whose quota resets soonest. A plan that reports a usage limit is held until its reset, and the request it refused is served by the next plan at once.
31
- - **Cross-plan failover.** One model can be served by several kinds of plan: GitHub Copilot serves Claude and GPT models, and OpenCode Go and Vercel Token Pass serve the Kimi and GLM models. Each model tries the plans that serve it in a fixed order, the maker's plan first: Claude Code, ChatGPT, Grok, Muse Code, OpenCode Go, GitHub Copilot, Vercel Token Pass, then its provider's API key if you set one. When a plan reaches its usage limit with no other plan of its kind left, or refuses its token, the same request moves to the model's next plan, then to the key, before anything reaches the client.
31
+ - **Cross-plan failover.** One model can be served by several kinds of plan: OpenCode Go and Vercel Token Pass both serve the Kimi and GLM models. Each model tries the plans that serve it in a fixed order, the maker's plan first: Claude Code, ChatGPT, Grok, Muse Code, OpenCode Go, Vercel Token Pass, then its provider's API key if you set one. When a plan reaches its usage limit with no other plan of its kind left, or refuses its token, the same request moves to the model's next plan, then to the key, before anything reaches the client.
32
32
  - **Failover.** A provider failure retries the router's next model.
33
33
  - **Prompt-cache aware.** Conversations keep their identity and serving model across turns, so provider caches stay warm. Responses carry `X-Dari-Selected-Model`, `X-Dari-Thinking-Level`, and `X-Dari-Conversation-Id` headers for status lines.
34
34
  - **Coding agents.** `dari claude`, `dari codex`, `dari opencode`, and `dari pi` from the [Dari CLI](https://github.com/mupt-ai/dari) launch straight against your gateway.
@@ -125,7 +125,7 @@ native_compaction: false
125
125
  agents: { codex: [openai/gpt-6.1-sol] }
126
126
  ```
127
127
 
128
- The gateway pays with connected subscriptions when `payment.allow` lists `subscription`, then with provider API keys; it has no Dari credits. On hosted Dari the same setting is the router's `subscription_providers`: it can name any provider whose models some plan serves, such as `fireworks` or `google`, and those models try the user's plans first. `hosted` settings and a model's `fast` apply only on hosted Dari and are ignored here; `routing.rules` runs only on hosted Dari and is refused. A model's `provider` must be one that serves it, such as `opencode-go` or `fireworks` for the DeepSeek, Kimi, and GLM models; the plan-only providers `github-copilot` and `vercel-token-pass` serve through a connected subscription.
128
+ The gateway pays with connected subscriptions when `payment.allow` lists `subscription`, then with provider API keys; it has no Dari credits. On hosted Dari the same setting is the router's `subscription_providers`: it can name any provider whose models some plan serves, such as `fireworks` or `google`, and those models try the user's plans first. `hosted` settings and a model's `fast` apply only on hosted Dari and are ignored here; `routing.rules` runs only on hosted Dari and is refused. A model's `provider` must be one that serves it, such as `opencode-go` or `fireworks` for the DeepSeek, Kimi, and GLM models; the plan-only provider `vercel-token-pass` serves through a connected subscription.
129
129
 
130
130
  With any gateway key:
131
131
 
@@ -144,7 +144,7 @@ With any gateway key:
144
144
  export DARI_GATEWAY_URL=http://localhost:8080
145
145
  export DARI_GATEWAY_KEY=<one of DARI_GATEWAY_KEYS>
146
146
 
147
- dari accounts subscription connect claude-code # or codex, muse-code, opencode-go, github-copilot, grok, vercel-token-pass; repeat to pool plans
147
+ dari accounts subscription connect claude-code # or codex, muse-code, opencode-go, grok, vercel-token-pass; repeat to pool plans
148
148
  dari claude
149
149
  ```
150
150
 
@@ -154,7 +154,7 @@ In gateway mode the CLI makes no calls to Dari's hosted API; `dari activity` rea
154
154
 
155
155
  Dari Link lets another app send one user's model requests through the gateway on only the subscriptions that user grants it: never an API key, credits, or any other plan.
156
156
 
157
- **Which plans serve which apps.** A ChatGPT plan (`openai_codex`) serves any app, including a plain OpenAI `chat/completions` or Responses client, through the Codex backend. A Claude Pro/Max/Ultra plan (`anthropic_claude_code`) serves only Claude Code itself, and a Muse Code plan only Muse Code; the gateway never presents another app as those clients. An OpenCode Go plan (`opencode_go`) serves any app its `opencode-go` models, and GitHub Copilot (`github_copilot`), Grok (`xai_grok`), and Vercel Token Pass (`vercel_token_pass`, a pasted Token Pass key that serves Vercel AI Gateway's featured models) plans serve any app theirs. So an app that calls the API itself needs the user to grant one of those plans, or an API key. The approval page offers only what the app can use: a Claude or Muse plan appears when the app runs Claude Code or Muse Code itself and says so with `client` on the authorize request.
157
+ **Which plans serve which apps.** A ChatGPT plan (`openai_codex`) serves any app, including a plain OpenAI `chat/completions` or Responses client, through the Codex backend. A Claude Pro/Max/Ultra plan (`anthropic_claude_code`) serves only Claude Code itself, and a Muse Code plan only Muse Code; the gateway never presents another app as those clients. An OpenCode Go plan (`opencode_go`) serves any app its `opencode-go` models, and Grok (`xai_grok`) and Vercel Token Pass (`vercel_token_pass`, a pasted Token Pass key that serves Vercel AI Gateway's featured models) plans serve any app theirs. So an app that calls the API itself needs the user to grant one of those plans, or an API key. The approval page offers only what the app can use: a Claude or Muse plan appears when the app runs Claude Code or Muse Code itself and says so with `client` on the authorize request.
158
158
 
159
159
  **API keys.** A user without a plan can add an API key on the same page instead: one per model provider (Anthropic, OpenAI, Meta, Moonshot AI, xAI) or gateway (OpenRouter, Vercel AI Gateway). A key is shared like a plan, shows on the grant as `kind: "api_key"` with `provider` (never the key itself), and serves that provider's catalog models to any app, so an Anthropic key serves a plain client where a Claude plan would not. A gateway key serves any model of its gateway named by its full id, such as `openrouter/anthropic/claude-sonnet-4.5`; the grant's `models` lists none of them. A child token can be pinned to such a model the same way (`model=openrouter/anthropic/claude-sonnet-4.5`). Such a plan entry carries `model_prefix` (`"openrouter/"`): any id the gateway lists, with that prefix, is a model name here, sent as `dari/model/openrouter/<id>` or just `openrouter/<id>`. Every plan entry has a `title` to show ("Claude", "ChatGPT", "OpenRouter"). Where a grant holds both a plan and a key for a provider, the plan serves first. The usage a provider bills on the user's key is the user's cost. `plans` on the authorize request lists what the app wants offered, plan kinds and `api_key`; omit it to offer everything the app can use. `key_providers` (`keyProviders` in the client) narrows the API keys to the providers the app can run, such as `anthropic openrouter`, so a user is never offered, or shown ticked, a key the app cannot use. A user can connect as many plans and keys as they like, several accounts of one kind included, and share any of them.
160
160
 
@@ -224,7 +224,7 @@ The gateway refuses a model the grant cannot serve, a plan at its limit, a spent
224
224
  - `response_mode=web_message`: for a page opened as a popup. The result is posted to the window that opened it (`{"type": "dari-link", "code" | "error", "state"}`, addressed to the redirect URI's origin) instead of sent on a redirect; a page with no opener left redirects to `redirect_uri` instead. `DariLink.open` does this for you.
225
225
  - `grant_id`: update mode (above).
226
226
 
227
- The gateway serves the page itself, hosted and self-hosted alike. A new user sees what connecting means, picks a subscription (Claude, ChatGPT, Meta Muse, OpenCode Go, GitHub Copilot, Grok, Vercel Token Pass) or a provider to add an API key for, signs in to that provider (Claude shows a code to paste back, and Vercel Token Pass takes a key the user creates at Vercel; the others take a code the page shows and continue on their own), and allows the app with what they connected ticked. A self-hosted gateway needs no sign-in: their first plan or key makes them a user. A platform with accounts (`LinkApprovalPage.signIn`; on hosted Dari, the user's Dari account) has them sign in first, and they are that account, with the plans it already has. Either way the gateway remembers them in a signed HttpOnly cookie, so the next app that asks finds their plans connected and takes one click: for a year without accounts, since the cookie is who they are; for 30 days with them, and they can sign out from the approval and connections pages. A self-hosted gateway takes their subscriptions and keys only when it encrypts what it stores (`DARI_GATEWAY_ENCRYPTION_KEY`). A plan a user connects this way is theirs alone: it serves only the grants they approve, never a gateway key, and the gateway owner's own plans are never offered on the page.
227
+ The gateway serves the page itself, hosted and self-hosted alike. A new user sees what connecting means, picks a subscription (Claude, ChatGPT, Meta Muse, OpenCode Go, Grok, Vercel Token Pass) or a provider to add an API key for, signs in to that provider (Claude shows a code to paste back, and Vercel Token Pass takes a key the user creates at Vercel; the others take a code the page shows and continue on their own), and allows the app with what they connected ticked. A self-hosted gateway needs no sign-in: their first plan or key makes them a user. A platform with accounts (`LinkApprovalPage.signIn`; on hosted Dari, the user's Dari account) has them sign in first, and they are that account, with the plans it already has. Either way the gateway remembers them in a signed HttpOnly cookie, so the next app that asks finds their plans connected and takes one click: for a year without accounts, since the cookie is who they are; for 30 days with them, and they can sign out from the approval and connections pages. A self-hosted gateway takes their subscriptions and keys only when it encrypts what it stores (`DARI_GATEWAY_ENCRYPTION_KEY`). A plan a user connects this way is theirs alone: it serves only the grants they approve, never a gateway key, and the gateway owner's own plans are never offered on the page.
228
228
 
229
229
  The user approves; they can later cap the tokens the app may use per 5 hours and per week (see **Budgets**). The app gets `code` and `state`, or `error=access_denied`, on `redirect_uri` or as the popup's message.
230
230
  3. `POST /v1/link/token` (form or JSON; CORS open) with `grant_type=authorization_code`, `code`, `redirect_uri`, `client_id`, `code_verifier` returns an access token (`dlk_at_…`, one hour) and a refresh token (`dlk_rt_…`), with the grant's fields below. `grant_type=refresh_token` with `refresh_token` returns a new access token:
@@ -9,7 +9,6 @@ const MARKS = {
9
9
  anthropic: `<svg class="logo" viewBox="0 0 24 24" fill="currentColor" fill-rule="evenodd" aria-hidden="true"><path d="M13.827 3.52h3.603L24 20h-3.603l-6.57-16.48zm-7.258 0h3.767L16.906 20h-3.674l-1.343-3.461H5.017l-1.344 3.46H0L6.57 3.522zm4.132 9.959L8.453 7.687 6.205 13.48H10.7z"></path></svg>`,
10
10
  claude: `<svg class="logo" viewBox="0 0 24 24" fill="currentColor" fill-rule="evenodd" aria-hidden="true"><path d="M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z"></path></svg>`,
11
11
  gemini: `<svg class="logo" viewBox="0 0 24 24" fill="currentColor" fill-rule="evenodd" aria-hidden="true"><path d="M12 24A14.304 14.304 0 000 12 14.304 14.304 0 0012 0a14.305 14.305 0 0012 12 14.305 14.305 0 00-12 12"></path></svg>`,
12
- githubcopilot: `<svg class="logo" viewBox="0 0 24 24" fill="currentColor" fill-rule="evenodd" aria-hidden="true"><path d="M19.245 5.364c1.322 1.36 1.877 3.216 2.11 5.817.622 0 1.2.135 1.592.654l.73.964c.21.278.323.61.323.955v2.62c0 .339-.173.669-.453.868C20.239 19.602 16.157 21.5 12 21.5c-4.6 0-9.205-2.583-11.547-4.258-.28-.2-.452-.53-.453-.868v-2.62c0-.345.113-.679.321-.956l.73-.963c.392-.517.974-.654 1.593-.654l.029-.297c.25-2.446.81-4.213 2.082-5.52 2.461-2.54 5.71-2.851 7.146-2.864h.198c1.436.013 4.685.323 7.146 2.864zm-7.244 4.328c-.284 0-.613.016-.962.05-.123.447-.305.85-.57 1.108-1.05 1.023-2.316 1.18-2.994 1.18-.638 0-1.306-.13-1.851-.464-.516.165-1.012.403-1.044.996a65.882 65.882 0 00-.063 2.884l-.002.48c-.002.563-.005 1.126-.013 1.69.002.326.204.63.51.765 2.482 1.102 4.83 1.657 6.99 1.657 2.156 0 4.504-.555 6.985-1.657a.854.854 0 00.51-.766c.03-1.682.006-3.372-.076-5.053-.031-.596-.528-.83-1.046-.996-.546.333-1.212.464-1.85.464-.677 0-1.942-.157-2.993-1.18-.266-.258-.447-.661-.57-1.108-.32-.032-.64-.049-.96-.05zm-2.525 4.013c.539 0 .976.426.976.95v1.753c0 .525-.437.95-.976.95a.964.964 0 01-.976-.95v-1.752c0-.525.437-.951.976-.951zm5 0c.539 0 .976.426.976.95v1.753c0 .525-.437.95-.976.95a.964.964 0 01-.976-.95v-1.752c0-.525.437-.951.976-.951zM7.635 5.087c-1.05.102-1.935.438-2.385.906-.975 1.037-.765 3.668-.21 4.224.405.394 1.17.657 1.995.657h.09c.649-.013 1.785-.176 2.73-1.11.435-.41.705-1.433.675-2.47-.03-.834-.27-1.52-.63-1.813-.39-.336-1.275-.482-2.265-.394zm6.465.394c-.36.292-.6.98-.63 1.813-.03 1.037.24 2.06.675 2.47.968.957 2.136 1.104 2.776 1.11h.044c.825 0 1.59-.263 1.995-.657.555-.556.765-3.187-.21-4.224-.45-.468-1.335-.804-2.385-.906-.99-.088-1.875.058-2.265.394zM12 7.615c-.24 0-.525.015-.84.044.03.16.045.336.06.526l-.001.159a2.94 2.94 0 01-.014.25c.225-.022.425-.027.612-.028h.366c.187 0 .387.006.612.028-.015-.146-.015-.277-.015-.409.015-.19.03-.365.06-.526a9.29 9.29 0 00-.84-.044z"></path></svg>`,
13
12
  grok: `<svg class="logo" viewBox="0 0 24 24" fill="currentColor" fill-rule="evenodd" aria-hidden="true"><path d="M9.27 15.29l7.978-5.897c.391-.29.95-.177 1.137.272.98 2.369.542 5.215-1.41 7.169-1.951 1.954-4.667 2.382-7.149 1.406l-2.711 1.257c3.889 2.661 8.611 2.003 11.562-.953 2.341-2.344 3.066-5.539 2.388-8.42l.006.007c-.983-4.232.242-5.924 2.75-9.383.06-.082.12-.164.179-.248l-3.301 3.305v-.01L9.267 15.292M7.623 16.723c-2.792-2.67-2.31-6.801.071-9.184 1.761-1.763 4.647-2.483 7.166-1.425l2.705-1.25a7.808 7.808 0 00-1.829-1A8.975 8.975 0 005.984 5.83c-2.533 2.536-3.33 6.436-1.962 9.764 1.022 2.487-.653 4.246-2.34 6.022-.599.63-1.199 1.259-1.682 1.925l7.62-6.815"></path></svg>`,
14
13
  meta: `<svg class="logo" viewBox="0 0 24 24" fill="currentColor" fill-rule="evenodd" aria-hidden="true"><path d="M6.897 4c1.915 0 3.516.932 5.43 3.376l.282-.373c.19-.246.383-.484.58-.71l.313-.35C14.588 4.788 15.792 4 17.225 4c1.273 0 2.469.557 3.491 1.516l.218.213c1.73 1.765 2.917 4.71 3.053 8.026l.011.392.002.25c0 1.501-.28 2.759-.818 3.7l-.14.23-.108.153c-.301.42-.664.758-1.086 1.009l-.265.142-.087.04a3.493 3.493 0 01-.302.118 4.117 4.117 0 01-1.33.208c-.524 0-.996-.067-1.438-.215-.614-.204-1.163-.56-1.726-1.116l-.227-.235c-.753-.812-1.534-1.976-2.493-3.586l-1.43-2.41-.544-.895-1.766 3.13-.343.592C7.597 19.156 6.227 20 4.356 20c-1.21 0-2.205-.42-2.936-1.182l-.168-.184c-.484-.573-.837-1.311-1.043-2.189l-.067-.32a8.69 8.69 0 01-.136-1.288L0 14.468c.002-.745.06-1.49.174-2.23l.1-.573c.298-1.53.828-2.958 1.536-4.157l.209-.34c1.177-1.83 2.789-3.053 4.615-3.16L6.897 4zm-.033 2.615l-.201.01c-.83.083-1.606.673-2.252 1.577l-.138.199-.01.018c-.67 1.017-1.185 2.378-1.456 3.845l-.004.022a12.591 12.591 0 00-.207 2.254l.002.188c.004.18.017.36.04.54l.043.291c.092.503.257.908.486 1.208l.117.137c.303.323.698.492 1.17.492 1.1 0 1.796-.676 3.696-3.641l2.175-3.4.454-.701-.139-.198C9.11 7.3 8.084 6.616 6.864 6.616zm10.196-.552l-.176.007c-.635.048-1.223.359-1.82.933l-.196.198c-.439.462-.887 1.064-1.367 1.807l.266.398c.18.274.362.56.55.858l.293.475 1.396 2.335.695 1.114c.583.926 1.03 1.6 1.408 2.082l.213.262c.282.326.529.54.777.673l.102.05c.227.1.457.138.718.138.176.002.35-.023.518-.073.338-.104.61-.32.813-.637l.095-.163.077-.162c.194-.459.29-1.06.29-1.785l-.006-.449c-.08-2.871-.938-5.372-2.2-6.798l-.176-.189c-.67-.683-1.444-1.074-2.27-1.074z"></path></svg>`,
15
14
  moonshot: `<svg class="logo" viewBox="0 0 24 24" fill="currentColor" fill-rule="evenodd" aria-hidden="true"><path d="M1.052 16.916l9.539 2.552a21.007 21.007 0 00.06 2.033l5.956 1.593a11.997 11.997 0 01-5.586.865l-.18-.016-.044-.004-.084-.009-.094-.01a11.605 11.605 0 01-.157-.02l-.107-.014-.11-.016a11.962 11.962 0 01-.32-.051l-.042-.008-.075-.013-.107-.02-.07-.015-.093-.019-.075-.016-.095-.02-.097-.023-.094-.022-.068-.017-.088-.022-.09-.024-.095-.025-.082-.023-.109-.03-.062-.02-.084-.025-.093-.028-.105-.034-.058-.019-.08-.026-.09-.031-.066-.024a6.293 6.293 0 01-.044-.015l-.068-.025-.101-.037-.057-.022-.08-.03-.087-.035-.088-.035-.079-.032-.095-.04-.063-.028-.063-.027a5.655 5.655 0 01-.041-.018l-.066-.03-.103-.047-.052-.024-.096-.046-.062-.03-.084-.04-.086-.044-.093-.047-.052-.027-.103-.055-.057-.03-.058-.032a6.49 6.49 0 01-.046-.026l-.094-.053-.06-.034-.051-.03-.072-.041-.082-.05-.093-.056-.052-.032-.084-.053-.061-.039-.079-.05-.07-.047-.053-.035a7.785 7.785 0 01-.054-.036l-.044-.03-.044-.03a6.066 6.066 0 01-.04-.028l-.057-.04-.076-.054-.069-.05-.074-.054-.056-.042-.076-.057-.076-.059-.086-.067-.045-.035-.064-.052-.074-.06-.089-.073-.046-.039-.046-.039a7.516 7.516 0 01-.043-.037l-.045-.04-.061-.053-.07-.062-.068-.06-.062-.058-.067-.062-.053-.05-.088-.084a13.28 13.28 0 01-.099-.097l-.029-.028-.041-.042-.069-.07-.05-.051-.05-.053a6.457 6.457 0 01-.168-.179l-.08-.088-.062-.07-.071-.08-.042-.049-.053-.062-.058-.068-.046-.056a7.175 7.175 0 01-.027-.033l-.045-.055-.066-.082-.041-.052-.05-.064-.02-.025a11.99 11.99 0 01-1.44-2.402zm-1.02-5.794l11.353 3.037a20.468 20.468 0 00-.469 2.011l10.817 2.894a12.076 12.076 0 01-1.845 2.005L.657 15.923l-.016-.046-.035-.104a11.965 11.965 0 01-.05-.153l-.007-.023a11.896 11.896 0 01-.207-.741l-.03-.126-.018-.08-.021-.097-.018-.081-.018-.09-.017-.084-.018-.094c-.026-.141-.05-.283-.071-.426l-.017-.118-.011-.083-.013-.102a12.01 12.01 0 01-.019-.161l-.005-.047a12.12 12.12 0 01-.034-2.145zm1.593-5.15l11.948 3.196c-.368.605-.705 1.231-1.01 1.875l11.295 3.022c-.142.82-.368 1.612-.668 2.365l-11.55-3.09L.124 10.26l.015-.1.008-.049.01-.067.015-.087.018-.098c.026-.148.056-.295.088-.442l.028-.124.02-.085.024-.097c.022-.09.045-.18.07-.268l.028-.102.023-.083.03-.1.025-.082.03-.096.026-.082.031-.095a11.896 11.896 0 011.01-2.232zm4.442-4.4L17.352 4.59a20.77 20.77 0 00-1.688 1.721l7.823 2.093c.267.852.442 1.744.513 2.665L2.106 5.213l.045-.065.027-.04.04-.055.046-.065.055-.076.054-.072.064-.086.05-.065.057-.073.055-.07.06-.074.055-.069.065-.077.054-.066.066-.077.053-.06.072-.082.053-.06.067-.074.054-.058.073-.078.058-.06.063-.067.168-.17.1-.098.059-.056.076-.071a12.084 12.084 0 012.272-1.677zM12.017 0h.097l.082.001.069.001.054.002.068.002.046.001.076.003.047.002.06.003.054.002.087.005.105.007.144.011.088.007.044.004.077.008.082.008.047.005.102.012.05.006.108.014.081.01.042.006.065.01.207.032.07.012.065.011.14.026.092.018.11.022.046.01.075.016.041.01L14.7.3l.042.01.065.015.049.012.071.017.096.024.112.03.113.03.113.032.05.015.07.02.078.024.073.023.05.016.05.016.076.025.099.033.102.036.048.017.064.023.093.034.11.041.116.045.1.04.047.02.06.024.041.018.063.026.04.018.057.025.11.048.1.046.074.035.075.036.06.028.092.046.091.045.102.052.053.028.049.026.046.024.06.033.041.022.052.029.088.05.106.06.087.051.057.034.053.032.096.059.088.055.098.062.036.024.064.041.084.056.04.027.062.042.062.043.023.017c.054.037.108.075.161.114l.083.06.065.048.056.043.086.065.082.064.04.03.05.041.086.069.079.065.085.071c.712.6 1.353 1.283 1.909 2.031L7.222.994l.062-.027.065-.028.081-.034.086-.035c.113-.045.227-.09.341-.131l.096-.035.093-.033.084-.03.096-.031c.087-.03.176-.058.264-.085l.091-.027.086-.025.102-.03.085-.023.1-.026L9.04.37l.09-.023.091-.022.095-.022.09-.02.098-.021.091-.02.095-.018.092-.018.1-.018.091-.016.098-.017.092-.014.097-.015.092-.013.102-.013.091-.012.105-.012.09-.01.105-.01c.093-.01.186-.018.28-.024l.106-.008.09-.005.11-.006.093-.004.1-.004.097-.002.099-.002.197-.002z"></path></svg>`,
@@ -25,7 +24,6 @@ const MARK_FOR = {
25
24
  openai_codex: "openai",
26
25
  meta_muse: "meta",
27
26
  opencode_go: "opencode",
28
- github_copilot: "githubcopilot",
29
27
  xai_grok: "grok",
30
28
  vercel_token_pass: "vercel",
31
29
  anthropic: "anthropic",
@@ -36,7 +34,6 @@ const MARK_FOR = {
36
34
  google: "gemini",
37
35
  openrouter: "openrouter",
38
36
  "vercel-ai-gateway": "vercel",
39
- "github-copilot": "githubcopilot",
40
37
  "vercel-token-pass": "vercel",
41
38
  };
42
39
  /** The mark of a plan kind (`openai_codex`), key provider (`anthropic`), or gateway (`openrouter`); undefined when it has none. */
@@ -146,7 +146,7 @@ export declare function registerClient(args: Gateway & {
146
146
  * The approval URL to send the user to, with a fresh PKCE verifier and state.
147
147
  * `clients` names the clients the app runs, such as `claude_code`, so the
148
148
  * user can grant plans that serve only those. `plans` limits the page to
149
- * those plan kinds, such as `openai_codex`. `purposes` says what the app does
149
+ * those plan kinds, such as `openai_codex`, or `"supported"`. `purposes` says what the app does
150
150
  * with each audience's plans, shown beside them. `grantId` (update mode)
151
151
  * opens the page on that existing grant: the user changes its plans in place,
152
152
  * its id and tokens stay, and the new code redeems for more tokens of it.
@@ -176,7 +176,7 @@ export type AuthorizeOptions = {
176
176
  redirectUri: string;
177
177
  state?: string;
178
178
  clients?: string[];
179
- plans?: string[];
179
+ plans?: string[] | "supported";
180
180
  keyProviders?: string[];
181
181
  purposes?: {
182
182
  any_app?: string;
@@ -101,7 +101,7 @@ export async function registerClient(args) {
101
101
  * The approval URL to send the user to, with a fresh PKCE verifier and state.
102
102
  * `clients` names the clients the app runs, such as `claude_code`, so the
103
103
  * user can grant plans that serve only those. `plans` limits the page to
104
- * those plan kinds, such as `openai_codex`. `purposes` says what the app does
104
+ * those plan kinds, such as `openai_codex`, or `"supported"`. `purposes` says what the app does
105
105
  * with each audience's plans, shown beside them. `grantId` (update mode)
106
106
  * opens the page on that existing grant: the user changes its plans in place,
107
107
  * its id and tokens stay, and the new code redeems for more tokens of it.
@@ -157,7 +157,7 @@ function authorizationUrl(args) {
157
157
  scope: "route",
158
158
  ...(args.responseMode === "web_message" ? { response_mode: "web_message" } : {}),
159
159
  ...(args.clients?.length ? { client: args.clients.join(" ") } : {}),
160
- ...(args.plans?.length ? { plans: args.plans.join(" ") } : {}),
160
+ ...(args.plans?.length ? { plans: [args.plans].flat().join(" ") } : {}),
161
161
  ...(args.keyProviders?.length ? { key_providers: args.keyProviders.join(" ") } : {}),
162
162
  ...(args.grantId ? { grant_id: args.grantId } : {}),
163
163
  ...Object.fromEntries(Object.entries(args.purposes ?? {}).flatMap(([audience, purpose]) => purpose ? [[`purpose_${audience}`, purpose]] : [])),
@@ -135,6 +135,10 @@ const PLAN_KINDS = Object.keys(SUBSCRIPTION_PLAN_LABELS);
135
135
  // An API key, as a kind an app asks for in `plans` and reads on a grant.
136
136
  const API_KEY = "api_key";
137
137
  const OFFER_KINDS = [...PLAN_KINDS, API_KEY];
138
+ // `plans=supported` offers the plans whose providers clearly allow use in
139
+ // other apps, and every API key.
140
+ const SUPPORTED = "supported";
141
+ const SUPPORTED_KINDS = ["openai_codex", "xai_grok", "opencode_go", "vercel_token_pass", API_KEY];
138
142
  const PLAN_AUDIENCES = ["any_app", "claude_code", "muse_code"];
139
143
  export const LINK_ROUTE_PREFIX = "/v1/link/";
140
144
  const LINK_TOKEN_CREATE_PATH = "/v1/link/link_token/create";
@@ -1122,9 +1126,9 @@ async function authorizeRequest(link, params) {
1122
1126
  if (!clients.every((client) => CLIENTS.includes(client))) {
1123
1127
  return badRequest(`client lists the clients the app runs: ${CLIENTS.join(", ")}.`);
1124
1128
  }
1125
- const plans = listParam(params.get("plans"));
1129
+ const plans = [...new Set(listParam(params.get("plans")).flatMap((plan) => plan === SUPPORTED ? [...SUPPORTED_KINDS] : [plan]))];
1126
1130
  if (!plans.every((plan) => OFFER_KINDS.includes(plan))) {
1127
- return badRequest(`plans lists the kinds to offer: ${OFFER_KINDS.join(", ")}.`);
1131
+ return badRequest(`plans lists the kinds to offer: ${SUPPORTED}, or any of ${OFFER_KINDS.join(", ")}.`);
1128
1132
  }
1129
1133
  const keyProviders = listParam(params.get("key_providers"));
1130
1134
  if (!keyProviders.every((provider) => /^[a-z0-9-]{1,64}$/.test(provider))) {
@@ -1179,9 +1183,28 @@ async function homePage(approval, authorize, session) {
1179
1183
  if (session === null)
1180
1184
  return introPage(approval, authorize);
1181
1185
  const subscriptions = await approval.subscriptions(session.subject);
1186
+ const onComputers = await plansOnComputersNote(approval, authorize, session.subject, subscriptions);
1182
1187
  return shareable(authorize, subscriptions).length > 0
1183
- ? choosePage(authorize, session, subscriptions, current)
1184
- : introPage(approval, authorize);
1188
+ ? choosePage(authorize, session, subscriptions, current, undefined, onComputers)
1189
+ : introPage(approval, authorize, onComputers);
1190
+ }
1191
+ // Where the user keeps a plan the app could use on one of their computers,
1192
+ // for each kind they have no plan of here: apps reach only the platform's.
1193
+ async function plansOnComputersNote(approval, authorize, subject, subscriptions) {
1194
+ if (approval.plansOnComputers === undefined)
1195
+ return "";
1196
+ const here = new Set(subscriptions.map((subscription) => subscription.provider));
1197
+ const usable = new Set(connectKinds(approval, authorize));
1198
+ const computers = new Map();
1199
+ for (const plan of await approval.plansOnComputers(subject)) {
1200
+ if (here.has(plan.provider) || !usable.has(plan.provider))
1201
+ continue;
1202
+ const names = computers.get(plan.provider) ?? [];
1203
+ if (!names.includes(plan.computer))
1204
+ names.push(plan.computer);
1205
+ computers.set(plan.provider, names);
1206
+ }
1207
+ return [...computers].map(([kind, names]) => `<p class="hint">Your ${KINDS[kind].name} plan is on ${escapeHtml(names.join(" and "))}. Apps can only use plans on Dari.</p>`).join("\n");
1185
1208
  }
1186
1209
  // In update mode, the grant being changed. A grant this browser's user does
1187
1210
  // not hold (another browser, cleared cookies) starts a new connection instead,
@@ -1662,12 +1685,11 @@ const KINDS = {
1662
1685
  openai_codex: { name: "ChatGPT", plan: "Plus or Pro plan", at: "OpenAI" },
1663
1686
  meta_muse: { name: "Meta Muse", plan: "Muse Code plan", at: "Meta" },
1664
1687
  opencode_go: { name: "OpenCode Go", plan: "Go plan", at: "OpenCode" },
1665
- github_copilot: { name: "GitHub Copilot", plan: "Copilot plan", at: "GitHub" },
1666
1688
  xai_grok: { name: "Grok", plan: "SuperGrok plan", at: "xAI" },
1667
1689
  vercel_token_pass: { name: "Vercel Token Pass", plan: "Token Pass", at: "Vercel", pastedKey: true },
1668
1690
  };
1669
1691
  // The first page a new user sees: what connecting means, and one button.
1670
- function introPage(approval, authorize) {
1692
+ function introPage(approval, authorize, onComputers = "") {
1671
1693
  const app = escapeHtml(authorize.app.name);
1672
1694
  const kinds = connectKinds(approval, authorize);
1673
1695
  const keys = keyProviders(approval, authorize);
@@ -1685,7 +1707,7 @@ function introPage(approval, authorize) {
1685
1707
  <ul class="points">
1686
1708
  <li>${ICONS.zap}<div><strong>Connect In Seconds</strong><p>${kinds.length > 0 ? `Use what you already pay for: ${escapeHtml(ways)}.` : "Add the API key you already have."}</p></div></li>
1687
1709
  <li>${ICONS.shield}<div><strong>You Stay In Control</strong><p>${app} can only send model requests on what you share. It sees each shared plan's account email, never a key or your other plans, and you can disconnect it any time.</p></div></li>
1688
- </ul>`,
1710
+ </ul>${onComputers}`,
1689
1711
  footer: `<button class="btn primary" type="submit" name="decision" value="select">Continue</button>`,
1690
1712
  });
1691
1713
  }
@@ -1769,7 +1791,7 @@ function providerPage(authorize, connect, error) {
1769
1791
  });
1770
1792
  }
1771
1793
  // The user's plans and keys, ticked: one button shares them with the app.
1772
- function choosePage(authorize, session, subscriptions, current, error) {
1794
+ function choosePage(authorize, session, subscriptions, current, error, onComputers = "") {
1773
1795
  const app = escapeHtml(authorize.app.name);
1774
1796
  const plans = shareable(authorize, subscriptions);
1775
1797
  // A new connection starts with every plan ticked; an update, with the plans it shares now.
@@ -1783,6 +1805,7 @@ function choosePage(authorize, session, subscriptions, current, error) {
1783
1805
  <!-- First in the form, so Enter in a limit field allows rather than pressing Connect Another. -->
1784
1806
  <button type="submit" name="decision" value="approve" tabindex="-1" aria-hidden="true" style="position:absolute;left:-9999px"></button>
1785
1807
  ${plans.map((plan) => planOption(authorize, plan, ticked.has(plan.id))).join("\n")}
1808
+ ${onComputers}
1786
1809
  <details${current?.limits.length ? " open" : ""}><summary>Set Limits</summary>
1787
1810
  ${plans.map((plan) => {
1788
1811
  const set = current?.limits.find((limit) => limit.credentialId === plan.id);
@@ -41,7 +41,6 @@ export const SUBSCRIPTION_PLAN_LABELS = {
41
41
  openai_codex: "ChatGPT Plus/Pro",
42
42
  meta_muse: "Meta Muse",
43
43
  opencode_go: "OpenCode Go",
44
- github_copilot: "GitHub Copilot",
45
44
  xai_grok: "Grok",
46
45
  vercel_token_pass: "Vercel Token Pass",
47
46
  };
@@ -5,7 +5,7 @@ import { randomBytes, randomUUID } from "node:crypto";
5
5
  import { HttpError } from "../http/errors.js";
6
6
  import { checkProviderKey } from "../providers/key_check.js";
7
7
  import { gatewayKeyIndex } from "../self_host/resolve.js";
8
- import { CODEX_APPROVAL_PENDING, GITHUB_APPROVAL_PENDING, META_APPROVAL_PENDING, OPENCODE_APPROVAL_PENDING, XAI_APPROVAL_PENDING, SUBSCRIPTION_PROVIDERS, SubscriptionOAuthInputError, SubscriptionOAuthProviderError, completeOAuth, currentUsage, startOAuth, } from "../self_host/subscriptions/index.js";
8
+ import { CODEX_APPROVAL_PENDING, META_APPROVAL_PENDING, OPENCODE_APPROVAL_PENDING, XAI_APPROVAL_PENDING, SUBSCRIPTION_PROVIDERS, SubscriptionAccountConnectedError, SubscriptionOAuthInputError, SubscriptionOAuthProviderError, completeOAuth, currentUsage, startOAuth, } from "../self_host/subscriptions/index.js";
9
9
  import { linkCompleteThrough } from "./in_flight.js";
10
10
  import { LINK_KEY_PROVIDERS, linkKeyProviderName } from "./key_providers.js";
11
11
  import { linkPlatform } from "./service.js";
@@ -98,6 +98,7 @@ export function selfHostedLink(deps) {
98
98
  flow: authorization.flow,
99
99
  credentialName: null,
100
100
  owner: newSubject(),
101
+ private: false,
101
102
  expiresAt: authorization.expiresAt,
102
103
  });
103
104
  return { session: session.token, authorizationUrl: authorization.authorizationUrl, userCode: authorization.userCode };
@@ -117,7 +118,6 @@ export function selfHostedLink(deps) {
117
118
  CODEX_APPROVAL_PENDING,
118
119
  META_APPROVAL_PENDING,
119
120
  OPENCODE_APPROVAL_PENDING,
120
- GITHUB_APPROVAL_PENDING,
121
121
  XAI_APPROVAL_PENDING,
122
122
  ].includes(error.message))
123
123
  return null;
@@ -129,7 +129,15 @@ export function selfHostedLink(deps) {
129
129
  throw error;
130
130
  }
131
131
  const owner = subject ?? session.owner;
132
- const credentialId = deps.subscriptions.connect(tokens, null, new Date(), owner).id;
132
+ let credentialId;
133
+ try {
134
+ credentialId = deps.subscriptions.connect(tokens, null, new Date(), owner).id;
135
+ }
136
+ catch (error) {
137
+ if (error instanceof SubscriptionAccountConnectedError)
138
+ throw new HttpError(409, error.message, "conflict_error");
139
+ throw error;
140
+ }
133
141
  deps.subscriptions.deleteSession(token);
134
142
  return { subject: owner, credentialId };
135
143
  },
@@ -1,4 +1,4 @@
1
- import type { LinkBudget, LinkConnect, LinkKeyProvider, LinkLimit, LinkPlanAdded, LinkPlatform, LinkSignIn, LinkSubscription } from "../platform/platform.js";
1
+ import type { LinkBudget, LinkConnect, LinkKeyProvider, LinkLimit, LinkPlanAdded, LinkPlanOnComputer, LinkPlatform, LinkSignIn, LinkSubscription } from "../platform/platform.js";
2
2
  import type { SubscriptionKind } from "../types.js";
3
3
  import { type BudgetUse } from "./budget.js";
4
4
  import { type ActiveLinkGrant, type LinkAppRecord, type LinkRepo, type LinkTokenIssue } from "./grants.js";
@@ -95,6 +95,8 @@ export type LinkUsers = {
95
95
  completeThrough(grantId: string): string | null;
96
96
  /** A user's plans and API keys, oldest first. */
97
97
  plans(subject: string): Promise<LinkSubscription[]>;
98
+ /** See `LinkApprovalPage.plansOnComputers`. */
99
+ plansOnComputers?(subject: string): Promise<LinkPlanOnComputer[]>;
98
100
  /** The plans and API keys with these ids, whoever added them. */
99
101
  plansWithIds(ids: readonly string[]): Promise<LinkSubscription[]>;
100
102
  /** See `LinkApprovalPage.addKey`; the provider is one of `keyProviders`. */
@@ -81,6 +81,7 @@ export function linkPlatform(store, users) {
81
81
  connectable: users.connectable,
82
82
  keyProviders: users.keyProviders,
83
83
  subscriptions: (subject) => users.plans(subject),
84
+ ...(users.plansOnComputers === undefined ? {} : { plansOnComputers: users.plansOnComputers }),
84
85
  async addKey(subject, provider, apiKey) {
85
86
  if (!users.keyProviders.some((candidate) => candidate.id === provider)) {
86
87
  throw new HttpError(400, "Choose a provider to add a key for.", "invalid_request");
@@ -10,7 +10,6 @@ export const DEFAULT_CATALOG_PROVIDERS = [
10
10
  "google",
11
11
  "fireworks",
12
12
  "opencode-go",
13
- "github-copilot",
14
13
  "openrouter",
15
14
  "vercel-ai-gateway",
16
15
  ];
@@ -10,7 +10,6 @@ const PROVIDER_LABELS = {
10
10
  xai: "xAI",
11
11
  google: "Google",
12
12
  "opencode-go": "OpenCode Go",
13
- "github-copilot": "GitHub Copilot",
14
13
  "vercel-token-pass": "Vercel Token Pass",
15
14
  dari: "Dari",
16
15
  "amazon-bedrock": "Amazon Bedrock",
@@ -36,10 +35,6 @@ const PROVIDER_BASE_URLS = {
36
35
  // A flat-rate plan for open models; each model keeps its own API path
37
36
  // under https://opencode.ai/inference/go/, and this is chat completions.
38
37
  "opencode-go": "https://opencode.ai/inference/go/openai/v1",
39
- // Flat plans served only by personal subscriptions. Each Copilot account
40
- // has its own API origin, named in its token (see github_copilot.ts); this
41
- // one is the individual plans'.
42
- "github-copilot": "https://api.individual.githubcopilot.com",
43
38
  // A Token Pass key on Vercel AI Gateway, which serves only the gateway's
44
39
  // featured models, over Anthropic Messages.
45
40
  "vercel-token-pass": "https://ai-gateway.vercel.sh",
@@ -1,137 +1,4 @@
1
1
  [
2
- {
3
- "model_id": "openai/gpt-6.2-astra",
4
- "provider": "github-copilot",
5
- "native_model_id": "gpt-6.2-astra",
6
- "api": "openai-responses",
7
- "base_url": "https://api.individual.githubcopilot.com"
8
- },
9
- {
10
- "model_id": "openai/gpt-6-astra",
11
- "provider": "github-copilot",
12
- "native_model_id": "gpt-6-astra",
13
- "api": "openai-responses",
14
- "base_url": "https://api.individual.githubcopilot.com"
15
- },
16
- {
17
- "model_id": "openai/gpt-6.1-terra",
18
- "provider": "github-copilot",
19
- "native_model_id": "gpt-6.1-terra",
20
- "api": "openai-responses",
21
- "base_url": "https://api.individual.githubcopilot.com"
22
- },
23
- {
24
- "model_id": "openai/gpt-6.2-sol",
25
- "provider": "github-copilot",
26
- "native_model_id": "gpt-6.2-sol",
27
- "api": "openai-responses",
28
- "base_url": "https://api.individual.githubcopilot.com"
29
- },
30
- {
31
- "model_id": "openai/gpt-6.1-sol",
32
- "provider": "github-copilot",
33
- "native_model_id": "gpt-6.1-sol",
34
- "api": "openai-responses",
35
- "base_url": "https://api.individual.githubcopilot.com"
36
- },
37
- {
38
- "model_id": "openai/gpt-6-sol",
39
- "provider": "github-copilot",
40
- "native_model_id": "gpt-6-sol",
41
- "api": "openai-responses",
42
- "base_url": "https://api.individual.githubcopilot.com"
43
- },
44
- {
45
- "model_id": "openai/gpt-6-luna",
46
- "provider": "github-copilot",
47
- "native_model_id": "gpt-6-luna",
48
- "api": "openai-responses",
49
- "base_url": "https://api.individual.githubcopilot.com"
50
- },
51
- {
52
- "model_id": "openai/gpt-5.6-sol",
53
- "provider": "github-copilot",
54
- "native_model_id": "gpt-5.6-sol",
55
- "api": "openai-responses",
56
- "base_url": "https://api.individual.githubcopilot.com"
57
- },
58
- {
59
- "model_id": "openai/gpt-5.6-terra",
60
- "provider": "github-copilot",
61
- "native_model_id": "gpt-5.6-terra",
62
- "api": "openai-responses",
63
- "base_url": "https://api.individual.githubcopilot.com"
64
- },
65
- {
66
- "model_id": "openai/gpt-5.6-luna",
67
- "provider": "github-copilot",
68
- "native_model_id": "gpt-5.6-luna",
69
- "api": "openai-responses",
70
- "base_url": "https://api.individual.githubcopilot.com"
71
- },
72
- {
73
- "model_id": "anthropic/claude-opus-5-5",
74
- "provider": "github-copilot",
75
- "native_model_id": "claude-opus-5.5",
76
- "api": "anthropic-messages",
77
- "base_url": "https://api.individual.githubcopilot.com"
78
- },
79
- {
80
- "model_id": "anthropic/claude-opus-5",
81
- "provider": "github-copilot",
82
- "native_model_id": "claude-opus-5",
83
- "api": "anthropic-messages",
84
- "base_url": "https://api.individual.githubcopilot.com"
85
- },
86
- {
87
- "model_id": "anthropic/claude-sonnet-5-5",
88
- "provider": "github-copilot",
89
- "native_model_id": "claude-sonnet-5.5",
90
- "api": "anthropic-messages",
91
- "base_url": "https://api.individual.githubcopilot.com"
92
- },
93
- {
94
- "model_id": "anthropic/claude-sonnet-5",
95
- "provider": "github-copilot",
96
- "native_model_id": "claude-sonnet-5",
97
- "api": "anthropic-messages",
98
- "base_url": "https://api.individual.githubcopilot.com"
99
- },
100
- {
101
- "model_id": "anthropic/claude-fable-5-2",
102
- "provider": "github-copilot",
103
- "native_model_id": "claude-fable-5.2",
104
- "api": "anthropic-messages",
105
- "base_url": "https://api.individual.githubcopilot.com"
106
- },
107
- {
108
- "model_id": "anthropic/claude-fable-5-1",
109
- "provider": "github-copilot",
110
- "native_model_id": "claude-fable-5.1",
111
- "api": "anthropic-messages",
112
- "base_url": "https://api.individual.githubcopilot.com"
113
- },
114
- {
115
- "model_id": "anthropic/claude-fable-5",
116
- "provider": "github-copilot",
117
- "native_model_id": "claude-fable-5",
118
- "api": "anthropic-messages",
119
- "base_url": "https://api.individual.githubcopilot.com"
120
- },
121
- {
122
- "model_id": "anthropic/claude-haiku-5-5",
123
- "provider": "github-copilot",
124
- "native_model_id": "claude-haiku-5.5",
125
- "api": "anthropic-messages",
126
- "base_url": "https://api.individual.githubcopilot.com"
127
- },
128
- {
129
- "model_id": "anthropic/claude-haiku-4-5",
130
- "provider": "github-copilot",
131
- "native_model_id": "claude-haiku-4.5",
132
- "api": "anthropic-messages",
133
- "base_url": "https://api.individual.githubcopilot.com"
134
- },
135
2
  {
136
3
  "model_id": "meta/muse-spark-open",
137
4
  "provider": "fireworks",
@@ -202,20 +69,6 @@
202
69
  "api": "openai-completions",
203
70
  "base_url": "https://api.fireworks.ai/inference/v1"
204
71
  },
205
- {
206
- "model_id": "xai/grok-4.6",
207
- "provider": "github-copilot",
208
- "native_model_id": "grok-4.6",
209
- "api": "openai-responses",
210
- "base_url": "https://api.individual.githubcopilot.com"
211
- },
212
- {
213
- "model_id": "xai/grok-4.7",
214
- "provider": "github-copilot",
215
- "native_model_id": "grok-4.7",
216
- "api": "openai-responses",
217
- "base_url": "https://api.individual.githubcopilot.com"
218
- },
219
72
  {
220
73
  "model_id": "moonshotai/Kimi-K3",
221
74
  "provider": "opencode-go",
@@ -223,13 +76,6 @@
223
76
  "api": "openai-completions",
224
77
  "base_url": "https://opencode.ai/inference/go/openai/v1"
225
78
  },
226
- {
227
- "model_id": "moonshotai/Kimi-K3",
228
- "provider": "github-copilot",
229
- "native_model_id": "kimi-k3",
230
- "api": "openai-completions",
231
- "base_url": "https://api.individual.githubcopilot.com"
232
- },
233
79
  {
234
80
  "model_id": "moonshotai/Kimi-K3",
235
81
  "provider": "vercel-token-pass",
@@ -299,33 +145,5 @@
299
145
  "native_model_id": "deepseek-v4.1-flash",
300
146
  "api": "openai-completions",
301
147
  "base_url": "https://opencode.ai/inference/go/openai/v1"
302
- },
303
- {
304
- "model_id": "google/gemini-4-argon",
305
- "provider": "github-copilot",
306
- "native_model_id": "gemini-4-argon",
307
- "api": "openai-completions",
308
- "base_url": "https://api.individual.githubcopilot.com"
309
- },
310
- {
311
- "model_id": "google/gemini-4-carbon",
312
- "provider": "github-copilot",
313
- "native_model_id": "gemini-4-carbon",
314
- "api": "openai-completions",
315
- "base_url": "https://api.individual.githubcopilot.com"
316
- },
317
- {
318
- "model_id": "google/gemini-4-hydrogen",
319
- "provider": "github-copilot",
320
- "native_model_id": "gemini-4-hydrogen",
321
- "api": "openai-completions",
322
- "base_url": "https://api.individual.githubcopilot.com"
323
- },
324
- {
325
- "model_id": "google/gemini-3.8-flash",
326
- "provider": "github-copilot",
327
- "native_model_id": "gemini-3.8-flash",
328
- "api": "openai-completions",
329
- "base_url": "https://api.individual.githubcopilot.com"
330
148
  }
331
149
  ]
@@ -14,7 +14,6 @@ const SUBSCRIPTION_MODEL_PROVIDERS = {
14
14
  xai_grok: ["xai"],
15
15
  meta_muse: ["meta"],
16
16
  opencode_go: ["opencode-go"],
17
- github_copilot: ["github-copilot"],
18
17
  vercel_token_pass: ["vercel-token-pass"],
19
18
  };
20
19
  // The client each plan is limited to, as its provider limits it: a Claude Code
@@ -254,6 +254,12 @@ export type LinkApprovalPage = {
254
254
  addKey(subject: string | null, provider: string, apiKey: string): Promise<LinkPlanAdded>;
255
255
  /** The plans this user connected and the API keys they added, which an approval chooses among. */
256
256
  subscriptions(subject: string): Promise<LinkSubscription[]>;
257
+ /**
258
+ * The user's plans that live on one of their computers rather than on the
259
+ * platform, which apps cannot use; the page says where each is. Absent on
260
+ * a platform where every plan is its own.
261
+ */
262
+ plansOnComputers?(subject: string): Promise<LinkPlanOnComputer[]>;
257
263
  /** Start the provider's sign-in for a plan of this kind. */
258
264
  startConnect(kind: SubscriptionKind): Promise<LinkConnect>;
259
265
  /**
@@ -306,6 +312,11 @@ export type LinkSignIn = {
306
312
  issuedAt: number;
307
313
  } | null>;
308
314
  };
315
+ /** A plan kept on one of the user's computers: its kind and the computer's name. */
316
+ export type LinkPlanOnComputer = {
317
+ provider: SubscriptionKind;
318
+ computer: string;
319
+ };
309
320
  /** A plan or API key the user added, and who they are now. */
310
321
  export type LinkPlanAdded = {
311
322
  subject: string;
@@ -19,5 +19,11 @@ export declare function readCodexModelLimitReset(args: {
19
19
  fetch?: typeof fetch;
20
20
  }): Promise<Date | null>;
21
21
  export declare function codexModelLimitResetFromReport(report: unknown, now: Date): Date | null;
22
+ /** Codex's usage report, the endpoint behind the Codex CLI's /status. */
23
+ export declare function fetchCodexUsageReport(args: {
24
+ accessToken: string;
25
+ baseUrl?: string;
26
+ fetch?: typeof fetch;
27
+ }): Promise<unknown>;
22
28
  /** Every Codex window with a future reset, or null when the report has none. */
23
29
  export declare function codexUsageFromReport(report: unknown, now: Date): SubscriptionUsage | null;
@@ -57,7 +57,8 @@ function limitWindows(limit) {
57
57
  }];
58
58
  });
59
59
  }
60
- async function fetchCodexUsageReport(args) {
60
+ /** Codex's usage report, the endpoint behind the Codex CLI's /status. */
61
+ export async function fetchCodexUsageReport(args) {
61
62
  const accountId = codexAccountId(args.accessToken);
62
63
  const response = await (args.fetch ?? globalThis.fetch)(`${(args.baseUrl ?? DEFAULT_CODEX_BASE_URL).replace(/\/$/, "")}/wham/usage`, {
63
64
  headers: {
@@ -13,7 +13,6 @@ import { runProviderAttemptPlan, } from "./provider_attempt_runner.js";
13
13
  import { estimatedCancelUsage, NO_DELIVERED_OUTPUT, observeDeliveredOutput, } from "./cancel_estimate.js";
14
14
  import { providerResponseCaptureFromError } from "./response_capture.js";
15
15
  import { createStreamFinalizer } from "./stream_finalization.js";
16
- import { copilotEndpoint } from "./github_copilot.js";
17
16
  import { readCodexModelLimitReset, readCodexUsage } from "./codex_usage.js";
18
17
  import { detectSubscriptionUsageLimit, codexUsageLimitError, subscriptionOAuthProviderFor, subscriptionUsageFromHeaders, museSubscriptionUsage, failureWithSubscriptionUsageLimit, retryAfterSeconds, subscriptionUsageLimitFromFailure, subscriptionSwitchedMessage, subscriptionUsageLimitMessage, } from "./subscription_limits.js";
19
18
  export async function executeNonStreaming(args) {
@@ -610,8 +609,6 @@ function onNextSubscription(choice, next) {
610
609
  apiKey: next.apiKey,
611
610
  auth: { type: "bearer", apiKey: next.apiKey },
612
611
  subscriptionCredentialId: next.credentialId,
613
- // A Copilot token names its own account's API origin.
614
- ...(choice.execution.provider === "github-copilot" ? { endpoint: copilotEndpoint(next.apiKey) } : {}),
615
612
  },
616
613
  };
617
614
  }