@byteplus/ark-cli-darwin-x64 0.0.0-stage → 1.0.46-prerelease.dc921200a42d

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 (148) hide show
  1. package/LICENSE +201 -0
  2. package/bin/arkcli-darwin-amd64 +4 -0
  3. package/manifest.json +43 -0
  4. package/package.json +20 -4
  5. package/skills/arkcli-agent/SKILL.md +152 -0
  6. package/skills/arkcli-agent/references/agent.md +398 -0
  7. package/skills/arkcli-agent/references/byok.md +65 -0
  8. package/skills/arkcli-agent/references/context-management.md +42 -0
  9. package/skills/arkcli-agent/references/debug-export.md +26 -0
  10. package/skills/arkcli-agent/references/evals.md +178 -0
  11. package/skills/arkcli-agent/references/events-chat.md +148 -0
  12. package/skills/arkcli-agent/references/interfaces-gaps.md +52 -0
  13. package/skills/arkcli-agent/references/mcp-vault.md +111 -0
  14. package/skills/arkcli-agent/references/model-config.md +46 -0
  15. package/skills/arkcli-agent/references/self-hosted.md +47 -0
  16. package/skills/arkcli-agent/references/session-files.md +149 -0
  17. package/skills/arkcli-agent/references/session-upgrade.md +61 -0
  18. package/skills/arkcli-agent/references/skills.md +87 -0
  19. package/skills/arkcli-agent/references/todo-write.md +31 -0
  20. package/skills/arkcli-api-explorer/SKILL.md +188 -0
  21. package/skills/arkcli-api-explorer/references/arkcli-api.md +180 -0
  22. package/skills/arkcli-api-explorer/references/evals.md +176 -0
  23. package/skills/arkcli-auth/SKILL.md +184 -0
  24. package/skills/arkcli-auth/references/arkcli-auth-login.md +92 -0
  25. package/skills/arkcli-auth/references/arkcli-auth-status.md +109 -0
  26. package/skills/arkcli-auth/references/arkcli-auth-whoami.md +56 -0
  27. package/skills/arkcli-auth/references/auth-modes.md +78 -0
  28. package/skills/arkcli-auth/references/evals.md +82 -0
  29. package/skills/arkcli-auth/references/identity-resolution.md +33 -0
  30. package/skills/arkcli-auth/references/realname-gate.md +69 -0
  31. package/skills/arkcli-billing/SKILL.md +122 -0
  32. package/skills/arkcli-billing/references/arkcli-billing-list.md +259 -0
  33. package/skills/arkcli-billing/references/evals.md +107 -0
  34. package/skills/arkcli-chat/SKILL.md +114 -0
  35. package/skills/arkcli-chat/references/arkcli-chat.md +283 -0
  36. package/skills/arkcli-chat/references/caching-thinking.md +124 -0
  37. package/skills/arkcli-chat/references/chat-meta.md +77 -0
  38. package/skills/arkcli-chat/references/evals.md +34 -0
  39. package/skills/arkcli-chat/references/stream-events.md +124 -0
  40. package/skills/arkcli-chat/references/text-format.md +167 -0
  41. package/skills/arkcli-chat/references/tools.md +119 -0
  42. package/skills/arkcli-config/SKILL.md +197 -0
  43. package/skills/arkcli-config/references/arkcli-config-init.md +89 -0
  44. package/skills/arkcli-config/references/arkcli-config-profile.md +106 -0
  45. package/skills/arkcli-config/references/evals.md +154 -0
  46. package/skills/arkcli-connect/SKILL.md +196 -0
  47. package/skills/arkcli-connect/references/arkcli-connect.md +165 -0
  48. package/skills/arkcli-connect/references/evals.md +231 -0
  49. package/skills/arkcli-custommodel/SKILL.md +167 -0
  50. package/skills/arkcli-custommodel/references/arkcli-custommodel-available-quantizations.md +29 -0
  51. package/skills/arkcli-custommodel/references/arkcli-custommodel-delete.md +37 -0
  52. package/skills/arkcli-custommodel/references/arkcli-custommodel-get.md +45 -0
  53. package/skills/arkcli-custommodel/references/arkcli-custommodel-list.md +65 -0
  54. package/skills/arkcli-custommodel/references/arkcli-custommodel-quantize.md +59 -0
  55. package/skills/arkcli-custommodel/references/arkcli-custommodel-update.md +47 -0
  56. package/skills/arkcli-custommodel/references/arkcli-custommodel-upload.md +64 -0
  57. package/skills/arkcli-custommodel/references/evals.md +59 -0
  58. package/skills/arkcli-datasets/SKILL.md +39 -0
  59. package/skills/arkcli-datasets/references/commands.md +83 -0
  60. package/skills/arkcli-datasets/references/evals.md +31 -0
  61. package/skills/arkcli-deploy/SKILL.md +89 -0
  62. package/skills/arkcli-deploy/references/arkcli-deploy.md +141 -0
  63. package/skills/arkcli-deploy/references/evals.md +80 -0
  64. package/skills/arkcli-docs/SKILL.md +453 -0
  65. package/skills/arkcli-docs/references/commands.md +283 -0
  66. package/skills/arkcli-docs/references/evals.md +201 -0
  67. package/skills/arkcli-docs/references/failure-modes.md +85 -0
  68. package/skills/arkcli-doctor/CONTRIBUTING.md +54 -0
  69. package/skills/arkcli-doctor/SKILL.md +367 -0
  70. package/skills/arkcli-doctor/references/error-codes.md +162 -0
  71. package/skills/arkcli-doctor/references/evals.md +385 -0
  72. package/skills/arkcli-doctor/references/scope-account.md +94 -0
  73. package/skills/arkcli-doctor/references/scope-cli.md +88 -0
  74. package/skills/arkcli-doctor/references/scope-infer-endpoint.md +132 -0
  75. package/skills/arkcli-doctor/references/scope-metrics.md +157 -0
  76. package/skills/arkcli-doctor/references/scope-model.md +130 -0
  77. package/skills/arkcli-doctor/references/verify-origin.md +102 -0
  78. package/skills/arkcli-gen/SKILL.md +188 -0
  79. package/skills/arkcli-gen/references/arkcli-gen.md +230 -0
  80. package/skills/arkcli-gen/references/gen-meta.md +154 -0
  81. package/skills/arkcli-gen/references/image-stream.md +105 -0
  82. package/skills/arkcli-helper/SKILL.md +200 -0
  83. package/skills/arkcli-helper/references/arkcli-helper.md +298 -0
  84. package/skills/arkcli-helper/references/evals.md +334 -0
  85. package/skills/arkcli-iam/SKILL.md +46 -0
  86. package/skills/arkcli-iam/references/arkcli-iam-userid.md +54 -0
  87. package/skills/arkcli-iam/references/evals.md +24 -0
  88. package/skills/arkcli-infer-endpoint/SKILL.md +82 -0
  89. package/skills/arkcli-infer-endpoint/references/arkcli-infer-endpoint-capability-get.md +50 -0
  90. package/skills/arkcli-infer-endpoint/references/arkcli-infer-endpoint-create.md +121 -0
  91. package/skills/arkcli-infer-endpoint/references/arkcli-infer-endpoint-delete.md +71 -0
  92. package/skills/arkcli-infer-endpoint/references/arkcli-infer-endpoint-get.md +43 -0
  93. package/skills/arkcli-infer-endpoint/references/arkcli-infer-endpoint-list.md +82 -0
  94. package/skills/arkcli-infer-endpoint/references/arkcli-infer-endpoint-start.md +36 -0
  95. package/skills/arkcli-infer-endpoint/references/arkcli-infer-endpoint-stop.md +36 -0
  96. package/skills/arkcli-infer-endpoint/references/arkcli-infer-endpoint-update.md +78 -0
  97. package/skills/arkcli-infer-endpoint/references/evals.md +24 -0
  98. package/skills/arkcli-models/SKILL.md +305 -0
  99. package/skills/arkcli-models/references/arkcli-models-activate.md +103 -0
  100. package/skills/arkcli-models/references/arkcli-models-get.md +94 -0
  101. package/skills/arkcli-models/references/arkcli-models-list.md +71 -0
  102. package/skills/arkcli-models/references/arkcli-models-scenario-table.md +75 -0
  103. package/skills/arkcli-models/references/arkcli-models-search.md +170 -0
  104. package/skills/arkcli-models/references/evals.md +57 -0
  105. package/skills/arkcli-onboard/SKILL.md +169 -0
  106. package/skills/arkcli-onboard/references/evals.md +156 -0
  107. package/skills/arkcli-plans/SKILL.md +135 -0
  108. package/skills/arkcli-plans/references/arkcli-plans-buy.md +125 -0
  109. package/skills/arkcli-plans/references/arkcli-plans-get.md +84 -0
  110. package/skills/arkcli-plans/references/arkcli-plans-model-apply.md +58 -0
  111. package/skills/arkcli-plans/references/arkcli-plans-model-list.md +114 -0
  112. package/skills/arkcli-plans/references/arkcli-plans-renew.md +125 -0
  113. package/skills/arkcli-plans/references/arkcli-plans-team-rotate-apikey.md +61 -0
  114. package/skills/arkcli-plans/references/arkcli-plans-team-seat-assign.md +147 -0
  115. package/skills/arkcli-plans/references/arkcli-plans-team-seat-list.md +100 -0
  116. package/skills/arkcli-plans/references/evals.md +178 -0
  117. package/skills/arkcli-pricing/SKILL.md +120 -0
  118. package/skills/arkcli-pricing/references/arkcli-pricing-models.md +258 -0
  119. package/skills/arkcli-pricing/references/arkcli-pricing-plans.md +139 -0
  120. package/skills/arkcli-profile/SKILL.md +168 -0
  121. package/skills/arkcli-profile/references/arkcli-profile-create.md +92 -0
  122. package/skills/arkcli-profile/references/arkcli-profile-keys.md +135 -0
  123. package/skills/arkcli-profile/references/arkcli-profile-set-default.md +81 -0
  124. package/skills/arkcli-profile/references/evals.md +93 -0
  125. package/skills/arkcli-resources/SKILL.md +112 -0
  126. package/skills/arkcli-resources/references/arkcli-resources-list.md +105 -0
  127. package/skills/arkcli-shared/SKILL.md +209 -0
  128. package/skills/arkcli-shared/references/global-flags.md +77 -0
  129. package/skills/arkcli-shared/references/profile-defaults.md +35 -0
  130. package/skills/arkcli-shared/references/troubleshooting.md +49 -0
  131. package/skills/arkcli-shared/references/update.md +117 -0
  132. package/skills/arkcli-train-finetune/SKILL.md +109 -0
  133. package/skills/arkcli-train-finetune/references/create.md +274 -0
  134. package/skills/arkcli-train-finetune/references/download.md +50 -0
  135. package/skills/arkcli-train-finetune/references/evals.md +59 -0
  136. package/skills/arkcli-train-finetune/references/export-deploy.md +179 -0
  137. package/skills/arkcli-train-finetune/references/list.md +79 -0
  138. package/skills/arkcli-train-finetune/references/manage.md +140 -0
  139. package/skills/arkcli-understand/SKILL.md +105 -0
  140. package/skills/arkcli-understand/references/arkcli-understand.md +249 -0
  141. package/skills/arkcli-understand/references/evals.md +109 -0
  142. package/skills/arkcli-understand/references/sub-skills.md +137 -0
  143. package/skills/arkcli-usage/SKILL.md +123 -0
  144. package/skills/arkcli-usage/references/arkcli-usage-balance.md +196 -0
  145. package/skills/arkcli-usage/references/arkcli-usage-plan.md +153 -0
  146. package/skills/arkcli-usage/references/arkcli-usage-seats.md +199 -0
  147. package/skills/arkcli-usage/references/arkcli-usage-stats.md +160 -0
  148. package/README.md +0 -3
@@ -0,0 +1,196 @@
1
+ # usage balance
2
+
3
+ > **Prerequisite:** Read [`../arkcli-shared/SKILL.md`](../../arkcli-shared/SKILL.md) first to understand authentication, global parameters, and safety rules.
4
+
5
+ > **Difference from `stats` / `plan`:**
6
+ > - `stats`: **consumption view** (tokens/calls already used).
7
+ > - `plan`: subscription quota **snapshot** (used / total / reset).
8
+ > - `balance`: **balance view**, unified entry for "how much X remains".
9
+ >
10
+ > Use `balance` when the user asks "how much X remains", routing by `--type`.
11
+ >
12
+ > **`balance --type plan` and `usage plan` expose the same data** (both call `QueryPlanUsage`, probe two SKUs, and share flags). Projection differs:
13
+ > - `balance --type plan`: concise projection (removes `subscribed` / `updated_at` and adds a `"not subscribed"` hint).
14
+ > - `usage plan`: complete projection (includes `subscribed: true/false`, CodingPlan `updated_at`, and other metadata).
15
+ >
16
+ > Use `balance --type plan` for a balance-oriented view together with free quota or media-asset capacity. Use `usage plan` for a complete plan quota snapshot together with stats.
17
+
18
+ `arkcli usage balance` is a dispatcher; `--type` selects the data source and is **required**.
19
+
20
+ ## Commands
21
+
22
+ ```bash
23
+ # Free model inference quota/resource-pack balance (ListModelChargeItems)
24
+ arkcli usage balance --type free-quota
25
+ arkcli usage balance --type free-quota --model dola-seed-2-1-turbo
26
+ arkcli usage balance --type free-quota --modality LLM --page-size 20
27
+
28
+ # Media asset library capacity (/open/GetAssetQuota)
29
+ arkcli usage balance --type media-asset
30
+ arkcli usage balance --type media-asset --project my-project
31
+
32
+ # Subscription plan balance (QueryPlanUsage, concise output)
33
+ arkcli usage balance --type plan
34
+ arkcli usage balance --type plan --product coding-plan
35
+ arkcli usage balance --type plan --all
36
+ ```
37
+
38
+ ## Parameter allowlist
39
+
40
+ `--type` is required. Other flags are grouped by type. Passing a flag for the wrong type returns `ErrValidation` instead of being silently ignored, so users are not led to believe that an ineffective filter was applied.
41
+
42
+ | `--type` | Allowed extra flags |
43
+ |---|---|
44
+ | `free-quota` | `--model` `--modality` `--page-number` `--page-size` |
45
+ | `media-asset` | `--project` |
46
+ | `plan` | `--product` `--all` `--seat` |
47
+
48
+ ### `--type free-quota`
49
+
50
+ | Parameter | Type | Description |
51
+ |---|---|---|
52
+ | `--model` | string | One foundation model; omitted lists all activated models |
53
+ | `--modality` | string | Backend `FoundationModelDomain` enum: `LLM` / `ComputerVision` / `Audio` / `Embedding` / `Router` (**aliases are not accepted**) |
54
+ | `--page-number` | int | 1-based page number |
55
+ | `--page-size` | int | Default 50 |
56
+
57
+ ### `--type media-asset`
58
+
59
+ | Parameter | Type | Description |
60
+ |---|---|---|
61
+ | `--project` | string | Project name; defaults to the current `profile.ProjectName` |
62
+
63
+ ### `--type plan`
64
+
65
+ | Parameter | Type | Description |
66
+ |---|---|---|
67
+ | `--product` | string | `coding-plan` / `coding-plan-team` |
68
+ | `--all` | bool | Query all products even if unsubscribed; mutually exclusive with `--product` |
69
+ | `--seat` | string | Team only; filter one seat |
70
+
71
+ ## Return value
72
+
73
+ ### `--type free-quota`
74
+
75
+ ```json
76
+ {
77
+ "page_number": 1,
78
+ "page_size": 50,
79
+ "total_count": 7,
80
+ "items": [
81
+ {
82
+ "model": "dola-seed-2-1-turbo",
83
+ "display_name": "Dola-Seed-2.1-turbo",
84
+ "vendor": "Dola",
85
+ "state": "Available",
86
+ "is_overdue": false,
87
+ "free_usage": { "total": 500000, "consumed": 12345, "remaining": 487655 },
88
+ "resource_packs": [
89
+ {
90
+ "type": "FreeInference",
91
+ "total": 500000, "consumed": 12345, "remaining": 487655,
92
+ "reclaimed": 0, "sync_time": "2026-06-04T12:00:00Z"
93
+ }
94
+ ]
95
+ }
96
+ ]
97
+ }
98
+ ```
99
+
100
+ **Key definitions**:
101
+
102
+ - `free_usage.remaining = total - consumed` is already calculated; do not have the Agent recalculate it.
103
+ - Model rows with both `free_usage` and `resource_packs` empty are omitted. `pricing models` provides the complete model table.
104
+ - `resource_packs[].type` currently has only two BytePlus values: `FreeInference` (free inference) / `DataPermission` (data permission). There is no fine-tune resource pack. `Finetune` / `LoraFinetune` are unit-pricing types in `pricing models` under `ChargeItems.Type`, not balance dimensions.
105
+ - A resource pack's `remaining` may be negative after expiration or downgrade when `consumed > total`; do not clamp it.
106
+
107
+ ### `--type media-asset`
108
+
109
+ ```json
110
+ {
111
+ "tier": "advanced_monthly",
112
+ "assets": { "total": 100000, "used": 23456, "remaining": 76544, "percent": 23.456 },
113
+ "asset_groups":{ "total": 100, "used": 12, "remaining": 88, "percent": 12.0 },
114
+ "shared_pool": { "total": 1000000,"used": 0, "remaining": 1000000,"percent": 0 },
115
+ "write_qpm": 600,
116
+ "capabilities": { "liveness_writable": true, "aigc_readable": true },
117
+ "projects": [
118
+ { "project_name": "default", "used": 23456, "allocated": false, "allocation": 0 }
119
+ ],
120
+ "updated_at_ms": 1717488000123
121
+ }
122
+ ```
123
+
124
+ **Key definitions**:
125
+
126
+ - `tier`: `free` / `advanced` / `premium` / `advanced_monthly` / `premium_monthly`; monthly and annual subscriptions share these display values. An empty value means that the account has no media-asset subscription and the backend returned a zero-capacity free tier.
127
+ - **`used > total` is valid** after an expired subscription is downgraded: `tier` becomes `free`, while `used` retains its previous value. `percent` may exceed 100 and `remaining` may be negative; do not clamp either.
128
+ - `shared_pool` is omitted for accounts without the shared pool enabled because all its values are zero.
129
+ - `capabilities` lists only enabled capabilities; an empty map means that all capabilities are disabled.
130
+ - `projects[]` contains data only for enterprise accounts with project-level quota allocation enabled; it is normally empty for personal accounts.
131
+
132
+ ### `--type plan`
133
+
134
+ ```json
135
+ {
136
+ "viewer": {
137
+ "auth_method": "sso",
138
+ "user_id": "12345",
139
+ "user_name": "alice",
140
+ "is_root": false,
141
+ "profile": "my-profile",
142
+ "tenant": "byteplus",
143
+ "region": "ap-southeast-1"
144
+ },
145
+ "items": [
146
+ {
147
+ "product": "coding-plan",
148
+ "edition": "personal",
149
+ "error": "not subscribed"
150
+ }
151
+ ]
152
+ }
153
+ ```
154
+
155
+ **Key definitions**:
156
+
157
+ - **Top-level `viewer`**: identity summary for distinguishing the sub-user's own view, the root-account view, and another identity's view across SSO / AK/SK / API Key authentication. See the [`usage plan` viewer section](arkcli-usage-plan.md#viewer-fields-identity-summary).
158
+ - **Probes both SKUs by default** (personal × 1 + team × 1), retrieving every plan balance under the account in one operation. Pass `--product=X` to query only one.
159
+ - This output is **more concise than `usage plan`**: it removes the `subscribed` / `update_timestamp` metadata fields but retains `error` to distinguish "not subscribed", `AccessDenied`, and "no seat bound".
160
+ - `error: "not subscribed"` is a balance-layer hint. The raw backend response is `Subscribed=false` with empty periods, which is not sufficiently clear for users.
161
+ - **Team plans automatically resolve the caller's seat**: when `--seat` is omitted, the service calls `GetSeatInfo` to find the bound seat. If the plan is subscribed but no seat is assigned, it returns `error: "no seat bound to caller for ..."` to distinguish this case from "not subscribed".
162
+ - The `coding-plan` backend returns only `percent`; `used` / `total` are omitted through JSON `omitempty`.
163
+ - `periods[].reset_at` uses the same schema as `usage plan` and is returned in **RFC3339 Beijing time (UTC+08:00)**. It is omitted when the window contains no data.
164
+
165
+ ## Agent decisions
166
+
167
+ | User asks | Command |
168
+ |---|---|
169
+ | Which models still have free quota | `arkcli usage balance --type free-quota` |
170
+ | How many tokens model X has left | `arkcli usage balance --type free-quota --model X` |
171
+ | Media capacity remaining/full | `arkcli usage balance --type media-asset` |
172
+ | Plan remaining/reset date | `arkcli usage balance --type plan` |
173
+ | Specific product balance | `arkcli usage balance --type plan --product coding-plan-team` |
174
+ | Admin view of another seat | `arkcli usage balance --type plan --product coding-plan-team --seat <id>` |
175
+
176
+ ## Common errors
177
+
178
+ | Error | Cause | Handling |
179
+ |---|---|---|
180
+ | `--type is required` | `--type` was omitted | Choose one of `free-quota` / `media-asset` / `plan` |
181
+ | `--product is not valid for --type free-quota` | A flag was passed across types | Check that each flag matches `--type` in the allowlist above |
182
+ | Empty `tier` + all values zero | Account has no media-asset subscription | The backend returned a valid zero-capacity free tier; subscribe through the BytePlus ModelArk console if needed |
183
+ | `foundation model "X" not found in pricing list` (exit=2) | `--model X` is misspelled or absent from the pricing list | Check the spelling, or omit `--model` to list supported names |
184
+ | `free-quota` returns `items: []` | `--modality` used an alias such as `text` / `video` instead of a backend enum; this path applies when `--model` is omitted | Pass `LLM` / `ComputerVision` instead |
185
+ | Plan row has `error: "no seat bound"` | Team plan is subscribed but the caller has no assigned seat | Contact an admin to assign a seat, or explicitly pass `--seat <id>` |
186
+
187
+ ## Relation to other commands
188
+
189
+ - **Unit price** → [`arkcli pricing models`](../../arkcli-pricing/references/arkcli-pricing-models.md)
190
+ - **Complete subscription quota snapshot with `subscribed` and timestamps** → [`usage plan`](arkcli-usage-plan.md)
191
+
192
+ ## References
193
+
194
+ - [arkcli-usage](../SKILL.md) — Usage overview
195
+ - [arkcli-shared](../../arkcli-shared/SKILL.md) — Authentication/global parameters
196
+ - [arkcli-pricing](../../arkcli-pricing/SKILL.md) — Pricing catalog view
@@ -0,0 +1,153 @@
1
+ # usage plan
2
+
3
+ > **Prerequisite:** Read [`../arkcli-shared/SKILL.md`](../../arkcli-shared/SKILL.md) first to understand authentication, global parameters, and safety rules.
4
+
5
+ > **Difference from `stats` / `billing`:**
6
+ > - `usage stats`: token-billed **inference usage** (time series, 5–30 minute delay).
7
+ > - `billing list`: monthly **settlement amount** (BytePlus billing-center breakdown, T+1).
8
+ > - `usage plan`: **subscription plan quota snapshot** for CodingPlan (real-time "My plans" backend data, matching BytePlus ModelArk console 1:1).
9
+ >
10
+ > "How many tokens/requests did I use?" → stats; "How much money?" → billing; "How much plan quota remains / percentage used / reset date?" → **plan**.
11
+
12
+ Query subscription quota snapshots. A plan is not queried as a time series; it returns **used / total / reset time for the current effective subscription by window (5h / weekly / monthly / session)**.
13
+
14
+ ## Commands
15
+
16
+ ```bash
17
+ # Default: concurrently probe both products (personal × 1 + team × 1);
18
+ # issue usage requests only for detected buckets, returning all active subscription balances
19
+ arkcli usage plan
20
+
21
+ # Human-readable quota card only (no JSON; ANSI-free when piped)
22
+ arkcli usage plan --render
23
+
24
+ # Explicit product (skip discovery and query one bucket)
25
+ arkcli usage plan --product coding-plan
26
+ arkcli usage plan --product coding-plan-team
27
+
28
+ # Force both buckets (personal + team) regardless of subscription (diagnostic / Excel view)
29
+ arkcli usage plan --all
30
+
31
+ # Query a specified team seat (bypass automatic caller-seat resolution through GetSeatInfo)
32
+ arkcli usage plan --product coding-plan-team --seat seat-001
33
+ ```
34
+
35
+ ## Parameters
36
+
37
+ | Parameter | Required | Type | Description |
38
+ |------|------|------|------|
39
+ | `--product` | No | string | Explicit product ID: `coding-plan` / `coding-plan-team`; omitted means automatic subscription discovery |
40
+ | `--all` | No | bool | Force both products, including unsubscribed buckets. **Mutually exclusive with `--product`** |
41
+ | `--seat` | No | string | Team product only. Omitted: service calls `GetSeatInfo` to find caller seat; provided: skip RPC and use this SeatID (admin view) |
42
+ | `--render` | No | bool | Print only the human-readable quota card, never JSON. Uses color on a TTY and plain Unicode bars in pipes; cannot be combined with explicit `--format` or `--transform` |
43
+
44
+ ## Default behavior (no `--product` / `--all`)
45
+
46
+ Without a product, behavior is unified (`profile.Type` no longer derives one bucket; since V2, all subscriptions are probed because one identity may hold multiple products):
47
+
48
+ 1. Probe the two buckets' subscription status concurrently:
49
+ - **Personal × 1** via `ListSubscribeTrade` (`ResourceNames=[""]`).
50
+ - **Team × 1** via `GetSeatInfo(Scene="")`. The enterprise edition is not exposed through `ListSubscribeTrade` and returns null in testing, so caller-seat binding status is used instead.
51
+ 2. Send usage RPC for detected buckets:
52
+ - `coding-plan` personal → `GetCodingPlanUsage`.
53
+ - `coding-plan-team` → use resolved SeatID → `GetSeatInfoUsage(SeatID=id, Scene="")`.
54
+ 3. Failure in one bucket does not block others (per-bucket error isolation).
55
+
56
+ > **One extra RPC for zero-flag UX**: concurrent `ListSubscribeTrade × 1 + GetSeatInfo × 1` takes ~50 ms, much less than querying products serially. Pass `--product` to skip discovery.
57
+ >
58
+ > **Silent team-bucket rule**: if caller has no seat, the team bucket does **not appear** in default discovery, preventing misleading "no seat bound" for admins without enterprise purchase. Use `--all` to show both buckets including the error row.
59
+
60
+ ## Return value
61
+
62
+ JSON shape (top-level `viewer` + `items`):
63
+
64
+ ```json
65
+ {
66
+ "viewer": {
67
+ "auth_method": "sso",
68
+ "is_root": false,
69
+ "user_id": "12345",
70
+ "user_name": "alice",
71
+ "account_id": "210000",
72
+ "profile": "my-profile",
73
+ "tenant": "byteplus",
74
+ "region": "ap-southeast-1",
75
+ "project_name": "default"
76
+ },
77
+ "items": [
78
+ {
79
+ "product": "coding-plan",
80
+ "edition": "personal",
81
+ "tier": "lite",
82
+ "subscribed": true,
83
+ "periods": [...]
84
+ },
85
+ {
86
+ "product": "coding-plan-team",
87
+ "edition": "team",
88
+ "tier": "lite",
89
+ "seat_id": "seat-001",
90
+ "subscribed": true,
91
+ "periods": [...]
92
+ }
93
+ ]
94
+ }
95
+ ```
96
+
97
+ ### `viewer` fields (identity summary)
98
+
99
+ ```
100
+ viewer.auth_method = sso | aksk | apikey | none
101
+ viewer.is_root = SSO root account (JWT trn contains :root)
102
+ viewer.user_id = SSO sub-user ID (normally empty for AK/SK / APIKey)
103
+ viewer.user_name = SSO sub-user name
104
+ viewer.account_id = JWT sub claim
105
+ viewer.profile = current active profile name
106
+ viewer.tenant = byteplus
107
+ viewer.region = active region
108
+ viewer.project_name = active project
109
+ ```
110
+
111
+ **Purpose**: Sub-user and root views are easily confused. `viewer` tells the user/Agent "whose data this is":
112
+ - Sub-user SSO → `is_root=false`; user_id/name identify the sub-user, and the view shows that user's bound seat.
113
+ - Root SSO → `is_root=true`; root/account subscription view.
114
+ - AK/SK → `auth_method=aksk`, user_id normally empty; backend resolves IAM identity from AK/SK.
115
+ - APIKey → `auth_method=apikey`; scope follows the identity bound to the API Key.
116
+
117
+ ### Field descriptions
118
+
119
+ | Field | Description |
120
+ |---|---|
121
+ | `product` | `coding-plan` / `coding-plan-team`, matching `profile.Type` |
122
+ | `edition` | `personal` / `team` |
123
+ | `tier` | Actual subscription tier (`lite/pro`) returned by backend; CodingPlan often absent |
124
+ | `subscribed` | Whether current identity has an active subscription; for CodingPlan, `QuotaUsage` non-empty |
125
+ | `periods[].label` | CodingPlan: `session` / `weekly` / `monthly`, sorted canonically |
126
+ | `periods[].used` / `total` | The CodingPlan backend returns only `Percent`; `used` / `total` are omitted through JSON `omitempty` |
127
+ | `periods[].percent` | Percentage used (0–100). CodingPlan passes the backend `Percent` through directly |
128
+ | `periods[].reset_at` | Next reset time in **RFC3339 Beijing time (UTC+08:00)**. Internally, the service normalizes backend seconds to epoch milliseconds before the output layer formats them; a no-data sentinel is omitted |
129
+ | `updated_at` | CodingPlan only; backend `UpdateTimestamp` epoch ms |
130
+ | `error` | Per-bucket failure reason; one bucket does not block others. A team-product `NotImpl` error also uses this field |
131
+
132
+ ## Error handling
133
+
134
+ - **AccessDenied/network**: written to corresponding `items[].error`; other buckets unaffected.
135
+ - **Unsubscribed**: empty CodingPlan `QuotaUsage` → `subscribed:false`.
136
+ - **Team subscribed but caller has no seat**: `subscribed:true` + `error:"no seat bound to caller for ..."`; pass `--seat <id>` to bypass.
137
+ - **Product typo**: outside the `coding-plan` / `*-team` set → `ErrValidation` immediately, without sending a request.
138
+ - **`--all` + `--product`**: mutually exclusive ErrValidation.
139
+ - **All auto-discovery fails**: returns `auto-discover subscriptions: <err>` (for example, backend rejection such as `MissingParameter.ResourceNames`); use explicit `--product`.
140
+
141
+ ## AI Agent decision path
142
+
143
+ - "How much plan used/remains?" → `arkcli usage plan`.
144
+ - "How many plans do I have?" → `arkcli usage plan --all`; buckets with `subscribed=true` are held.
145
+ - "Admin view of another team seat" → `arkcli usage plan --product coding-plan-team --seat <id>`.
146
+ - "Why are plan items empty?" → probably no products under current identity; route to [arkcli-pricing](../../arkcli-pricing/SKILL.md) for catalog pricing.
147
+
148
+ ## API alignment
149
+
150
+ - CodingPlan personal: `/open/GetCodingPlanUsage`.
151
+ - CodingPlan team: `/open/GetSeatInfoUsage`.
152
+ - Auto-discovery uses a `ListSubscribeTrade` payload for personal × 1. The enterprise edition is not exposed through `ListSubscribeTrade`, so `GetSeatInfo(Scene)` probes the caller's seat-binding status instead.
153
+ - Team SeatID resolution: `/open/GetSeatInfo` without a SeatID resolves the bound seat from caller identity + Scene. Scene **must be an empty string** (CodingPlan enterprise; this is the backend default). Early use of `coding_plan` returned an empty SeatID without an error.
@@ -0,0 +1,199 @@
1
+ # usage seats
2
+
3
+ > **Prerequisite:** Read [`../arkcli-shared/SKILL.md`](../../arkcli-shared/SKILL.md) first to understand authentication, global parameters, and safety rules.
4
+
5
+ > **Difference from other commands:**
6
+ > - `usage plan` / `balance --type plan`: the **caller's own** subscription balance (a sub-user views their own seat).
7
+ > - `usage seats`: **admin view** listing **all seats** in a team.
8
+ >
9
+ > Sub-users normally receive `AccessDenied`; admin/root SSO is required.
10
+
11
+ ## Commands
12
+
13
+ ```bash
14
+ arkcli usage seats --product coding-plan-team \
15
+ [--biz-info lite|pro] \
16
+ [--billing-status Pending|Running|Expired|Reclaimed] \
17
+ [--seat-status Idle|Active] \
18
+ [--user-id <id>] [--user-name <name>] [--seat-id <id>] \
19
+ [--project <project>] [--with-usage]
20
+
21
+ # List all CodingPlan team seats
22
+ arkcli usage seats --product coding-plan-team
23
+
24
+ # Filter by BizInfo tier
25
+ arkcli usage seats --product coding-plan-team --biz-info lite
26
+
27
+ # Filter by BillingStatus (prepare reclaimed seats for cleanup)
28
+ arkcli usage seats --product coding-plan-team --billing-status Reclaimed
29
+
30
+ # Query the seat bound to a specified sub-user
31
+ arkcli usage seats --product coding-plan-team --user-id 12345
32
+ arkcli usage seats --product coding-plan-team --user-name alice
33
+
34
+ # Multiple users (client-side parallel fan-out and merge)
35
+ arkcli usage seats --product coding-plan-team --user-name alice --user-name bob --user-name charlie
36
+
37
+ # Cross-field combination = AND (Alice's seats whose status is Running)
38
+ arkcli usage seats --product coding-plan-team --user-name alice --billing-status Running
39
+
40
+ # Single page (disable auto-pagination)
41
+ arkcli usage seats --product coding-plan-team --page-number 1 --page-size 50
42
+
43
+ # === --with-usage: also retrieve each seat's usage ===
44
+ arkcli usage seats --product coding-plan-team --with-usage # Percent only (CodingPlan backend exposes only percentage)
45
+ ```
46
+
47
+ ## Parameters
48
+
49
+ | Parameter | Required | Type | Description |
50
+ |---|---|---|---|
51
+ | `--product` | Yes | string | Team plan ID: `coding-plan-team`. **Personal plans are unsupported** because they have no seat concept |
52
+ | `--biz-info` | No | string | Tier filter: `lite/pro` (CodingPlan) |
53
+ | `--billing-status` | No | string slice | Billing status filter (repeatable): `Pending` / `Running` / `Expired` / `Reclaimed` |
54
+ | `--seat-status` | No | string | Seat status: `Idle` / `Active`. `Idle` means unbound and available; `Active` means bound |
55
+ | `--user-id` | No | string slice | Filter by sub-user ID (repeatable; more than one value triggers client-side parallel fan-out) |
56
+ | `--user-name` | No | string slice | Filter by sub-user name (repeatable; more than one value triggers client-side parallel fan-out) |
57
+ | `--seat-id` | No | string slice | Specify a SeatID (repeatable; sent as a native wire array in one call) |
58
+ | `--project` | No | string | Project filter; defaults to the active profile's project when omitted |
59
+ | `--page-size` | No | int | Page size; default 100 |
60
+ | `--page-number` | No | int | 1-based page number; **explicitly setting it disables auto-pagination** and retrieves only that page |
61
+ | `--sort-by` / `--sort-order` | No | string | Sort field / ascending or descending order |
62
+ | `--with-usage` | No | bool | **Team products only**: join each seat's usage. CodingPlan team uses `ListSeatInfoUsages` and returns `coding_usage{periods[session/weekly/monthly with percent/reset_at]}`. `reset_at` is returned in RFC3339 Beijing time (UTC+08:00) |
63
+
64
+ Unknown seat or billing status values fail validation and never degrade to an unfiltered query.
65
+
66
+ ## Default behavior: auto-pagination
67
+
68
+ Without `--page-number`, the service layer automatically follows `NextToken` until the last page (maximum 30 pages × 100 = 3,000 seats). Reaching the limit reports an error and directs the user to paginate manually.
69
+
70
+ ## Multi-value filter semantics
71
+
72
+ Different flags have an **AND** relationship: each flag is a narrowing filter, as in a SQL `WHERE` clause or kubectl `-l`. Multiple values for the same flag have an **OR** relationship.
73
+
74
+ | Example | Semantics | Wire calls |
75
+ |---|---|---|
76
+ | `--seat-id sa --seat-id sb` | seat ∈ {sa, sb} | One native `Filter.SeatIDs:["sa","sb"]` call |
77
+ | `--user-name a --user-name b` | user = a OR user = b | **Two parallel calls** (client-side fan-out; wire `Filter.UserName` is scalar and does not accept an array) |
78
+ | `--seat-id sa --user-name a` | seat ∈ {sa} AND user = a | One call |
79
+ | `--seat-id sa --user-name a --user-name b` | seat ∈ {sa} AND user ∈ {a,b} | Two calls, each with same SeatIDs |
80
+ | `--user-name alice --billing-status Reclaimed` | user = alice AND billing = Reclaimed | One call |
81
+
82
+ Equivalent SQL: `WHERE seat_id IN (...) AND user_name IN (...) AND billing_status IN (...)`.
83
+
84
+ ### The union you do not get—intentionally
85
+
86
+ ```bash
87
+ # Does not return the union of seat sa plus all of Alice's seats
88
+ arkcli usage seats --seat-id sa --user-name alice
89
+ # Actual: only sa, and only if it belongs to Alice
90
+ ```
91
+
92
+ To request the union of "seat sa **or** Alice's seats", run two commands and merge the results on the client:
93
+
94
+ ```bash
95
+ { arkcli usage seats --product ... --seat-id sa
96
+ arkcli usage seats --product ... --user-name alice; } | jq -s '...'
97
+ ```
98
+
99
+ The CLI intentionally avoids implicit OR. Its filter safety contract is that filters can only narrow results; unexpectedly broadening results can cause incorrect statistics or cleanup.
100
+
101
+ ### What fan-out means
102
+
103
+ You only need this detail when working directly with the wire API. Wire `Filter.UserID / UserName` fields are scalar, and arrays are rejected with `InvalidParameter`. For multiple users, the service layer starts N goroutines, sends one scalar RPC for each user, deduplicates the client-side results by `SeatID`, and merges them. Consequences:
104
+
105
+ - **Latency** = the slowest of N concurrent requests, not their sum.
106
+ - **Backend load** = N times. Dozens of users are acceptable; for hundreds, use `--all` and filter on the client.
107
+ - **Consistency** = separate calls have a seconds-level time window, so a race is theoretically possible if a seat is unbound during the query. This is acceptable for admin inventory.
108
+ - If any user query fails, the entire request fails and identifies which user failed; no partial results are returned.
109
+
110
+ ## Return value
111
+
112
+ ```json
113
+ {
114
+ "items": [
115
+ {
116
+ "seat_id": "seat-001",
117
+ "account_id": "210000",
118
+ "project_name": "default",
119
+ "biz_info": "lite",
120
+ "billing_status": "Running",
121
+ "seat_status": "Active",
122
+ "identity_type": "IAMUser",
123
+ "instance_id": "inst-xxx",
124
+ "order_time": 1700000000000,
125
+ "expired_time": 1717000000000,
126
+ "create_time": 1700000000000,
127
+ "update_time": 1716000000000
128
+ }
129
+ ],
130
+ "total": 30,
131
+ "biz_summaries": [
132
+ { "biz_info": "lite", "total_count": 30, "active_count": 25 }
133
+ ]
134
+ }
135
+ ```
136
+
137
+ ### Fields
138
+
139
+ | Field | Meaning |
140
+ |---|---|
141
+ | `seat_id` | Unique seat identifier |
142
+ | `biz_info` | Tier |
143
+ | `billing_status` | Billing status (`Running` is billed; `Reclaimed` has been reclaimed) |
144
+ | `seat_status` | Binding status: `Idle` is unbound and available; `Active` is bound |
145
+ | `identity_type` | Bound identity type (e.g. `IAMUser`) |
146
+ | `order_time` / `expired_time` | Order / expiration time in epoch milliseconds |
147
+ | `total` | Total number of records matching the filters according to the backend |
148
+ | `biz_summaries[]` | Summary by tier; for example, 30 `lite` seats purchased and 25 activated |
149
+
150
+ > **BytePlus seat item does not carry `user_id`, `user_name`, or `bind_count`.** The `identity_type` field indicates the identity class, but the seat listing itself does not expose which named sub-user is bound to each seat, nor the current-month binding count. Consumers that need "which seat belongs to which employee" must correlate `seat_id` with an external identity source (organization roster, IAM API), or filter with `--user-id` / `--user-name` (see next section for filter-side caveats).
151
+
152
+ ## Admin workflows
153
+
154
+ **Scenario 1**: View the team's overall subscription status
155
+
156
+ ```bash
157
+ arkcli usage seats --product coding-plan-team
158
+ # Use biz_summaries to see how many seats were purchased and activated in each tier
159
+ ```
160
+
161
+ **Scenario 2**: Find reclaimed (expired) seats for processing
162
+
163
+ ```bash
164
+ arkcli usage seats --product coding-plan-team --billing-status Reclaimed
165
+ ```
166
+
167
+ **Scenario 3**: Find the seats bound to a specific sub-user
168
+
169
+ ```bash
170
+ arkcli usage seats --product coding-plan-team --user-name alice
171
+ ```
172
+
173
+ The filter narrows the returned list to seats bound to Alice, but the returned rows themselves do **not** carry `user_name` — the caller only sees `seat_id` and cannot use the response alone to confirm "this specific seat belongs to Alice" for a multi-seat result set. If the user needs a seat→employee mapping in the output, correlate with an external identity source.
174
+
175
+ **Scenario 4**: Check the current state of specified SeatIDs
176
+
177
+ ```bash
178
+ arkcli usage seats --product coding-plan-team --seat-id seat-001 --seat-id seat-002
179
+ ```
180
+
181
+ ## Common errors
182
+
183
+ | Error | Cause | Handling |
184
+ |---|---|---|
185
+ | `--product is required and must be a team plan` | Missing or set to a personal plan | Pass `coding-plan-team` |
186
+ | `AccessDenied` | Caller is not an admin | Ask an admin to run the command, or have the sub-user use `usage plan` to view their own seat |
187
+ | `exceeded auto-paginate limit (30 pages)` | Team has more than 3,000 seats | Paginate manually with `--page-number` |
188
+
189
+ ## Relation to other commands
190
+
191
+ - Sub-user's own seat → [`usage plan`](arkcli-usage-plan.md) / [`usage balance --type plan`](arkcli-usage-balance.md)
192
+ - Account-level model free quota → [`usage balance --type free-quota`](arkcli-usage-balance.md)
193
+
194
+ ## API alignment
195
+
196
+ - Wire path: `/open/ListSeatInfos` (OpenAPI). `--with-usage` makes an additional call:
197
+ - CodingPlan team → `/open/ListSeatInfoUsages` (SeatIDs are required, collected from `ListSeatInfos`, and passed in batches of no more than 1,000).
198
+ - Pagination uses `NextToken` (cursor), not PageNum.
199
+ - On BytePlus, `ListSeatInfos` returns seat metadata (`seat_id`, tier, status, lifecycle timestamps) but omits identity-detail fields such as the bound sub-user's ID/name and the current-month binding count. `--user-id` / `--user-name` still filter at the wire level, but the response body does not echo those values back.