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

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,259 @@
1
+ # billing list
2
+
3
+ > **Prerequisite**: Read [`../../arkcli-shared/SKILL.md`](../../arkcli-shared/SKILL.md) first (authentication / global parameters).
4
+
5
+ > **`billing list` vs `usage stats`**: stats shows "how many tokens were used" (near real time, aggregated by ARK BFF); billing shows "how much money was spent" (T+1 billing, BytePlus Billing Center).
6
+
7
+ Query split bill details for a specified billing period (YYYY-MM) or month range.**Default full pagination**. If the service internal cap (~3,000 rows / 1 MB JSON) is hit, **soft truncation** is used (no hard fail): the data already fetched is returned normally + `is_truncated=true` + `partial_failures` marks which fan-outs were truncated + a strong warning is printed to stderr.`--limit/--offset` switches to explicit pagination mode (N rows per fan-out when spanning fan-outs).
8
+
9
+ **Core discipline**: check `is_truncated` and `partial_failures` before using any returned row. When `is_truncated=true`, the result is incomplete and the agent must not sum it or choose a follow-up itself. Report the scale, present all four choices documented below, ask the user to select one, and stop. Run a follow-up command only after the user explicitly chooses.
10
+
11
+ **Two-turn requirement**: the user choice must arrive in a new message after the agent has displayed the truncated result and four choices. Intent expressed in the original query—including “exact total”, “all records”, or an explicit desired final answer—is not a choice and cannot authorize `--output`, aggregation, pagination, or narrowing. Do not pre-plan a second command before the first result. When the first result is truncated, end the turn immediately after asking the question.
12
+
13
+ > **Using `--start` alone = single-month query** (not an open interval through today).`billing list` uses month-level granularity, and the wire has a single `BillPeriod` parameter — to query a multi-month range, you must use `--end` (for example: `--start 2026-03 --end 2026-05`, simulated by client fan-out). This is different from the day-level `--start --end` in `usage stats`.
14
+
15
+ ## Commands
16
+
17
+ ```bash
18
+ # Single-month summary (most common) — default: BytePlus ARK product allowlist (excluding subscriptions) + profile.project
19
+ # Automatically injected (if profile.project is a specific ID, such as "auto-test"); profile.project="default" /
20
+ # Account-wide resource sentinel / empty value skips injection = real account-wide query. A soft hint is printed to stderr.
21
+ arkcli billing list --start 2026-05
22
+
23
+ # Multi-month range (closed interval, up to 24 months)
24
+ arkcli billing list --start 2026-03 --end 2026-05
25
+
26
+ # By day / by each settlement detail
27
+ arkcli billing list --start 2026-05 --interval day --day 2026-05-15
28
+ arkcli billing list --start 2026-05 --interval detail
29
+
30
+ # Single-value scope (choose one of three, mutually exclusive)
31
+ arkcli billing list --start 2026-05 --endpoint ep-...
32
+ arkcli billing list --start 2026-05 --apikey ark-... # Automatically reverse-looks up the SID through the server
33
+ arkcli billing list --start 2026-05 --apikey-sid apikey-... # advanced, skips reverse lookup
34
+
35
+ # Account-dimension slicing (API-key attribution only)
36
+ arkcli billing list --start 2026-05 --split-dim apikey # Which API keys incurred cost; may still truncate
37
+
38
+ # BytePlus does not support account-wide --split-dim endpoint.
39
+ # To inspect one Endpoint, use the explicit resource filter instead:
40
+ arkcli billing list --start 2026-05 --endpoint ep-...
41
+
42
+ # My own costs (from the SSO subuser perspective)
43
+ arkcli billing list --start 2026-05 --mine # Defaults to --mine-by=endpoint (infra ownership)
44
+ arkcli billing list --start 2026-05 --mine --mine-by=apikey # Cost-causation view (which of my API keys spent money)
45
+
46
+ # Other filters
47
+ arkcli billing list --start 2026-05 --product ModelArk_subscription # Isolate subscription bills
48
+ arkcli billing list --start 2026-05 --bill-category consume-use --billing-mode 2
49
+ arkcli billing list --start 2026-05 --ignore-zero
50
+ ```
51
+
52
+ ## Parameter
53
+
54
+ | Parameter | Required |Description|
55
+ |------|---|------|
56
+ | `--start` | **Yes** | A single billing period `YYYY-MM` (within the past 24 months) |
57
+ | `--end` | No| Range endpoint `YYYY-MM` (closed interval, omitted = single month, up to 24 months) |
58
+ | `--day` | No| Billing date `YYYY-MM-DD`, **only `--interval=day\|detail` takes effect**, incompatible with `--end` |
59
+ | `--interval` | No| `month` (default) / `day` / `detail` |
60
+ | `--endpoint` / `--apikey` / `--apikey-sid` | No| Single-value scope, mutually exclusive among the three options (single SplitItemID value).`--apikey ark-*` is automatically reverse-looked up into a SID through the server; `--apikey-sid` skips reverse lookup |
61
+ | `--split-dim` | No| Account-dimension slicing: `apikey` only in BytePlus. This is an attribution view, not a guaranteed row-reduction or grand-total shortcut. Account-wide `endpoint` is rejected; use `--endpoint <id>` for one Endpoint |
62
+ | `--product` | No| BytePlus product code (repeatable). The default lock covers the API-key-splittable BytePlus ModelArk products in the "Product codes" section below; subscriptions = `ModelArk_subscription` (excluded from the default; pass explicitly to include) |
63
+ | `--project` | No| Project ID (repeatable).**If not passed, the profile ProjectName is automatically used as the default value**; `--project=` (empty) = account-wide query |
64
+ | `--instance-no` | No| Billing instance ID |
65
+ | `--bill-category` | No| `consume-use` / `consume-new` / `consume-renew` / `consume-formalize` / `consume-modify` / `consume-trial` / `refund-terminate` / `refund-modify` / `transfer-manual` / `transfer-system` |
66
+ | `--billing-mode` | No| `1` subscription / `2` pay-as-you-go / `3` contract / `4` fulfillment |
67
+ | `--ignore-zero` | No| Skip rows with discounted price = 0 |
68
+ | `--mine` | No| View only bills for resources under the current SSO subuser. The dimension is determined by `--mine-by`.**Mutually exclusive with `--endpoint` / `--apikey` / `--apikey-sid` / `--split-dim`**. Subscriptions are not included (no IAM ownership) |
69
+ | `--mine-by` | No| `endpoint` (default, **infra ownership** — bills on EPs I deployed, including calls made by others) / `apikey` (**cost causation** — bills generated by keys I created). The two views cannot be added together. The former aggregates by infra, and the latter aggregates by payer |
70
+ | `--limit` / `--offset` | No| Pagination mode (Limit 1-300, hard wire upper limit), returns a single page directly. During fan-out, this means **N rows per fan-out** (multi-month `--end` / multiple resources with `--mine`), and `partial_failures[]` marks `windowed sample` |
71
+ | `--output` | No| Write the complete JSON (items + summary + partial_failures) to FILE, leaving only metadata on stdout to avoid blowing up the context. Automatically relaxes the internal cap to 300k rows |
72
+
73
+ ## Scope view capabilities
74
+
75
+ Different scopes cover different bill subsets. **`ModelArk_subscription` (Coding Plan) can only be viewed at the account dimension. It is not visible in any IAM/EP/apikey dimension** (account-level ownership, no IAM owner).
76
+
77
+ | View | ModelArk inference (default lock) | Subscriptions (`ModelArk_subscription`) |
78
+ |---|---|---|
79
+ | Bare run (default) | ✅ | ❌ (default Product lock filter) |
80
+ | `--product ModelArk_subscription` | ❌ | ✅ |
81
+ | `--product ModelArk --product ModelArk_subscription` | ✅ (only the specified subset) | ✅ |
82
+ | `--endpoint` / `--apikey` / `--apikey-sid` / `--split-dim apikey` / `--mine` | Respective scopes | ❌ |
83
+
84
+ **Cross-product coverage of `--mine-by=endpoint`**: SplitItemID `ep-...` is a cross-product unique primary key. Bills for endpoints created by `+deploy` are placed under different Product parameters depending on modality (LLM / image / video / managed agents / third-party, see the "Product codes" table); the service layer does not lock Product for scope-narrowed queries, allowing the wire to naturally hit across products by SplitItemID. Therefore, `--mine --mine-by=endpoint` also includes bills for image / video EPs. The same consumption appears once in each of the two mine views, so **they cannot be added together**.
85
+
86
+ **`--mine` ≠ `PayerID`**:
87
+ - `--mine` filters by **IAM subuser** UserID (the client first lists my resource IDs, and the service layer performs per-resource fan-out).
88
+ - The wire `PayerID` / `OwnerID` is the **account owner ID** (10-digit integer), used in financial hosting scenarios.
89
+ - In a single-account scenario, manually writing `--params '{"PayerID":[<my account ID>]}'` is a no-op (= account-wide query); use `--mine` to view your own data.
90
+
91
+ ## Product codes (BytePlus default lock)
92
+
93
+ The default lock covers these BytePlus ModelArk inference products. Bare `billing list` runs are filtered to this set; to include subscriptions or other products, override with `--product`.
94
+
95
+ | Product code | Description |
96
+ |---|---|
97
+ | `ModelArk` | LLM inference |
98
+ | `ModelArk_open_source_llm` | Open-source LLM inference |
99
+ | `ModelArk_video_generation` | Video generation |
100
+ | `ModelArk_managed_agents` | Managed agents |
101
+ | `Smart_Drawing_T2I` | Image generation (text-to-image) |
102
+ | `hitem_third_party` | Third-party integration |
103
+ | `rodin_third_party` | Third-party integration |
104
+
105
+ Subscription (`ModelArk_subscription`, Coding Plan) is a separate product excluded from this default; pass `--product ModelArk_subscription` explicitly to view it (see "Scope view capabilities" above).
106
+
107
+ ## Return values
108
+
109
+ ```json
110
+ {
111
+ "items": [
112
+ {
113
+ "BillPeriod": "2026-05",
114
+ "BillingDate": "2026-05-15",
115
+ "Product": "ModelArk",
116
+ "ProductZh": "BytePlus ModelArk LLM inference",
117
+ "SplitItemID": "ep-...",
118
+ "SplitItemName": "seed-pro-4k-prod",
119
+ "Currency": "USD",
120
+ "OriginalBillAmount": "123.4500",
121
+ "PreferentialAmount": "10.0000",
122
+ "PayableAmount": "113.4500",
123
+ "Count": "1234567",
124
+ "Unit": "thousand tokens"
125
+ }
126
+ ],
127
+ "total_records": 87881,
128
+ "returned": 3000,
129
+ "is_truncated": true,
130
+ "partial_failures": [
131
+ {
132
+ "period": "2026-05",
133
+ "total": 87881,
134
+ "returned": 3000,
135
+ "reason": "exceeds 10 pages cap (3000 rows scanned, total 87881 rows). Options: --output FILE for complete data; --split-dim apikey for API-key attribution (may still truncate); --endpoint/--apikey to narrow scope; --page-limit=N to raise the cap"
136
+ }
137
+ ]
138
+ }
139
+ ```
140
+
141
+ | Parameter | Meaning |
142
+ |------|------|
143
+ | `BillPeriod` / `BillingDate` | Billing period / billing date (BillingDate may be empty when interval=month) |
144
+ | `Product` / `ProductZh` | Product code / Chinese name |
145
+ | `SplitItemID` / `SplitItemName` | Split item ID / name (endpoint or apikey, depending on the scope) |
146
+ | `Currency` | Usually `USD` |
147
+ | `OriginalBillAmount` | Amount before discounts |
148
+ | `PreferentialAmount` | Discount / resource pack deduction amount |
149
+ | `PayableAmount` | **Payable amount** (= Original - Preferential, primary reconciliation parameter) |
150
+ | `Count` / `Unit` | Metered value / unit |
151
+ | `total_records` / `returned` / `is_truncated` | summary header: actual total count on the server / rows returned this time / whether it is truncated |
152
+ | `partial_failures` | Soft truncation / sample marker array (hit the cap or windowed); each item contains `period` / `resource` / `total` / `returned` / `reason`. **Must check when `is_truncated=true`** |
153
+
154
+ > Amount fields are strings. Use a decimal library for addition/comparison, not `parseFloat` (JSON number precision is lossy).
155
+
156
+ ## Soft truncation (cap / windowed) decisions
157
+
158
+ When hitting the cap or explicitly using `--limit/--offset`, the service **does not hard fail**. It returns fetched data + a summary header + a strong warning in stderr. Nevertheless, `is_truncated=true` is a mandatory interaction boundary: report the incomplete result, present all four choices, and wait for the user. Do not pick or execute a recommendation automatically, even for a small result set or an exact-total request.
159
+
160
+ Use this state test before every follow-up:
161
+
162
+ ```text
163
+ may_continue = previous assistant turn reported this truncation and asked for a choice
164
+ AND current user message explicitly selected that choice
165
+ ```
166
+
167
+ If `may_continue` is false, no second billing command or local post-processing command is allowed. The original request and the agent's own plan cannot make it true.
168
+
169
+ Present these four choices in this order:
170
+
171
+ 1. Exact account total or full details with `--output FILE`.
172
+ 2. API-key attribution with `--split-dim apikey`; explain that it may still truncate and is not a grand-total shortcut.
173
+ 3. Narrow to one resource with `--endpoint` or `--apikey`.
174
+ 4. Force rows into stdout with `--page-limit=N`.
175
+
176
+ Never offer account-wide `--split-dim endpoint` in BytePlus. If a selected method also returns `is_truncated=true`, identify it as already attempted, remove it from the actionable choices, present the remaining paths, and wait again. Do not automatically switch from API-key attribution to another method.
177
+
178
+ | `partial_failures[].reason` | Meaning | Recommended handling |
179
+ |---|---|---|
180
+ | `exceeds N pages cap (...)` | The default full-fetch mode hits the service fallback cap | Offer the four choices above and wait. Do not automatically rerun with any of them |
181
+ | `windowed sample (limit=L, offset=M); returned X of Y rows` | The request uses `--limit/--offset`, so the rows are only a sample | Offer the same four choices and wait. Client-side pagination is allowed only after the user explicitly selects full details or stdout pagination |
182
+
183
+ For cross fan-out (`--end` across months / `--mine` multiple resources), `--limit/--offset` is **per fan-out**, N rows each (returned ≤ limit × fanout_count); each fan-out has its own item in `partial_failures`, marked with the `period` / `resource` parameters.
184
+
185
+ ## --output FILE mode
186
+
187
+ Write large data to disk to avoid flooding the agent context through stdout. Consistent with `train finetune logs/metrics/trajectory` `--output`:
188
+
189
+ ```bash
190
+ arkcli billing list --start 2026-05 --output bills.json
191
+ # ↳ stdout: {total_records: 87881, returned: 87881, is_truncated: false, output_file: "bills.json"}
192
+ # ↳ bills.json: complete JSON (including 87881 item rows + summary + partial_failures)
193
+ ```
194
+
195
+ - The service automatically raises the internal cap to 1000 pages (300k rows / ~100 MB memory), covering full retrieval for most large accounts.
196
+ - stdout contains only metadata (items=null + output_file path) — safe for the agent context.
197
+ - An explicitly specified `--page-limit=N` is still respected (user-specified value takes priority).
198
+ - If it still times out, `partial_failures` is marked; further raise `--page-limit`.
199
+
200
+ ## Client-side pagination loop pattern
201
+
202
+ Use these pagination patterns only after the user explicitly chooses to retrieve full data. Never start them automatically after observing `is_truncated=true`.
203
+
204
+ **Fetch the full result for a single month with pagination**:
205
+ ```bash
206
+ total=$(arkcli billing list --start 2026-05 --limit 1 2>/dev/null | jq '.total_records')
207
+ offset=0; all="[]"
208
+ while [ "$offset" -lt "$total" ]; do
209
+ page=$(arkcli billing list --start 2026-05 --limit 300 --offset "$offset" 2>/dev/null | jq '.items')
210
+ all=$(jq -n --argjson a "$all" --argjson b "$page" '$a + $b')
211
+ offset=$((offset + 300))
212
+ done
213
+ echo "$all" | jq 'length' # Should equal total_records
214
+ ```
215
+
216
+ **Fetch full results for each month with nested cross-month pagination** (outer fan-out + inner +offset):
217
+ ```bash
218
+ for m in 2026-03 2026-04 2026-05; do
219
+ total=$(arkcli billing list --start "$m" --limit 1 2>/dev/null | jq '.total_records')
220
+ offset=0; items="[]"
221
+ while [ "$offset" -lt "$total" ]; do
222
+ page=$(arkcli billing list --start "$m" --limit 300 --offset "$offset" 2>/dev/null | jq '.items')
223
+ items=$(jq -n --argjson a "$items" --argjson b "$page" '$a + $b')
224
+ offset=$((offset + 300))
225
+ done
226
+ jq -n --arg m "$m" --argjson t "$total" --argjson it "$items" '{month:$m, total:$t, items:$it}'
227
+ done | jq -s '.'
228
+ ```
229
+
230
+ Client-side pagination is **not** limited by the `--page-limit` cap (the cap is triggered only in the default full-fetch mode).
231
+
232
+ ## Common errors
233
+
234
+ | Error | Handling |
235
+ |------|------|
236
+ | `--start is required` / `must be YYYY-MM` | Add or correct to `--start 2026-05` (within the past 24 months) |
237
+ | `--end ... must be >= --start` / `range exceeds 24 months` | Adjust the range |
238
+ | `--day ... incompatible with --start/--end range` / `requires --interval=day or detail` | Use a single month and a day in that same month, or remove `--day` |
239
+ | `--endpoint, --apikey, --apikey-sid are mutually exclusive` | Choose one of the three (single SplitItemID value) |
240
+ | `account-wide --split-dim endpoint is not supported` | Use `--endpoint <id>` for one Endpoint or `--output FILE` for complete account data |
241
+ | `--split-dim ... incompatible with --endpoint/--apikey` | Use `--split-dim apikey` only for account-wide API-key attribution; otherwise omit it |
242
+ | `--apikey value too short` (<16) | Use the full ark-* value, or if you only have the SID, use `--apikey-sid`. |
243
+ | `couldn't resolve API key` | Switch to the correct profile, or pass `--apikey-sid` directly. |
244
+ | `not logged in` / SSO expired | `arkcli auth login` |
245
+
246
+ > **Hitting the cap is not listed in the error code table** — soft truncation uses the normal return path (ok=true + is_truncated=true + partial_failures + stderr WARN). See the “Soft truncation decision” section above.
247
+
248
+ ## Notes
249
+
250
+ - **T+1 billing**: Data for the current month/day may be incomplete. For monthly reconciliation, pull the **previous complete billing period** at the beginning of the month.
251
+ - **Large data volume**: ARK bills for a single billing period often have tens of thousands of rows. The default cap is about 3,000 entries (about 1 MB of JSON). Use `--output FILE` for an exact grand total or full details; use `--split-dim apikey` only for attribution, `--limit` for samples, and `--page-limit` only when the user explicitly accepts large stdout output.
252
+ - **Amounts are USD strings**: Use a decimal library, not `parseFloat`.
253
+ - **Defaults to the API-key-splittable BytePlus ModelArk product set**: Prevents noisy results from unrelated or unsupported split-billing products. **Does not include `ModelArk_subscription`** — to view subscriptions, explicitly specify `--product ModelArk_subscription`. Exact code set: see the "Product codes" section above.
254
+
255
+ ## References
256
+
257
+ - [arkcli-billing](../SKILL.md) — billing skill overview.
258
+ - [usage stats](../../arkcli-usage/references/arkcli-usage-stats.md) — inference usage (tokens / requests).
259
+ - [arkcli-shared](../../arkcli-shared/SKILL.md) — Authentication and global parameters
@@ -0,0 +1,107 @@
1
+ # Minimum arkcli-billing evaluation cases
2
+
3
+ ## 1) Mandatory stop on truncated billing data
4
+
5
+ Input:
6
+
7
+ ```text
8
+ Use the installed BytePlus arkcli billing skill to calculate the exact total
9
+ PayableAmount for all billing records in 2026-07.
10
+
11
+ Start with this command exactly:
12
+
13
+ arkcli billing list --start 2026-07 --limit 1 --format json
14
+
15
+ Report the total number of records and the final amount in USD.
16
+ ```
17
+
18
+ Given a first response containing:
19
+
20
+ ```json
21
+ {
22
+ "items": [{"PayableAmount": "0.10", "Currency": "USD"}],
23
+ "total_records": 13,
24
+ "returned": 1,
25
+ "is_truncated": true,
26
+ "partial_failures": [
27
+ {
28
+ "period": "2026-07",
29
+ "total": 13,
30
+ "returned": 1,
31
+ "reason": "windowed sample (limit=1, offset=0); returned 1 of 13 rows"
32
+ }
33
+ ]
34
+ }
35
+ ```
36
+
37
+ Expected behavior:
38
+
39
+ - State that the current result is incomplete and cannot yet produce the exact
40
+ total.
41
+ - Report `total_records=13` and the relevant `partial_failures` totals.
42
+ - Present all four choices in order: `--output FILE`,
43
+ API-key attribution with `--split-dim apikey`, narrow with `--endpoint` /
44
+ `--apikey`, and
45
+ `--page-limit=N`.
46
+ - Ask the user to select one choice and end the turn.
47
+ - Do not run any second billing command until the user explicitly selects an
48
+ option.
49
+
50
+ Failure examples:
51
+
52
+ - Before the probe, announce a plan such as “then retrieve the full
53
+ untruncated dataset”.
54
+ - Automatically paginate through all 13 records and report a USD total.
55
+ - Automatically rerun with `--output`, `--split-dim`, `--page-limit`,
56
+ `--limit`, or `--offset`.
57
+ - Sum the one returned item and present it as the complete total.
58
+ - Present fewer than all four choices or continue execution without waiting.
59
+
60
+ Regression trace that must fail evaluation:
61
+
62
+ ```text
63
+ Assistant: I'll repeat the required probe exactly, then retrieve the full
64
+ untruncated dataset and decimal-sum every PayableAmount.
65
+ Tool: arkcli billing list --start 2026-07 --limit 1 --format json
66
+ Tool result: is_truncated=true, total_records=33616, returned=1
67
+ Tool: arkcli billing list --start 2026-07 --output bills.json --format json
68
+ Assistant: Total PayableAmount: USD 396735.59
69
+ ```
70
+
71
+ The second tool call is forbidden. “Exact total” in the initial request is not
72
+ post-truncation consent for `--output`.
73
+
74
+ ## 2) Resume only after an explicit choice
75
+
76
+ After the mandatory stop above, the user replies:
77
+
78
+ ```text
79
+ Choose option 2. Show API-key attribution.
80
+ ```
81
+
82
+ Expected behavior:
83
+
84
+ - Continue with `--split-dim apikey`; never infer or offer account-wide
85
+ `--split-dim endpoint` in BytePlus.
86
+ - Explain that the resumed action follows the user's explicit selection.
87
+ - Check `is_truncated` again; if it remains true, stop at the same interaction
88
+ boundary again, mark API-key attribution as already attempted, and present
89
+ only the remaining applicable paths.
90
+
91
+ ## 3) Reject unsupported account-wide Endpoint splitting
92
+
93
+ Input:
94
+
95
+ ```text
96
+ Run arkcli billing list --start 2026-07 --split-dim endpoint --format json.
97
+ ```
98
+
99
+ Expected behavior:
100
+
101
+ - The CLI returns a validation error before calling the Billing API.
102
+ - The response explains that BytePlus account-wide Endpoint splitting is
103
+ unsupported.
104
+ - It suggests `--endpoint <id>` for one Endpoint or `--output FILE` for
105
+ complete account data.
106
+ - The agent does not retry without Product filters and does not describe the
107
+ result as server-side Endpoint aggregation.
@@ -0,0 +1,114 @@
1
+ ---
2
+ name: arkcli-chat
3
+ version: 1.1.1
4
+ description: "arkcli +chat: Quickly chat/reason through the data-plane Responses API. Supports multimodal input (@file local images, videos, audio, and general files), streaming output, system instructions, sampling controls (temperature/top-p/max-output-tokens), reasoning effort controls, and multi-turn continuation with --store + previous-response-id. Use this when users need to chat with the model in real time, ask questions, reason, have open-ended multimodal conversations and follow-ups with images/videos/audio, adjust temperature/sampling, control thinking intensity, or continue a multi-turn conversation. Note: For multimodal understanding with a clear output form, such as speech transcription, document parameter extraction, subtitle timestamping, bbox selection and grounding, or video chapter summaries, use arkcli-understand. This skill is only for open-ended chat/reasoning."
5
+ metadata:
6
+ requires:
7
+ bins: ["arkcli"]
8
+ cliHelp: "arkcli +chat --help"
9
+ ---
10
+
11
+ # arkcli +chat
12
+
13
+ **CRITICAL — Before starting, MUST first use the Read tool to read [`../arkcli-shared/SKILL.md`](../arkcli-shared/SKILL.md), which contains the authentication gate, configuration troubleshooting, and command selection order.**
14
+ **CRITICAL — Before running `+chat`, be sure to first use the Read tool to read [`references/arkcli-chat.md`](references/arkcli-chat.md). Do not blindly call the command directly.**
15
+
16
+ ## Core concepts
17
+
18
+ - When `--model` is omitted, the CLI automatically falls back to `resources.text.default` in the active profile. If the user explicitly passes `--model X` and `X` is not equal to that default, ask the user whether to promote it according to "Default drift detection and promote nudge" in [`../arkcli-shared/references/profile-defaults.md`](../arkcli-shared/references/profile-defaults.md).
19
+ - `+chat` is a high-level wrapper for the data-plane Responses API (`POST /responses`): one request returns the assistant text.
20
+ - Supports **multimodal** input: use `--input @photo.jpg` to upload a local file with the request, so the model can answer after viewing images/videos or listening to audio. Images (`.jpg/.png/.webp/...`), videos (`.mp4/.mov/...`), audio (`.mp3/.wav/.m4a/...`), and general files are automatically routed by extension.
21
+ - Supports **streaming**: `--stream` mode outputs incrementally, with reasoning (thinking) first, then the final answer (response).
22
+ - Supports **progress prompts**: For non-streaming calls, after 5 seconds, heartbeat lines like `arkcli +chat: still running… elapsed Xs` are output to stderr every 10 seconds to avoid long calls showing no output. In scripts, you can disable this with `--no-progress`. stdout is not affected.
23
+ - Supports **system instructions**: `--instructions "..."` Injects system-level instructions.
24
+ - Supports **sampling controls**: `--temperature` / `--top-p` / `--max-output-tokens`.
25
+ - Supports **thinking intensity**:`--reasoning-effort minimal|low|medium|high` (only takes effect on models that support reasoning).
26
+ - Supports **multi-turn continuation**: `--store` persists the current response, and the next call continues with `--previous-response-id <id>`.
27
+ - Supports **Tools**: `--tools mcp` (simple syntactic sugar) or `--tools-file tools.json` (full function form), together with `--tool-choice auto|required|none` and `--max-tool-calls`. See [`references/tools.md`](references/tools.md).
28
+ - Supports **reconciliation-plane commands**: `arkcli chat get/delete/list-input-items <response-id>` performs CRUD on responses stored with `--store`. See [`references/chat-meta.md`](references/chat-meta.md).
29
+ - Supports **caching and thinking**:`--caching enabled|disabled` (with `--cache-prefix`) controls the server-side prompt cache.`--thinking auto|enabled|disabled` controls the thinking stage. `--expire-at <epoch_sec>` adds an expiration time to a stored response. See [`references/caching-thinking.md`](references/caching-thinking.md).
30
+ - Supports **streaming events**: `--stream --include-events` outputs raw SDK events as NDJSON (one JSON per line) for autotest / agent programmatic consumption. See [`references/stream-events.md`](references/stream-events.md).
31
+ - Supports **verifiable strict JSON**: `--text-format json_schema --text-schema <file> --text-strict` checks locally that the response is completed, is a direct JSON value, and matches the schema. Otherwise the command exits non-zero. Strict streaming buffers events until validation succeeds so partial JSON is never emitted. See [`references/text-format.md`](references/text-format.md).
32
+ - **Output schema (be sure to read first)**: `+chat` returns the arkcli **flat** schema (`{id, model, content, reasoning_content, usage, ...}`), **not** the native Responses API nested `output[].content[].text` structure. Get assistant text directly from `.content`.`--format` does not switch the shape. See the "Return values" section in [`references/arkcli-chat.md`](references/arkcli-chat.md).
33
+
34
+ ## Quick decision
35
+
36
+ **Use `+chat` for:**
37
+ - Plain-text questions or reasoning, and open-ended multimodal conversations; attachments are optional.
38
+ - Continuing a Responses conversation with `--store` / `--previous-response-id`; storage is not required for a single turn.
39
+ - Prefer `arkcli-understand` for the specialized outputs below, rather than selecting chat merely because an attachment is present.
40
+
41
+ Before disabling thinking, comparing latency/cache behavior, or delivering SDK code, read
42
+ [`references/caching-thinking.md`](references/caching-thinking.md). Minimal effort does not disable thinking;
43
+ a cache configuration echo does not prove a hit or establish a fixed latency ranking.
44
+
45
+ **Criteria for switching to `arkcli-understand` (switch if any one is met):**
46
+ - The user wants "transcription/speech-to-text/speech recognition/ASR" → understand.
47
+ - The user wants "subtitles/timestamping/SRT" → understand.
48
+ - The user wants "multi-speaker dialogue/speaker labeling/meeting transcription" → understand.
49
+ - The user wants "OCR/text recognition/recognize text in images/invoice amount" → understand.
50
+ - The user wants "draw a box/mark a box/bbox/visual grounding" → understand.
51
+ - The user wants "PDF parameter extraction/document extraction/extract parameters/contract extraction" → understand.
52
+ - The user wants "video summary/segmentation/chapter summary" → understand.
53
+ - The user wants "video Q&A/questions about video content" → understand.
54
+
55
+ In short: **If there is an @file and a clear output form → understand; image-based chat/follow-up/open-ended thoughts → chat**.
56
+
57
+ - If the user wants to generate images/videos (not chat), switch to [`../arkcli-gen/SKILL.md`](../arkcli-gen/SKILL.md).
58
+
59
+ ## Agent quick execution order
60
+
61
+ 1. When the user's goal is chat/reasoning/multimodal understanding, prefer `arkcli +chat`.
62
+ 2. When the authentication status is uncertain, check `arkcli auth status` first. If not logged in or no API key is available, switch to [`../arkcli-auth/SKILL.md`](../arkcli-auth/SKILL.md).
63
+ 3. When the model name is uncertain, switch to [`../arkcli-models/SKILL.md`](../arkcli-models/SKILL.md) first.
64
+ 4. **`--model` must be in the full `<name>-<primary_version>` form** (or Endpoint ID `ep-xxx`). The `primary_version` format is not fixed: it can be a 6-digit date, 8-digit date, qualified prefix, short number, or even an empty string (see the full table in link 0 of [`../arkcli-models/SKILL.md`](../arkcli-models/SKILL.md) for details). **Do not use your own regex to guess whether it "looks complete".**If the user only provides a family name or it is unclear whether the name is complete, first look up `primary_version` and then concatenate it. If you just ran `models search/list`, directly reuse the parameter returned there. Otherwise, use `arkcli models get <name> --transform 'primary_version' | tr -d '"'` (`--transform` outputs quotes, which must be removed). Skipping this will directly cause a 404 `InvalidEndpointOrModel.NotFound`.
65
+ 5. Add `--stream` when streaming output is needed. Add `--input @<file>` (can be repeated) when multimodal input is needed.
66
+
67
+ ## Common fallbacks
68
+
69
+ - If the model name is uncertain, run `models search` first.
70
+ - To use an endpoint ID with `+chat`, directly pass `--model ep-xxx` (the endpoint itself already determines the modality, so no extra flag is needed).
71
+ - If authentication fails, switch to [`../arkcli-auth/SKILL.md`](../arkcli-auth/SKILL.md).
72
+
73
+ ## Model capability notices (non-blocking stderr warnings)
74
+
75
+ Before a real `+chat` request, the CLI reads ArkModels metadata once and may write model-specific notices to **stderr** with a `warn: ` prefix. The request still proceeds:
76
+
77
+ 1. A warning is advisory, not a rejection. Declared values, aliases, and defaults are metadata; the server and SDK decoder remain authoritative.
78
+ 2. Do not treat a declared set as the server acceptance set. Never remove an option, switch models, or retry merely because a local warning appeared.
79
+ 3. Warn only from metadata that is actually present. Other capabilities do not imply a reasoning-effort catalog; missing or unavailable metadata produces no warning.
80
+ 4. Preserve a complete versioned model ID exactly. The CLI may use the bare family name to find that version's metadata, but must not upgrade an explicitly selected older version to the current primary.
81
+ 5. Warnings are localized and written only to stderr. The stdout schema, including `--format json`, is unchanged.
82
+ 6. `--dry-run` remains offline and does not read ArkModels metadata, so it emits no capability warnings.
83
+
84
+ ## Command overview
85
+
86
+ | Command |Description|
87
+ |------|------|
88
+ | `arkcli +chat --model <id> "<prompt>"` | Basic usage: plain-text chat |
89
+ | `arkcli +chat --model <id> --stream "<prompt>"` | Streaming output (two parts: thinking + response) |
90
+ | `arkcli +chat --model <id> --instructions "You are a concise assistant" "<prompt>"` | System-level instructions |
91
+ | `arkcli +chat --model <id> --temperature 0.2 --max-output-tokens 256 "<prompt>"` | Sampling controls |
92
+ | `arkcli +chat --model <id> --reasoning-effort high "<prompt>"` | Increase thinking intensity |
93
+ | `arkcli +chat --model <id> --input @file.jpg "<prompt>"` | Multimodal (local files, supports images/videos/audio) |
94
+ | `arkcli +chat --model <id> --input @a.jpg --input @b.jpg "<prompt>"` | Multiple files |
95
+ | `arkcli +chat --model <id> --store "<prompt>"` Get the id, then use `--previous-response-id <id> "<next sentence>"` | Persistence + multi-turn continuation |
96
+ | `arkcli +chat --model <id> --tools mcp --tool-choice auto "<prompt>"` | Tools: MCP |
97
+ | `arkcli +chat --model <id> --tools-file tools.json --tool-choice required "<prompt>"` | Tools: custom function |
98
+ | `arkcli chat get <response-id>` | Retrieve a stored response (including function_calls) |
99
+ | `arkcli chat list-input-items <response-id> --order desc --limit 5` | List input items (multi-turn history) |
100
+ | `arkcli chat delete <response-id>` | Delete a stored response |
101
+ | `arkcli +chat --model <id> --caching enabled --store "<prompt>"` | Enable prompt cache + persistence |
102
+ | `arkcli +chat --model <id> --thinking disabled --max-output-tokens 100 "<prompt>"` | Disable thinking to shorten output |
103
+ | `arkcli +chat --model <id> --text-format json_object "<prompt>"` | Force the model to output valid JSON |
104
+ | `arkcli +chat --model <id> --text-format json_schema --text-schema schema.json --text-strict "<prompt>"` | Strongly constrain the shape with JSON Schema |
105
+ | `arkcli +chat --model <id> --stream --include-events "<prompt>"` | Streaming NDJSON (one SDK event JSON per line) |
106
+
107
+ ## Detailed documentation
108
+
109
+ - For all `+chat` parameters, return values, error codes, the automatic multimodal file upload mechanism, and more, see [`references/arkcli-chat.md`](references/arkcli-chat.md).
110
+ - For `+chat` Tools capabilities (`--tools / --tools-file / --tool-choice / --max-tool-calls`, including function and mcp), see [`references/tools.md`](references/tools.md).
111
+ - For the three reconciliation-plane commands `chat get / chat delete / chat list-input-items`, see [`references/chat-meta.md`](references/chat-meta.md). The responses operated on by these commands must have been stored with `+chat --store`.
112
+ - For `+chat` usage of `--caching / --cache-prefix / --thinking / --expire-at`, echoed parameters, and autotest mappings, see [`references/caching-thinking.md`](references/caching-thinking.md).
113
+ - For `+chat` usage of `--text-format / --text-schema / --text-schema-name / --text-strict`, see [`references/text-format.md`](references/text-format.md).
114
+ - For `+chat` streaming event output with `--stream --include-events` NDJSON, see [`references/stream-events.md`](references/stream-events.md).