@slkiser/opencode-quota 4.0.0 → 4.1.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 (266) hide show
  1. package/README.md +37 -25
  2. package/dist/bin/opencode-quota.d.ts.map +1 -1
  3. package/dist/bin/opencode-quota.js +8 -0
  4. package/dist/bin/opencode-quota.js.map +1 -1
  5. package/dist/index.d.ts +2 -2
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/lib/anthropic.d.ts.map +1 -1
  8. package/dist/lib/anthropic.js +78 -72
  9. package/dist/lib/anthropic.js.map +1 -1
  10. package/dist/lib/api-key-resolver.d.ts.map +1 -1
  11. package/dist/lib/api-key-resolver.js +14 -24
  12. package/dist/lib/api-key-resolver.js.map +1 -1
  13. package/dist/lib/atomic-json.d.ts +3 -1
  14. package/dist/lib/atomic-json.d.ts.map +1 -1
  15. package/dist/lib/atomic-json.js +23 -9
  16. package/dist/lib/atomic-json.js.map +1 -1
  17. package/dist/lib/chutes.d.ts.map +1 -1
  18. package/dist/lib/chutes.js +28 -23
  19. package/dist/lib/chutes.js.map +1 -1
  20. package/dist/lib/cli-show.d.ts +9 -0
  21. package/dist/lib/cli-show.d.ts.map +1 -1
  22. package/dist/lib/cli-show.js +34 -5
  23. package/dist/lib/cli-show.js.map +1 -1
  24. package/dist/lib/cli-status.d.ts +8 -0
  25. package/dist/lib/cli-status.d.ts.map +1 -0
  26. package/dist/lib/cli-status.js +125 -0
  27. package/dist/lib/cli-status.js.map +1 -0
  28. package/dist/lib/config.d.ts +1 -1
  29. package/dist/lib/config.d.ts.map +1 -1
  30. package/dist/lib/config.js +47 -12
  31. package/dist/lib/config.js.map +1 -1
  32. package/dist/lib/copilot.d.ts +11 -5
  33. package/dist/lib/copilot.d.ts.map +1 -1
  34. package/dist/lib/copilot.js +300 -52
  35. package/dist/lib/copilot.js.map +1 -1
  36. package/dist/lib/deepseek.d.ts.map +1 -1
  37. package/dist/lib/deepseek.js +22 -17
  38. package/dist/lib/deepseek.js.map +1 -1
  39. package/dist/lib/display-sanitize.d.ts.map +1 -1
  40. package/dist/lib/display-sanitize.js +8 -0
  41. package/dist/lib/display-sanitize.js.map +1 -1
  42. package/dist/lib/entries.d.ts +14 -1
  43. package/dist/lib/entries.d.ts.map +1 -1
  44. package/dist/lib/entries.js.map +1 -1
  45. package/dist/lib/format-utils.d.ts +7 -0
  46. package/dist/lib/format-utils.d.ts.map +1 -1
  47. package/dist/lib/format-utils.js +18 -0
  48. package/dist/lib/format-utils.js.map +1 -1
  49. package/dist/lib/format.d.ts +1 -0
  50. package/dist/lib/format.d.ts.map +1 -1
  51. package/dist/lib/format.js +22 -7
  52. package/dist/lib/format.js.map +1 -1
  53. package/dist/lib/google-agy.d.ts.map +1 -1
  54. package/dist/lib/google-agy.js +203 -92
  55. package/dist/lib/google-agy.js.map +1 -1
  56. package/dist/lib/google-gemini-cli.d.ts.map +1 -1
  57. package/dist/lib/google-gemini-cli.js +53 -41
  58. package/dist/lib/google-gemini-cli.js.map +1 -1
  59. package/dist/lib/google-token-cache.d.ts.map +1 -1
  60. package/dist/lib/google-token-cache.js +87 -34
  61. package/dist/lib/google-token-cache.js.map +1 -1
  62. package/dist/lib/google.d.ts.map +1 -1
  63. package/dist/lib/google.js +57 -39
  64. package/dist/lib/google.js.map +1 -1
  65. package/dist/lib/grouped-entry-normalization.d.ts.map +1 -1
  66. package/dist/lib/grouped-entry-normalization.js +7 -1
  67. package/dist/lib/grouped-entry-normalization.js.map +1 -1
  68. package/dist/lib/http.d.ts +12 -7
  69. package/dist/lib/http.d.ts.map +1 -1
  70. package/dist/lib/http.js +28 -15
  71. package/dist/lib/http.js.map +1 -1
  72. package/dist/lib/init-installer.d.ts +2 -1
  73. package/dist/lib/init-installer.d.ts.map +1 -1
  74. package/dist/lib/init-installer.js +29 -2
  75. package/dist/lib/init-installer.js.map +1 -1
  76. package/dist/lib/kimi.d.ts.map +1 -1
  77. package/dist/lib/kimi.js +20 -15
  78. package/dist/lib/kimi.js.map +1 -1
  79. package/dist/lib/maintainer-announcements.d.ts.map +1 -1
  80. package/dist/lib/maintainer-announcements.js +10 -13
  81. package/dist/lib/maintainer-announcements.js.map +1 -1
  82. package/dist/lib/mimo-config.d.ts +29 -0
  83. package/dist/lib/mimo-config.d.ts.map +1 -0
  84. package/dist/lib/mimo-config.js +147 -0
  85. package/dist/lib/mimo-config.js.map +1 -0
  86. package/dist/lib/mimo.d.ts +35 -0
  87. package/dist/lib/mimo.d.ts.map +1 -0
  88. package/dist/lib/mimo.js +236 -0
  89. package/dist/lib/mimo.js.map +1 -0
  90. package/dist/lib/modelsdev-pricing.d.ts.map +1 -1
  91. package/dist/lib/modelsdev-pricing.js +39 -27
  92. package/dist/lib/modelsdev-pricing.js.map +1 -1
  93. package/dist/lib/nanogpt.d.ts.map +1 -1
  94. package/dist/lib/nanogpt.js +40 -30
  95. package/dist/lib/nanogpt.js.map +1 -1
  96. package/dist/lib/ollama-cloud.d.ts +1 -1
  97. package/dist/lib/ollama-cloud.d.ts.map +1 -1
  98. package/dist/lib/ollama-cloud.js +73 -68
  99. package/dist/lib/ollama-cloud.js.map +1 -1
  100. package/dist/lib/openai.d.ts.map +1 -1
  101. package/dist/lib/openai.js +65 -45
  102. package/dist/lib/openai.js.map +1 -1
  103. package/dist/lib/opencode-config-editor.d.ts +6 -0
  104. package/dist/lib/opencode-config-editor.d.ts.map +1 -1
  105. package/dist/lib/opencode-config-editor.js +47 -1
  106. package/dist/lib/opencode-config-editor.js.map +1 -1
  107. package/dist/lib/opencode-config-providers.d.ts.map +1 -1
  108. package/dist/lib/opencode-config-providers.js +13 -16
  109. package/dist/lib/opencode-config-providers.js.map +1 -1
  110. package/dist/lib/opencode-config-read.d.ts +23 -0
  111. package/dist/lib/opencode-config-read.d.ts.map +1 -0
  112. package/dist/lib/opencode-config-read.js +30 -0
  113. package/dist/lib/opencode-config-read.js.map +1 -0
  114. package/dist/lib/opencode-go.d.ts.map +1 -1
  115. package/dist/lib/opencode-go.js +44 -39
  116. package/dist/lib/opencode-go.js.map +1 -1
  117. package/dist/lib/opencode-zen-config.d.ts +34 -0
  118. package/dist/lib/opencode-zen-config.d.ts.map +1 -0
  119. package/dist/lib/opencode-zen-config.js +103 -0
  120. package/dist/lib/opencode-zen-config.js.map +1 -0
  121. package/dist/lib/opencode-zen.d.ts +27 -0
  122. package/dist/lib/opencode-zen.d.ts.map +1 -0
  123. package/dist/lib/opencode-zen.js +143 -0
  124. package/dist/lib/opencode-zen.js.map +1 -0
  125. package/dist/lib/provider-add-command.d.ts.map +1 -1
  126. package/dist/lib/provider-add-command.js +21 -2
  127. package/dist/lib/provider-add-command.js.map +1 -1
  128. package/dist/lib/provider-add-json-v1-questionnaire.d.ts +32 -0
  129. package/dist/lib/provider-add-json-v1-questionnaire.d.ts.map +1 -0
  130. package/dist/lib/provider-add-json-v1-questionnaire.js +336 -0
  131. package/dist/lib/provider-add-json-v1-questionnaire.js.map +1 -0
  132. package/dist/lib/provider-add.d.ts.map +1 -1
  133. package/dist/lib/provider-add.js +11 -2
  134. package/dist/lib/provider-add.js.map +1 -1
  135. package/dist/lib/provider-availability.d.ts +2 -2
  136. package/dist/lib/provider-availability.d.ts.map +1 -1
  137. package/dist/lib/provider-availability.js +2 -3
  138. package/dist/lib/provider-availability.js.map +1 -1
  139. package/dist/lib/provider-metadata.d.ts +289 -1
  140. package/dist/lib/provider-metadata.d.ts.map +1 -1
  141. package/dist/lib/provider-metadata.js +321 -227
  142. package/dist/lib/provider-metadata.js.map +1 -1
  143. package/dist/lib/quota-command-format.d.ts.map +1 -1
  144. package/dist/lib/quota-command-format.js +12 -16
  145. package/dist/lib/quota-command-format.js.map +1 -1
  146. package/dist/lib/quota-dialog-commands.d.ts +59 -2
  147. package/dist/lib/quota-dialog-commands.d.ts.map +1 -1
  148. package/dist/lib/quota-dialog-commands.js +71 -30
  149. package/dist/lib/quota-dialog-commands.js.map +1 -1
  150. package/dist/lib/quota-entry-display.d.ts +2 -0
  151. package/dist/lib/quota-entry-display.d.ts.map +1 -1
  152. package/dist/lib/quota-entry-display.js +27 -13
  153. package/dist/lib/quota-entry-display.js.map +1 -1
  154. package/dist/lib/quota-providers-remote.d.ts +6 -1
  155. package/dist/lib/quota-providers-remote.d.ts.map +1 -1
  156. package/dist/lib/quota-providers-remote.js +376 -12
  157. package/dist/lib/quota-providers-remote.js.map +1 -1
  158. package/dist/lib/quota-providers.d.ts +84 -3
  159. package/dist/lib/quota-providers.d.ts.map +1 -1
  160. package/dist/lib/quota-providers.js +561 -24
  161. package/dist/lib/quota-providers.js.map +1 -1
  162. package/dist/lib/quota-render-data.d.ts +4 -0
  163. package/dist/lib/quota-render-data.d.ts.map +1 -1
  164. package/dist/lib/quota-render-data.js +101 -121
  165. package/dist/lib/quota-render-data.js.map +1 -1
  166. package/dist/lib/quota-runtime-context.d.ts +9 -1
  167. package/dist/lib/quota-runtime-context.d.ts.map +1 -1
  168. package/dist/lib/quota-runtime-context.js +5 -0
  169. package/dist/lib/quota-runtime-context.js.map +1 -1
  170. package/dist/lib/quota-state.d.ts.map +1 -1
  171. package/dist/lib/quota-state.js +26 -2
  172. package/dist/lib/quota-state.js.map +1 -1
  173. package/dist/lib/quota-stats.d.ts +1 -0
  174. package/dist/lib/quota-stats.d.ts.map +1 -1
  175. package/dist/lib/quota-stats.js +14 -4
  176. package/dist/lib/quota-stats.js.map +1 -1
  177. package/dist/lib/quota-status.d.ts.map +1 -1
  178. package/dist/lib/quota-status.js +96 -1
  179. package/dist/lib/quota-status.js.map +1 -1
  180. package/dist/lib/runtime-provider-ids.d.ts +4 -0
  181. package/dist/lib/runtime-provider-ids.d.ts.map +1 -0
  182. package/dist/lib/runtime-provider-ids.js +10 -0
  183. package/dist/lib/runtime-provider-ids.js.map +1 -0
  184. package/dist/lib/session-tokens.d.ts +2 -0
  185. package/dist/lib/session-tokens.d.ts.map +1 -1
  186. package/dist/lib/session-tokens.js +4 -2
  187. package/dist/lib/session-tokens.js.map +1 -1
  188. package/dist/lib/synthetic.d.ts.map +1 -1
  189. package/dist/lib/synthetic.js +37 -32
  190. package/dist/lib/synthetic.js.map +1 -1
  191. package/dist/lib/toast-format-grouped.d.ts +1 -0
  192. package/dist/lib/toast-format-grouped.d.ts.map +1 -1
  193. package/dist/lib/toast-format-grouped.js +33 -29
  194. package/dist/lib/toast-format-grouped.js.map +1 -1
  195. package/dist/lib/tui-refresh-lifecycle.d.ts +17 -0
  196. package/dist/lib/tui-refresh-lifecycle.d.ts.map +1 -0
  197. package/dist/lib/tui-refresh-lifecycle.js +83 -0
  198. package/dist/lib/tui-refresh-lifecycle.js.map +1 -0
  199. package/dist/lib/tui-runtime.d.ts +0 -5
  200. package/dist/lib/tui-runtime.d.ts.map +1 -1
  201. package/dist/lib/tui-runtime.js +1 -6
  202. package/dist/lib/tui-runtime.js.map +1 -1
  203. package/dist/lib/tui-sidebar-format.d.ts +1 -1
  204. package/dist/lib/tui-sidebar-format.d.ts.map +1 -1
  205. package/dist/lib/tui-sidebar-format.js +1 -0
  206. package/dist/lib/tui-sidebar-format.js.map +1 -1
  207. package/dist/lib/types.d.ts +61 -7
  208. package/dist/lib/types.d.ts.map +1 -1
  209. package/dist/lib/types.js +2 -0
  210. package/dist/lib/types.js.map +1 -1
  211. package/dist/lib/xai.d.ts +39 -0
  212. package/dist/lib/xai.d.ts.map +1 -0
  213. package/dist/lib/xai.js +153 -0
  214. package/dist/lib/xai.js.map +1 -0
  215. package/dist/lib/zai.d.ts.map +1 -1
  216. package/dist/lib/zai.js +62 -56
  217. package/dist/lib/zai.js.map +1 -1
  218. package/dist/lib/zhipu.d.ts.map +1 -1
  219. package/dist/lib/zhipu.js +55 -50
  220. package/dist/lib/zhipu.js.map +1 -1
  221. package/dist/plugin.d.ts.map +1 -1
  222. package/dist/plugin.js +36 -157
  223. package/dist/plugin.js.map +1 -1
  224. package/dist/providers/copilot.d.ts.map +1 -1
  225. package/dist/providers/copilot.js +24 -3
  226. package/dist/providers/copilot.js.map +1 -1
  227. package/dist/providers/glm-coding-plan-provider.d.ts +35 -0
  228. package/dist/providers/glm-coding-plan-provider.d.ts.map +1 -0
  229. package/dist/providers/glm-coding-plan-provider.js +40 -0
  230. package/dist/providers/glm-coding-plan-provider.js.map +1 -0
  231. package/dist/providers/google-agy.d.ts.map +1 -1
  232. package/dist/providers/google-agy.js +60 -36
  233. package/dist/providers/google-agy.js.map +1 -1
  234. package/dist/providers/mimo.d.ts +3 -0
  235. package/dist/providers/mimo.d.ts.map +1 -0
  236. package/dist/providers/mimo.js +120 -0
  237. package/dist/providers/mimo.js.map +1 -0
  238. package/dist/providers/minimax-coding-plan.d.ts.map +1 -1
  239. package/dist/providers/minimax-coding-plan.js +60 -37
  240. package/dist/providers/minimax-coding-plan.js.map +1 -1
  241. package/dist/providers/opencode-zen.d.ts +3 -0
  242. package/dist/providers/opencode-zen.d.ts.map +1 -0
  243. package/dist/providers/opencode-zen.js +94 -0
  244. package/dist/providers/opencode-zen.js.map +1 -0
  245. package/dist/providers/quota-providers.d.ts.map +1 -1
  246. package/dist/providers/quota-providers.js +5 -3
  247. package/dist/providers/quota-providers.js.map +1 -1
  248. package/dist/providers/registry.d.ts.map +1 -1
  249. package/dist/providers/registry.js +6 -0
  250. package/dist/providers/registry.js.map +1 -1
  251. package/dist/providers/xai.d.ts +6 -0
  252. package/dist/providers/xai.d.ts.map +1 -0
  253. package/dist/providers/xai.js +51 -0
  254. package/dist/providers/xai.js.map +1 -0
  255. package/dist/providers/zai.d.ts +1 -7
  256. package/dist/providers/zai.d.ts.map +1 -1
  257. package/dist/providers/zai.js +9 -45
  258. package/dist/providers/zai.js.map +1 -1
  259. package/dist/providers/zhipu.d.ts +1 -7
  260. package/dist/providers/zhipu.d.ts.map +1 -1
  261. package/dist/providers/zhipu.js +9 -45
  262. package/dist/providers/zhipu.js.map +1 -1
  263. package/dist/tui.d.ts.map +1 -1
  264. package/dist/tui.js +47 -136
  265. package/dist/tui.tsx +62 -179
  266. package/package.json +1 -1
@@ -1,257 +1,351 @@
1
- export const QUOTA_PROVIDER_LABELS = {
2
- anthropic: "Anthropic",
3
- openai: "OpenAI",
4
- copilot: "Copilot",
5
- "google-antigravity": "Google",
6
- "google-gemini-cli": "Gemini CLI",
7
- "google-agy": "Google AGY",
8
- synthetic: "Synthetic",
9
- chutes: "Chutes",
10
- cursor: "Cursor",
11
- "qwen-code": "Qwen",
12
- "alibaba-coding-plan": "Alibaba Coding Plan",
13
- zai: "Z.ai",
14
- zhipu: "Zhipu",
15
- nanogpt: "NanoGPT",
16
- "minimax-coding-plan": "MiniMax Coding Plan",
17
- "minimax-china-coding-plan": "MiniMax Coding Plan (CN)",
18
- "minimax-cn-coding-plan": "MiniMax Coding Plan (CN)",
19
- "kimi-for-coding": "Kimi Code",
20
- "kimi-code": "Kimi Code",
21
- deepseek: "DeepSeek",
22
- "opencode-go": "OpenCode Go",
23
- "ollama-cloud": "Ollama Cloud",
24
- "quota-providers": "Quota providers",
25
- };
26
- export const QUOTA_PROVIDER_ID_SYNONYMS = {
27
- "github-copilot": "copilot",
28
- "copilot-chat": "copilot",
29
- "github-copilot-chat": "copilot",
30
- "cursor-acp": "cursor",
31
- "open-cursor": "cursor",
32
- "@rama_nigg/open-cursor": "cursor",
33
- claude: "anthropic",
34
- "claude-code": "anthropic",
35
- qwen: "qwen-code",
36
- alibaba: "alibaba-coding-plan",
37
- "nano-gpt": "nanogpt",
38
- minimax: "minimax-coding-plan",
39
- "minimax-cn": "minimax-china-coding-plan",
40
- "minimax-china": "minimax-china-coding-plan",
41
- "minimax-cn-coding-plan": "minimax-china-coding-plan",
42
- kimi: "kimi-for-coding",
43
- "kimi-for-code": "kimi-for-coding",
44
- "kimi-code": "kimi-for-coding",
45
- "deep-seek": "deepseek",
46
- "opencode-go-subscription": "opencode-go",
47
- "gemini-cli": "google-gemini-cli",
48
- "google-gemini": "google-gemini-cli",
49
- "opencode-gemini-auth": "google-gemini-cli",
50
- gemini: "google-gemini-cli",
51
- "opencode-agy-auth": "google-agy",
52
- "google-agy-auth": "google-agy",
53
- "glm-coding-plan": "zhipu",
54
- "zhipu-coding-plan": "zhipu",
55
- "zhipuai-coding-plan": "zhipu",
56
- };
57
- export const QUOTA_PROVIDER_RUNTIME_IDS = {
58
- anthropic: ["anthropic"],
59
- copilot: ["copilot", "github-copilot", "copilot-chat", "github-copilot-chat"],
60
- openai: ["openai", "chatgpt", "codex"],
61
- cursor: ["cursor", "cursor-acp"],
62
- "qwen-code": ["qwen-code"],
63
- "alibaba-coding-plan": ["alibaba-coding-plan"],
64
- synthetic: ["synthetic"],
65
- chutes: ["chutes", "chutes-ai"],
66
- "google-antigravity": ["google-antigravity", "google", "antigravity"],
67
- "google-gemini-cli": [
68
- "google-gemini-cli",
69
- "gemini-cli",
70
- "gemini",
71
- "opencode-gemini-auth",
72
- "google",
73
- ],
74
- "google-agy": ["google-agy", "opencode-agy-auth", "google-agy-auth"],
75
- zai: ["zai", "glm", "zai-coding-plan"],
76
- zhipu: ["zhipu", "glm-coding-plan", "zhipu-coding-plan", "zhipuai-coding-plan"],
77
- nanogpt: ["nanogpt", "nano-gpt"],
78
- "minimax-coding-plan": ["minimax-coding-plan", "minimax"],
79
- "minimax-china-coding-plan": [
80
- "minimax-china-coding-plan",
81
- "minimax-cn-coding-plan",
82
- "minimax-cn",
83
- "minimax-china",
84
- ],
85
- "kimi-for-coding": ["kimi-for-coding", "kimi", "kimi-code"],
86
- deepseek: ["deepseek"],
87
- "opencode-go": ["opencode-go"],
88
- "ollama-cloud": ["ollama-cloud"],
89
- "quota-providers": [],
90
- };
91
- const LIVE_LOCAL_USAGE_PROVIDER_ID_SET = new Set([
92
- "qwen-code",
93
- "alibaba-coding-plan",
94
- "cursor",
95
- ]);
96
- export const QUOTA_PROVIDER_SHAPES = [
97
- {
98
- id: "anthropic",
99
- autoSetup: "needs_quick_setup",
100
- authentication: "local_cli_auth",
101
- quota: "local_cli_report",
102
- quickSetupAnchor: "anthropic-claude",
1
+ const PROVIDER_CATALOG_SOURCE = {
2
+ anthropic: {
3
+ label: "Anthropic",
4
+ runtimeIds: ["anthropic"],
5
+ synonyms: ["claude", "claude-code"],
6
+ shape: {
7
+ autoSetup: "needs_quick_setup",
8
+ authentication: "local_cli_auth",
9
+ quota: "local_cli_report",
10
+ quickSetupAnchor: "anthropic-claude",
11
+ },
12
+ },
13
+ copilot: {
14
+ label: "Copilot",
15
+ runtimeIds: ["copilot", "github-copilot", "copilot-chat", "github-copilot-chat"],
16
+ synonyms: ["github-copilot", "copilot-chat", "github-copilot-chat"],
17
+ shape: {
18
+ autoSetup: "usually",
19
+ authentication: "github_oauth_or_pat",
20
+ quota: "remote_api",
21
+ notes: "OAuth for personal flow; PAT for managed billing",
22
+ },
23
+ },
24
+ openai: {
25
+ label: "OpenAI",
26
+ runtimeIds: ["openai", "chatgpt", "codex"],
27
+ synonyms: [],
28
+ shape: {
29
+ autoSetup: "yes",
30
+ authentication: "opencode_auth_oauth_token",
31
+ quota: "remote_api",
32
+ },
33
+ },
34
+ cursor: {
35
+ label: "Cursor",
36
+ runtimeIds: ["cursor", "cursor-acp"],
37
+ synonyms: ["cursor-acp", "open-cursor", "@rama_nigg/open-cursor"],
38
+ liveLocalUsage: true,
39
+ shape: {
40
+ autoSetup: "needs_quick_setup",
41
+ authentication: "companion_auth_oauth_token",
42
+ quota: "local_runtime_accounting",
43
+ quickSetupAnchor: "cursor",
44
+ notes: "companion runtime/plugin integration plus local usage accounting",
45
+ },
103
46
  },
104
- {
105
- id: "copilot",
106
- autoSetup: "usually",
107
- authentication: "github_oauth_or_pat",
108
- quota: "remote_api",
109
- notes: "OAuth for personal flow; PAT for managed billing",
47
+ "qwen-code": {
48
+ label: "Qwen",
49
+ runtimeIds: ["qwen-code"],
50
+ synonyms: ["qwen"],
51
+ liveLocalUsage: true,
52
+ shape: {
53
+ autoSetup: "needs_quick_setup",
54
+ authentication: "companion_auth_oauth_token",
55
+ quota: "local_estimation",
56
+ quickSetupAnchor: "qwen-code",
57
+ },
110
58
  },
111
- {
112
- id: "openai",
113
- autoSetup: "yes",
114
- authentication: "opencode_auth_oauth_token",
115
- quota: "remote_api",
59
+ "alibaba-coding-plan": {
60
+ label: "Alibaba Coding Plan",
61
+ runtimeIds: ["alibaba-coding-plan"],
62
+ synonyms: ["alibaba"],
63
+ liveLocalUsage: true,
64
+ shape: {
65
+ autoSetup: "yes",
66
+ authentication: "opencode_auth_api_key",
67
+ authFallbacks: ["env_api_key", "global_opencode_config"],
68
+ quota: "local_estimation",
69
+ },
116
70
  },
117
- {
118
- id: "cursor",
119
- autoSetup: "needs_quick_setup",
120
- authentication: "companion_auth_oauth_token",
121
- quota: "local_runtime_accounting",
122
- quickSetupAnchor: "cursor",
123
- notes: "companion runtime/plugin integration plus local usage accounting",
71
+ synthetic: {
72
+ label: "Synthetic",
73
+ runtimeIds: ["synthetic"],
74
+ synonyms: [],
75
+ shape: {
76
+ autoSetup: "yes",
77
+ authentication: "opencode_auth_api_key",
78
+ authFallbacks: ["env_api_key", "global_opencode_config"],
79
+ quota: "remote_api",
80
+ },
124
81
  },
125
- {
126
- id: "qwen-code",
127
- autoSetup: "needs_quick_setup",
128
- authentication: "companion_auth_oauth_token",
129
- quota: "local_estimation",
130
- quickSetupAnchor: "qwen-code",
82
+ chutes: {
83
+ label: "Chutes",
84
+ runtimeIds: ["chutes", "chutes-ai"],
85
+ synonyms: [],
86
+ shape: {
87
+ autoSetup: "usually",
88
+ authentication: "opencode_auth_api_key",
89
+ authFallbacks: ["env_api_key", "global_opencode_config"],
90
+ quota: "remote_api",
91
+ },
131
92
  },
132
- {
133
- id: "alibaba-coding-plan",
134
- autoSetup: "yes",
135
- authentication: "opencode_auth_api_key",
136
- authFallbacks: ["env_api_key", "global_opencode_config"],
137
- quota: "local_estimation",
93
+ "google-antigravity": {
94
+ label: "Google",
95
+ runtimeIds: ["google-antigravity", "google", "antigravity"],
96
+ synonyms: [],
97
+ shape: {
98
+ autoSetup: "needs_quick_setup",
99
+ authentication: "companion_auth_oauth_token",
100
+ quota: "remote_api",
101
+ quickSetupAnchor: "google-antigravity",
102
+ },
138
103
  },
139
- {
140
- id: "synthetic",
141
- autoSetup: "yes",
142
- authentication: "opencode_auth_api_key",
143
- authFallbacks: ["env_api_key", "global_opencode_config"],
144
- quota: "remote_api",
104
+ "google-gemini-cli": {
105
+ label: "Gemini CLI",
106
+ runtimeIds: ["google-gemini-cli", "gemini-cli", "gemini", "opencode-gemini-auth", "google"],
107
+ synonyms: ["gemini-cli", "google-gemini", "opencode-gemini-auth", "gemini"],
108
+ shape: {
109
+ lifecycle: "deprecated",
110
+ recommendedReplacementId: "google-agy",
111
+ autoSetup: "needs_quick_setup",
112
+ authentication: "companion_auth_oauth_token",
113
+ quota: "remote_api",
114
+ quickSetupAnchor: "gemini-cli",
115
+ },
145
116
  },
146
- {
147
- id: "chutes",
148
- autoSetup: "usually",
149
- authentication: "opencode_auth_api_key",
150
- authFallbacks: ["env_api_key", "global_opencode_config"],
151
- quota: "remote_api",
117
+ "google-agy": {
118
+ label: "Google AGY",
119
+ runtimeIds: ["google-agy", "opencode-agy-auth", "google-agy-auth"],
120
+ synonyms: ["opencode-agy-auth", "google-agy-auth"],
121
+ shape: {
122
+ autoSetup: "needs_quick_setup",
123
+ authentication: "companion_auth_oauth_token",
124
+ quota: "remote_api",
125
+ quickSetupAnchor: "google-agy-quick-setup",
126
+ },
152
127
  },
153
- {
154
- id: "google-antigravity",
155
- autoSetup: "needs_quick_setup",
156
- authentication: "companion_auth_oauth_token",
157
- quota: "remote_api",
158
- quickSetupAnchor: "google-antigravity",
128
+ zai: {
129
+ label: "Z.ai",
130
+ runtimeIds: ["zai", "glm", "zai-coding-plan"],
131
+ synonyms: [],
132
+ shape: {
133
+ autoSetup: "yes",
134
+ authentication: "opencode_auth_api_key",
135
+ authFallbacks: ["env_api_key", "global_opencode_config"],
136
+ quota: "remote_api",
137
+ },
159
138
  },
160
- {
161
- id: "google-gemini-cli",
162
- autoSetup: "needs_quick_setup",
163
- authentication: "companion_auth_oauth_token",
164
- quota: "remote_api",
165
- quickSetupAnchor: "gemini-cli",
139
+ zhipu: {
140
+ label: "Zhipu",
141
+ runtimeIds: ["zhipu", "glm-coding-plan", "zhipu-coding-plan", "zhipuai-coding-plan"],
142
+ synonyms: ["glm-coding-plan", "zhipu-coding-plan", "zhipuai-coding-plan"],
143
+ shape: {
144
+ autoSetup: "yes",
145
+ authentication: "opencode_auth_api_key",
146
+ authFallbacks: ["env_api_key", "global_opencode_config"],
147
+ quota: "remote_api",
148
+ },
166
149
  },
167
- {
168
- id: "google-agy",
169
- autoSetup: "needs_quick_setup",
170
- authentication: "companion_auth_oauth_token",
171
- quota: "remote_api",
172
- quickSetupAnchor: "google-agy-quick-setup",
150
+ nanogpt: {
151
+ label: "NanoGPT",
152
+ runtimeIds: ["nanogpt", "nano-gpt"],
153
+ synonyms: ["nano-gpt"],
154
+ shape: {
155
+ autoSetup: "usually",
156
+ authentication: "opencode_auth_api_key",
157
+ authFallbacks: ["env_api_key", "global_opencode_config"],
158
+ quota: "remote_api",
159
+ },
173
160
  },
174
- {
175
- id: "zai",
176
- autoSetup: "yes",
177
- authentication: "opencode_auth_api_key",
178
- authFallbacks: ["env_api_key", "global_opencode_config"],
179
- quota: "remote_api",
161
+ "minimax-coding-plan": {
162
+ label: "MiniMax Coding Plan",
163
+ runtimeIds: ["minimax-coding-plan", "minimax"],
164
+ synonyms: ["minimax"],
165
+ shape: {
166
+ autoSetup: "yes",
167
+ authentication: "opencode_auth_api_key",
168
+ authFallbacks: ["env_api_key", "global_opencode_config"],
169
+ quota: "remote_api",
170
+ },
180
171
  },
181
- {
182
- id: "zhipu",
183
- autoSetup: "yes",
184
- authentication: "opencode_auth_api_key",
185
- authFallbacks: ["env_api_key", "global_opencode_config"],
186
- quota: "remote_api",
172
+ "minimax-china-coding-plan": {
173
+ label: "MiniMax Coding Plan (CN)",
174
+ labelAliases: ["minimax-cn-coding-plan"],
175
+ runtimeIds: [
176
+ "minimax-china-coding-plan",
177
+ "minimax-cn-coding-plan",
178
+ "minimax-cn",
179
+ "minimax-china",
180
+ ],
181
+ synonyms: ["minimax-cn", "minimax-china", "minimax-cn-coding-plan"],
182
+ shape: {
183
+ autoSetup: "yes",
184
+ authentication: "opencode_auth_api_key",
185
+ authFallbacks: ["env_api_key", "global_opencode_config"],
186
+ quota: "remote_api",
187
+ },
187
188
  },
188
- {
189
- id: "nanogpt",
190
- autoSetup: "usually",
191
- authentication: "opencode_auth_api_key",
192
- authFallbacks: ["env_api_key", "global_opencode_config"],
193
- quota: "remote_api",
189
+ "kimi-for-coding": {
190
+ label: "Kimi Code",
191
+ labelAliases: ["kimi-code"],
192
+ runtimeIds: ["kimi-for-coding", "kimi", "kimi-code"],
193
+ synonyms: ["kimi", "kimi-for-code", "kimi-code"],
194
+ shape: {
195
+ autoSetup: "yes",
196
+ authentication: "opencode_auth_api_key",
197
+ authFallbacks: ["env_api_key", "global_opencode_config"],
198
+ quota: "remote_api",
199
+ },
194
200
  },
195
- {
196
- id: "minimax-coding-plan",
197
- autoSetup: "yes",
198
- authentication: "opencode_auth_api_key",
199
- authFallbacks: ["env_api_key", "global_opencode_config"],
200
- quota: "remote_api",
201
+ deepseek: {
202
+ label: "DeepSeek",
203
+ runtimeIds: ["deepseek"],
204
+ synonyms: ["deep-seek"],
205
+ shape: {
206
+ autoSetup: "yes",
207
+ authentication: "opencode_auth_api_key",
208
+ authFallbacks: ["env_api_key", "global_opencode_config"],
209
+ quota: "remote_api",
210
+ },
201
211
  },
202
- {
203
- id: "minimax-china-coding-plan",
204
- autoSetup: "yes",
205
- authentication: "opencode_auth_api_key",
206
- authFallbacks: ["env_api_key", "global_opencode_config"],
207
- quota: "remote_api",
212
+ xai: {
213
+ label: "xAI",
214
+ runtimeIds: ["xai"],
215
+ synonyms: [],
216
+ shape: {
217
+ autoSetup: "yes",
218
+ authentication: "opencode_auth_oauth_token",
219
+ quota: "remote_api",
220
+ notes: "SuperGrok OAuth via OpenCode /connect; shared weekly credit meter",
221
+ },
208
222
  },
209
- {
210
- id: "kimi-for-coding",
211
- autoSetup: "yes",
212
- authentication: "opencode_auth_api_key",
213
- authFallbacks: ["env_api_key", "global_opencode_config"],
214
- quota: "remote_api",
223
+ xiaomi: {
224
+ label: "Xiaomi MiMo",
225
+ runtimeIds: [
226
+ "xiaomi",
227
+ "xiaomi-token-plan-cn",
228
+ "xiaomi-token-plan-ams",
229
+ "xiaomi-token-plan-sgp",
230
+ ],
231
+ synonyms: ["xiaomi-token-plan-cn", "xiaomi-token-plan-ams", "xiaomi-token-plan-sgp"],
232
+ shape: {
233
+ autoSetup: "needs_quick_setup",
234
+ authentication: "state_only",
235
+ quota: "remote_api",
236
+ quickSetupAnchor: "xiaomi-mimo",
237
+ notes: "Reads the Xiaomi MiMo dashboard with a filtered trusted cookie",
238
+ },
215
239
  },
216
- {
217
- id: "deepseek",
218
- autoSetup: "yes",
219
- authentication: "opencode_auth_api_key",
220
- authFallbacks: ["env_api_key", "global_opencode_config"],
221
- quota: "remote_api",
240
+ "opencode-go": {
241
+ label: "OpenCode Go",
242
+ runtimeIds: ["opencode-go"],
243
+ synonyms: ["opencode-go-subscription"],
244
+ shape: {
245
+ autoSetup: "needs_quick_setup",
246
+ authentication: "state_only",
247
+ quota: "remote_api",
248
+ quickSetupAnchor: "opencode-go",
249
+ notes: "Scrapes the OpenCode Go dashboard; requires workspaceId and authCookie",
250
+ },
222
251
  },
223
- {
224
- id: "opencode-go",
225
- autoSetup: "needs_quick_setup",
226
- authentication: "state_only",
227
- quota: "remote_api",
228
- quickSetupAnchor: "opencode-go",
229
- notes: "Scrapes the OpenCode Go dashboard; requires workspaceId and authCookie",
252
+ opencode: {
253
+ label: "OpenCode Zen",
254
+ runtimeIds: ["opencode", "opencode-zen"],
255
+ synonyms: ["opencode-zen"],
256
+ shape: {
257
+ autoSetup: "needs_quick_setup",
258
+ authentication: "state_only",
259
+ quota: "remote_api",
260
+ quickSetupAnchor: "opencode-zen",
261
+ notes: "Scrapes the OpenCode Zen billing page; requires workspaceId and authCookie",
262
+ },
230
263
  },
231
- {
232
- id: "ollama-cloud",
233
- autoSetup: "manual_env_config",
234
- authentication: "state_only",
235
- quota: "remote_api",
236
- notes: "Scrapes the Ollama Cloud settings page; requires __Secure-session cookie via OLLAMA_USAGE_COOKIE env or ollama-usage config",
264
+ "ollama-cloud": {
265
+ label: "Ollama Cloud",
266
+ runtimeIds: ["ollama-cloud"],
267
+ synonyms: [],
268
+ shape: {
269
+ autoSetup: "manual_env_config",
270
+ authentication: "state_only",
271
+ quota: "remote_api",
272
+ notes: "Scrapes the Ollama Cloud settings page; requires __Secure-session cookie via OLLAMA_USAGE_COOKIE env or ollama-usage config",
273
+ },
237
274
  },
238
- {
239
- id: "quota-providers",
240
- autoSetup: "manual_env_config",
241
- authentication: "external_api_key",
242
- authFallbacks: ["env_api_key", "global_opencode_config"],
243
- quota: "remote_api",
244
- notes: "Aggregates exact user-configured accounting sources",
275
+ "quota-providers": {
276
+ label: "Quota providers",
277
+ runtimeIds: [],
278
+ synonyms: [],
279
+ shape: {
280
+ autoSetup: "manual_env_config",
281
+ authentication: "external_api_key",
282
+ authFallbacks: ["env_api_key", "global_opencode_config"],
283
+ quota: "remote_api",
284
+ notes: "Aggregates exact user-configured accounting sources",
285
+ },
245
286
  },
246
- ];
247
- const QUOTA_PROVIDER_SHAPES_BY_ID = Object.fromEntries(QUOTA_PROVIDER_SHAPES.map((shape) => [shape.id, shape]));
287
+ };
288
+ function catalogKeys() {
289
+ return Object.keys(PROVIDER_CATALOG_SOURCE);
290
+ }
291
+ function isCanonicalQuotaProviderId(value) {
292
+ return value in PROVIDER_CATALOG_SOURCE;
293
+ }
294
+ function buildProviderShape(id, source) {
295
+ const { recommendedReplacementId, authFallbacks, ...shape } = source.shape;
296
+ let replacementId;
297
+ if (recommendedReplacementId) {
298
+ if (!isCanonicalQuotaProviderId(recommendedReplacementId)) {
299
+ throw new Error(`Unknown quota provider replacement: ${recommendedReplacementId}`);
300
+ }
301
+ replacementId = recommendedReplacementId;
302
+ }
303
+ return {
304
+ id,
305
+ ...shape,
306
+ ...(replacementId ? { recommendedReplacementId: replacementId } : {}),
307
+ ...(authFallbacks ? { authFallbacks: [...authFallbacks] } : {}),
308
+ };
309
+ }
310
+ function completeCatalogRecord(entries) {
311
+ const record = {};
312
+ for (const [id, value] of entries)
313
+ record[id] = value;
314
+ return record;
315
+ }
316
+ export const QUOTA_PROVIDER_CATALOG = completeCatalogRecord(catalogKeys().map((id) => {
317
+ const source = PROVIDER_CATALOG_SOURCE[id];
318
+ return [
319
+ id,
320
+ {
321
+ label: source.label,
322
+ labelAliases: [...("labelAliases" in source ? source.labelAliases : [])],
323
+ runtimeIds: [...source.runtimeIds],
324
+ synonyms: [...source.synonyms],
325
+ shape: buildProviderShape(id, source),
326
+ },
327
+ ];
328
+ }));
329
+ export const QUOTA_PROVIDER_LABELS = Object.fromEntries(catalogKeys().flatMap((id) => {
330
+ const entry = QUOTA_PROVIDER_CATALOG[id];
331
+ return [[id, entry.label], ...entry.labelAliases.map((alias) => [alias, entry.label])];
332
+ }));
333
+ export const QUOTA_PROVIDER_ID_SYNONYMS = Object.fromEntries(catalogKeys().flatMap((id) => QUOTA_PROVIDER_CATALOG[id].synonyms.map((synonym) => [synonym, id])));
334
+ export const QUOTA_PROVIDER_RUNTIME_IDS = completeCatalogRecord(catalogKeys().map((id) => [id, QUOTA_PROVIDER_CATALOG[id].runtimeIds]));
335
+ export const QUOTA_PROVIDER_SHAPES = catalogKeys().map((id) => QUOTA_PROVIDER_CATALOG[id].shape);
336
+ const LIVE_LOCAL_USAGE_PROVIDER_ID_SET = new Set(catalogKeys().filter((id) => {
337
+ const source = PROVIDER_CATALOG_SOURCE[id];
338
+ return "liveLocalUsage" in source && source.liveLocalUsage === true;
339
+ }));
248
340
  export function normalizeQuotaProviderId(id) {
249
341
  const normalized = id.trim().toLowerCase();
250
342
  return QUOTA_PROVIDER_ID_SYNONYMS[normalized] ?? normalized;
251
343
  }
252
344
  export function getQuotaProviderShape(id) {
253
345
  const normalized = normalizeQuotaProviderId(id);
254
- return QUOTA_PROVIDER_SHAPES_BY_ID[normalized];
346
+ return isCanonicalQuotaProviderId(normalized)
347
+ ? QUOTA_PROVIDER_CATALOG[normalized].shape
348
+ : undefined;
255
349
  }
256
350
  export function getQuotaProviderDisplayLabel(id) {
257
351
  const normalized = normalizeQuotaProviderId(id);