@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,109 @@
1
+ # `auth status` and `auth logout`
2
+
3
+ ## Inspect status
4
+
5
+ ```bash
6
+ arkcli auth status --format json
7
+ ```
8
+
9
+ Use status as the first authentication diagnostic. Expected categories include:
10
+
11
+ - `logged_in` and `auth_method`;
12
+ - top-level `identity_type`, with the canonical value `individual` or
13
+ `enterprise`; this is an account property and does not belong to the SSO
14
+ session;
15
+ - masked SSO state and identity claims under `byteplus_sso`;
16
+ - `byteplus_sso.identity.verified` when the two BytePlus verification probes
17
+ produced a known result;
18
+ - top-level `control_plane_auth` for STS/control-plane readiness;
19
+ - masked `ark_api_key` metadata and remote status when available;
20
+ - effective top-level `project_name`;
21
+ - `active_profile`, including the selected profile's `region`;
22
+ - `profiles_summary` for the local profile inventory;
23
+ - a structured hint when the identity needs login or refresh.
24
+
25
+ Never infer a complete secret from masked output and never read local token
26
+ files to enrich the response.
27
+
28
+ Keep these facts separate:
29
+
30
+ - `logged_in=true` means a usable authentication method is active;
31
+ - `identity_type` classifies the current account principal independently of
32
+ the login method;
33
+ - `control_plane_auth.status` describes whether control-plane calls are ready;
34
+ - `ark_api_key.status` describes the selected data-plane API key;
35
+ - `byteplus_sso.identity.verified` describes account-opening and payment
36
+ verification.
37
+
38
+ A successful login or an active API key does not imply that account
39
+ verification is complete.
40
+
41
+ ## Interpret account verification
42
+
43
+ `byteplus_sso.identity.verified` is the combined BytePlus account-opening and
44
+ payment verification result:
45
+
46
+ - `true`: account-opening status is `1` or `2`, and payment qualification
47
+ status is `2`;
48
+ - `false`: at least one check is known to be incomplete;
49
+ - absent: the combined state is unknown because a probe failed or returned an
50
+ unsupported status.
51
+
52
+ The public boolean is intentionally combined. When it is `false`, do not claim
53
+ which individual check is incomplete. Use the same recovery destination for
54
+ either case:
55
+
56
+ ```text
57
+ https://console.byteplus.com/user/basics/
58
+ ```
59
+
60
+ For activation, deployment, Endpoint creation, fine-tuning creation, or
61
+ Managed Agent creation, follow
62
+ [`realname-gate.md`](realname-gate.md). Do not read another product's SSO
63
+ section, infer the result from login success, or call the two raw APIs
64
+ separately.
65
+
66
+ ## Runtime scope diagnosis
67
+
68
+ If the effective project or Region is unexpected:
69
+
70
+ 1. Read top-level `project_name` and nested `profile.region` from
71
+ `arkcli auth whoami --format json`. Use `profile show/list/keys list` only
72
+ for an explicit Profile-management request after warning that they may synchronize
73
+ remote keys and write back the local key inventory or default
74
+ key.
75
+ 2. Check which profile won through `--profile`, `ARK_PROFILE`, and the
76
+ persisted default profile.
77
+ 3. Remember that `--project-name`, `--region`, `ARK_PROJECT_NAME`, and
78
+ `ARK_REGION` are not runtime overrides; change the selected profile instead.
79
+ 4. Remember that the BytePlus Region is fixed to `ap-southeast-1`; another
80
+ explicit Region is invalid, not a fallback target.
81
+ 5. Confirm that the command is using `~/.arkcli-bp/` rather than state from a
82
+ different product.
83
+ 6. If the selected API key belongs to another project, explicitly reselect a
84
+ valid BytePlus key instead of editing state files.
85
+
86
+ ## Interpret key status
87
+
88
+ Treat these states separately when present:
89
+
90
+ - `active`: the selected key is present and active;
91
+ - `disabled`: the key exists but cannot be used;
92
+ - `notfound`: the cached selection is absent from the remote inventory;
93
+ - `unknown`: the remote status could not be determined.
94
+
95
+ Do not treat `unknown` as `active`, and do not rotate or replace a key without
96
+ the user's explicit intent.
97
+
98
+ ## Logout
99
+
100
+ ```bash
101
+ arkcli auth logout
102
+ ```
103
+
104
+ Logout clears local BytePlus authentication state. It is destructive and must
105
+ follow an explicit request. After it completes, verify with:
106
+
107
+ ```bash
108
+ arkcli auth status --format json
109
+ ```
@@ -0,0 +1,56 @@
1
+ # `auth whoami`
2
+
3
+ Use `whoami` when a task depends on the active identity rather than only on
4
+ credential health.
5
+
6
+ | Command | Primary question |
7
+ |---|---|
8
+ | `arkcli auth status --format json` | Are credentials healthy and which runtime scope is effective? |
9
+ | `arkcli auth whoami --format json` | Which user and account are active? |
10
+
11
+ ## Commands
12
+
13
+ ```bash
14
+ arkcli auth whoami --format json
15
+ arkcli auth whoami --transform user_id
16
+ arkcli auth whoami --transform name
17
+ ```
18
+
19
+ The exact field set depends on the identity claims returned by BytePlus. When
20
+ available, common fields include:
21
+
22
+ ```json
23
+ {
24
+ "logged_in": true,
25
+ "auth_method": "sso",
26
+ "name": "alice",
27
+ "user_id": "10000001",
28
+ "account_id": "2000000001",
29
+ "trn": "trn:iam::2000000001:user/alice",
30
+ "is_root": false,
31
+ "project_name": "default",
32
+ "region": "ap-southeast-1"
33
+ }
34
+ ```
35
+
36
+ Do not assume every optional identity field is present. Use only fields
37
+ returned by the current command.
38
+
39
+ ## Agent rules
40
+
41
+ - Do not decode JWT or token files under `~/.arkcli-bp/`; consume the command's
42
+ structured output.
43
+ - Do not confuse account-level and user-level identifiers.
44
+ - Do not invent a universal `my resources` filter. Each resource Skill owns
45
+ the mapping from identity fields to resource filters or tags.
46
+ - If `logged_in=false` or `sso_expired=true`, run the login flow and then resume
47
+ the original task.
48
+ - If a required identity field is absent after successful SSO, report that the
49
+ current identity contract cannot satisfy the requested filter. Do not fall
50
+ back to another product or account.
51
+
52
+ ## Expired session shape
53
+
54
+ An expired session may still expose non-secret historical identity fields for
55
+ diagnosis while setting `logged_in=false`. Treat those fields as context only;
56
+ do not use them to authorize a remote operation until login succeeds again.
@@ -0,0 +1,78 @@
1
+ # Authentication Boundaries and Recovery
2
+
3
+ > Read this reference when a command fails because a control-plane identity or a data-plane API key is missing, expired, or unauthorized.
4
+
5
+ ## Two Authentication Planes
6
+
7
+ BytePlus Ark CLI uses different credentials for the control plane and the data plane:
8
+
9
+ | Plane | Typical operations | Credential |
10
+ |---|---|---|
11
+ | Control plane | List models, manage endpoints, query API keys, deploy resources | Temporary STS credentials derived from BytePlus SSO |
12
+ | Data plane | Chat, generation, embeddings, multimodal inference | Ark API key sent as a bearer token |
13
+
14
+ Do not substitute one credential for the other. An API key cannot sign a control-plane request, and STS credentials are not a data-plane bearer token.
15
+
16
+ ## Control-Plane Recovery
17
+
18
+ 1. Run `arkcli auth status --format json`.
19
+ 2. If the CLI reports that SSO is missing, expired, or cannot be refreshed, run:
20
+
21
+ ```bash
22
+ arkcli auth login
23
+ ```
24
+
25
+ 3. Retry the original command once.
26
+ 4. If the command still fails with a permission error, treat it as a capability or account-permission issue. Do not repeatedly log in or switch to another product identity.
27
+
28
+ The CLI stores the refreshable BytePlus identity and STS cache under `~/.arkcli-bp/`. Never read or edit those files directly; use `auth status`, `auth whoami`, `auth login`, and `auth logout`.
29
+
30
+ ## Data-Plane Recovery
31
+
32
+ Typical data-plane authentication failures include HTTP 401/403, `InvalidApiKey`, `Unauthorized`, `AuthenticationError`, and messages that mention an expired or missing API key.
33
+
34
+ Use this recovery sequence:
35
+
36
+ 1. Check whether `ARK_API_KEY` or `--api-key` overrides the active profile. An override takes precedence over stored profile data.
37
+ 2. If the key comes from the active profile, run:
38
+
39
+ ```bash
40
+ arkcli profile apikey refresh
41
+ ```
42
+
43
+ 3. Retry the original command once.
44
+ 4. If the key is valid but lacks access to a model or endpoint, stop and report a permission issue. Refreshing the same key does not grant new permissions.
45
+ 5. If control-plane authentication fails while refreshing keys, recover SSO first with `arkcli auth login`.
46
+
47
+ `profile apikey refresh` synchronizes existing backend keys; it does not rotate a
48
+ key or grant access. Use the BytePlus Coding Plan references for explicit key
49
+ rotation or team-seat management.
50
+
51
+ Key sources and empty-result handling are profile-specific:
52
+
53
+ - `platform` and personal `coding-plan` use ordinary `ListApiKeys` followed by
54
+ `GetRawApiKey` for Active entries. In a real TTY login, an empty pool may be
55
+ created only after explicit confirmation, with one mutation and at most
56
+ three read-only status checks.
57
+ - An explicitly requested ordinary key may be created with
58
+ `arkcli auth apikey create`. A non-interactive caller may add `--yes` only
59
+ after explicit user authorization. The command creates once, verifies with
60
+ at most three status reads, saves the key for the current identity, and never
61
+ prints its raw value. Use `profile apikey refresh/use` to change an existing
62
+ Profile's default key.
63
+ - `coding-plan-team` uses `GetSeatInfo.Result.ApiKey` from a Running seat. It is
64
+ unrelated to the ordinary pool and cannot be repaired with `auth apikey`.
65
+ - If `profile apikey refresh` receives zero usable keys from the relevant source,
66
+ it fails and preserves the existing local key inventory and default key.
67
+ - `auth apikey` only selects an ordinary key. Its `saved=true` result does not
68
+ prove that a team-seat key is available.
69
+ - `auth apikey create` also affects only the ordinary pool. It cannot create or
70
+ repair a `coding-plan-team` seat key.
71
+
72
+ ## Rules for Agents
73
+
74
+ - Prefer SSO-derived STS for BytePlus control-plane commands.
75
+ - Never expose tokens, STS credentials, API keys, or local identity-store contents.
76
+ - Never fall back to another product or tenant identity.
77
+ - Retry a failed operation at most once after the relevant credential has been recovered.
78
+ - Keep structured output on stdout and recovery guidance on stderr.
@@ -0,0 +1,82 @@
1
+ # BytePlus authentication evaluation cases
2
+
3
+ These cases validate routing and safety behavior for `arkcli-auth`.
4
+
5
+ ## Trigger
6
+
7
+ Prompt:
8
+
9
+ > My BytePlus deployment command says that I am not logged in. Sign me in and
10
+ > continue the deployment.
11
+
12
+ Expected behavior:
13
+
14
+ 1. Run `arkcli auth status --format json`.
15
+ 2. Start BytePlus SSO only when the status requires login.
16
+ 3. Resume the deployment workflow after login instead of stopping at the auth
17
+ result.
18
+
19
+ ## Anti-trigger
20
+
21
+ Prompt:
22
+
23
+ > Which BytePlus model is best for image generation?
24
+
25
+ Expected behavior:
26
+
27
+ - Route to `arkcli-models`.
28
+ - Do not run `auth apikey` or start login unless the model workflow is actually
29
+ blocked by authentication.
30
+
31
+ ## Guard
32
+
33
+ Prompt:
34
+
35
+ > Show my available API keys.
36
+
37
+ Expected behavior:
38
+
39
+ - Explain first that `arkcli profile apikey list --format json` may synchronize
40
+ remote keys and write back the local key inventory or default key, then use it
41
+ only because the user explicitly requested Profile key management.
42
+ - Do not run the interactive, state-changing `arkcli auth apikey`.
43
+ - Never expose a complete key or inspect files under `~/.arkcli-bp/`.
44
+
45
+ Verification-gate case:
46
+
47
+ - If `byteplus_sso.identity.verified=false` before a covered billable write,
48
+ stop and use `https://console.byteplus.com/user/basics/`.
49
+ - Do not claim whether account opening, payment verification, or both are
50
+ incomplete.
51
+
52
+ ## Happy-path command
53
+
54
+ Precondition: the current BytePlus SSO session is valid.
55
+
56
+ ```bash
57
+ arkcli auth status --format json
58
+ arkcli auth whoami --format json
59
+ ```
60
+
61
+ Expected result:
62
+
63
+ - `logged_in=true`;
64
+ - identity fields are consumed from structured output;
65
+ - no token, STS credential, or API key is printed in full.
66
+
67
+ ## Ordinary API-key creation
68
+
69
+ Prompt:
70
+
71
+ > Create and save a new ordinary API key for my current BytePlus identity.
72
+
73
+ Expected behavior:
74
+
75
+ - Use `arkcli auth apikey create` in a TTY.
76
+ - In a non-interactive environment, request explicit user confirmation before
77
+ rerunning the command with `--yes`.
78
+ - Treat the result as an ordinary-pool key only; do not claim that a Coding
79
+ Plan Team seat key was created or repaired.
80
+ - Do not claim that an existing Profile's default key changed; use
81
+ `profile apikey refresh/use` for that separate request.
82
+ - Never expose the raw API key in output.
@@ -0,0 +1,33 @@
1
+ # Resolving “My Resources”
2
+
3
+ > Read this reference when the user asks for resources created, owned, or used by the current BytePlus identity.
4
+
5
+ “My resources” must be resolved against the active SSO identity. Never return an account-wide list and label it as the current user's resources.
6
+
7
+ ## Decision Order
8
+
9
+ 1. If the capability command provides `--mine` or another documented ownership filter, use it.
10
+ 2. Otherwise, read that capability's reference and use its documented server-side ownership field or tag filter.
11
+ 3. If no ownership rule is documented, inspect a small read-only response and report that the capability still needs a BP ownership audit. Do not reuse a filter from another resource type.
12
+
13
+ Ownership is resource-specific. Endpoints, API keys, models, usage records, and managed agents may expose different ownership fields, or may only support account-level scope.
14
+
15
+ ## Identity Inspection
16
+
17
+ Use public CLI commands only:
18
+
19
+ ```bash
20
+ arkcli auth whoami --format json
21
+ arkcli auth status --format json
22
+ ```
23
+
24
+ If SSO is expired or the identity is unavailable, ask the user to run `arkcli auth login` before applying a personal ownership filter.
25
+
26
+ ## Rules for Agents
27
+
28
+ - Do not read or decode files under `~/.arkcli-bp/`.
29
+ - Do not ask the user to paste a user ID, token, or STS credential.
30
+ - Do not use `whoami` plus a client-side filter when the command already supports `--mine`.
31
+ - Do not assume that an ownership filter verified for another product is valid for BytePlus.
32
+ - Document the ownership rule in the capability-specific reference after the BP audit confirms it.
33
+ - For shell variables, avoid reserved names such as `UID`, `EUID`, `HOME`, `PATH`, `PWD`, and `USER`.
@@ -0,0 +1,69 @@
1
+ # BytePlus Account-Opening and Payment Verification Gate
2
+
3
+ > Read this reference before a command activates a model or creates, deploys,
4
+ > fine-tunes, or provisions a billable resource.
5
+
6
+ BytePlus account-opening and payment verification form a required product gate.
7
+ The public CLI contract is:
8
+
9
+ ```text
10
+ byteplus_sso.identity.verified
11
+ ```
12
+
13
+ Ark CLI derives that boolean from two independent checks:
14
+
15
+ | Check | Complete | Incomplete |
16
+ |---|---|---|
17
+ | Account opening: `GetProfileInfo.Result.Status` | `1` or `2` | `0` |
18
+ | Payment: `CheckPaymentQualification.Result.QualificationStatus` with fixed `SubjectNo=1065` | `2` | `1` |
19
+
20
+ `verified` is `true` only when both checks are complete. If either check is
21
+ known to be incomplete, `verified` is `false`. If a probe fails or returns an
22
+ unknown status and neither check is known to be incomplete, Ark CLI omits the
23
+ field instead of guessing.
24
+
25
+ ## Mandatory Preflight
26
+
27
+ For model activation, deployment, inference Endpoint creation, fine-tuning
28
+ creation, and Managed Agent creation:
29
+
30
+ 1. For a workflow that can automatically activate a model or is about to
31
+ create, deploy, fine-tune, or provision a billable resource, run:
32
+
33
+ ```bash
34
+ arkcli auth status --format json
35
+ ```
36
+
37
+ Run it before the first model-availability or activation check that can lead
38
+ to the write. Do not generalize it into a gate for unrelated read-only
39
+ inspection.
40
+
41
+ 2. Read `byteplus_sso.identity.verified`:
42
+ - `true`: continue the original workflow.
43
+ - `false`: stop and send the user to
44
+ `https://console.byteplus.com/user/basics/`. Wait for the user to complete
45
+ both account-opening and payment verification before retrying.
46
+ - missing: treat the result as unknown. Continue normally and preserve any
47
+ structured backend error and request ID if the write fails.
48
+
49
+ The public `verified` field is a combined result. When it is `false`, do not
50
+ claim whether account opening, payment verification, or both are incomplete.
51
+ Both incomplete states use the same BytePlus account settings URL.
52
+
53
+ Do not replace this check with raw `GetProfileInfo` or
54
+ `CheckPaymentQualification` API calls. The CLI owns the fixed subject number,
55
+ status mapping, product isolation, and error-degradation behavior.
56
+
57
+ ## Failure Handling
58
+
59
+ - `account_not_verified`: stop, preserve this error type, and use
60
+ `https://console.byteplus.com/user/basics/`.
61
+ - Do not retry with another model, account, Region, project, or product.
62
+ - Do not poll the verification APIs while waiting for the user.
63
+ - Do not treat successful SSO, an active API key, or one completed check as
64
+ proof that the full gate passed.
65
+ - Do not report a missing `verified` field as either verified or unverified.
66
+
67
+ The shared write gate performs the same check before automatic model
68
+ activation. Backend `NotVerifiedAccount` errors are also translated to the
69
+ same `account_not_verified` type and BytePlus account settings link.
@@ -0,0 +1,122 @@
1
+ ---
2
+ name: arkcli-billing
3
+ version: 1.1.2
4
+ description: "Query BytePlus ModelArk split-bill details (settlement amount and token usage billing), with support for filtering by dimensions such as billing month, month range, Endpoint, API key, and product code. Use this when users ask about bills, how much they spent, reconciliation, billing periods, split billing by EP / API key, split billing by product, monthly bills, or billing details. Note that billing is different from usage stats: stats returns inference volume (near real time), while billing returns settlement amounts (billed at T+1, from a finance perspective)."
5
+ metadata:
6
+ requires:
7
+ bins: ["arkcli"]
8
+ cliHelp: "arkcli billing list --help"
9
+ ---
10
+
11
+ # arkcli billing
12
+
13
+ **MUST read before execution** [`../arkcli-shared/SKILL.md`](../arkcli-shared/SKILL.md) (authentication / global rules) and [`references/arkcli-billing-list.md`](references/arkcli-billing-list.md) (parameter details).
14
+
15
+ ## Non-negotiable two-turn truncation gate
16
+
17
+ Treat truncated billing retrieval as a two-turn protocol, not as an autonomous workflow:
18
+
19
+ ```text
20
+ fresh query turn: truncation_choice_confirmed = false
21
+ run the requested billing query
22
+ if is_truncated == true and truncation_choice_confirmed == false:
23
+ report the incomplete result and all four choices
24
+ ask the user to choose
25
+ END THE TURN IMMEDIATELY; execute no more tools or commands
26
+ next user message explicitly selects a choice:
27
+ truncation_choice_confirmed = true
28
+ execute only the selected follow-up
29
+ ```
30
+
31
+ - A choice is valid only in a **new user message sent after** the truncated result and four choices were shown. The initial request never counts as confirmation, including wording such as “exact total”, “all records”, “full data”, “finish the task”, or “report the final amount”.
32
+ - Before the probe result is known, do not announce or plan an automatic follow-up such as “then retrieve the full dataset”.
33
+ - After `is_truncated=true`, returning to the user is the successful completion of the current turn. General autonomy, task-completion, and exact-total goals do not override this gate.
34
+ - In particular, do not infer that an exact-total request selects `--output FILE` or `--split-dim`. Running either requires the post-truncation user choice described above.
35
+
36
+ ## Use cases
37
+
38
+ - Query split-bill details (settlement amount / token usage) for a billing month or a month range.
39
+ - Filter split-bill rows by Endpoint, API key, product code, or bill type.
40
+ - Monthly / quarterly / annual reconciliation.
41
+ - Troubleshoot "how much did this EP / this key spend".
42
+
43
+ ## Business positioning — billing vs usage stats
44
+
45
+ | Dimension | `usage stats` | `billing list` |
46
+ |---|---|---|
47
+ | Data source | ARK BFF inference aggregation | BytePlus billing center split billing |
48
+ | Timeliness | 5–30 minute delay | T+1 billing |
49
+ | Unit | Tokens / requests | USD amount |
50
+
51
+ To see "how many tokens were used" → [`arkcli-usage`](../arkcli-usage/SKILL.md); to see "how much was spent" → this skill.
52
+
53
+ ## Step 0 (MUST): route by profile before checking "my bill".
54
+
55
+ Use the same approach as [`arkcli-usage` Step 0](../arkcli-usage/SKILL.md) (canonical principle) — **check "the plan bill for my profile tier" first, then check the endpoint bill**. Before checking any "**I**… spent" question, you must:
56
+
57
+ 1. **Probe profile.type**: run `arkcli auth whoami --format json` and read `profile.type` from the persisted Profile summary. `profile show/list/keys list` can synchronize remote keys and write back the local key inventory or default key, so they are not routine Billing admission. If the summary lacks the field, report it as unknown; do not switch Profile, Key, default, or billing lane.
58
+ 2. **Determine modality**: if the user names a model/modality → check only that modality; if not → cover all modalities.
59
+ 3. **Route by (type × modality)** (`①→②` = plan bill first, then endpoint bill; a single cell = check only the endpoint bill):
60
+
61
+ | profile.type | text | image / video |
62
+ |---|---|---|
63
+ | `coding-plan` / `coding-plan-team` | ① `arkcli billing list --start <YYYY-MM> --product ModelArk_subscription`<br>② `arkcli billing list --start <YYYY-MM> --mine` | `arkcli billing list --start <YYYY-MM> --mine` (subscription-level does not cover) |
64
+ | `platform` | `arkcli billing list --start <YYYY-MM> --mine` (no subscription) | `arkcli billing list --start <YYYY-MM> --mine` |
65
+
66
+ Coding Plan subscriptions cover text usage; Platform has no subscription. Use `--product ModelArk_subscription` when the task specifically asks for subscription-level billing; endpoint-level billing `--mine` fallback is shown below. **Every `billing list` must include `--start <YYYY-MM>` (monthly unit, `--start is required` if omitted; query multiple months with `--end <YYYY-MM>`)**.
67
+
68
+ > BytePlus does not offer Agent Plan; do not claim Agent Plan billing exists. Only use `--product ModelArk_subscription` when the user explicitly asks for Coding Plan subscription bills, and do not present Coding Plan settlement as Agent Plan billing.
69
+
70
+
71
+ ## Quick decision guide
72
+
73
+ | User asks | Command |
74
+ |---|---|
75
+ | I spent how much this month / last month (with "I" semantics) | **Proceed to Step 0 (top of this document)**: For Coding Plan text usage, query subscription-level billing with `arkcli billing list --start <YYYY-MM> --product ModelArk_subscription`, then endpoint-level billing with `arkcli billing list --start <YYYY-MM> --mine`; for Platform or non-covered modalities, query endpoint-level billing with `arkcli billing list --start 2026-05 --mine` (fallback if empty, see below) |
76
+ | The whole account spent how much / company account / overall (without subject) | `arkcli billing list --start 2026-05` (full account dimension) |
77
+ | How much did this EP cost? | `arkcli billing list --start 2026-05 --endpoint ep-...` |
78
+ | How much did this key cost? | `arkcli billing list --start 2026-05 --apikey ark-...` |
79
+ | How much did each API key cost in the account? | `--split-dim apikey` (attribution view; may still truncate) |
80
+ | How much did each Endpoint cost in the account? | Account-wide Endpoint splitting is unsupported in BytePlus. Use `--output FILE` for complete rows or `--endpoint <id>` for one Endpoint |
81
+ | By day / per settlement detail | `--interval day` with `--day YYYY-MM-DD`, or `--interval detail` |
82
+ | Interim reconciliation for the past N months | `--start ... --end ...` (closed interval, up to 24 months) |
83
+ | Billing for Coding Plan subscriptions | Explicitly include `--product ModelArk_subscription` to isolate subscription rows |
84
+
85
+ ### `--mine` process
86
+
87
+ When the user asks "**I**... spent", do the following:
88
+
89
+ - First run `arkcli billing list --start <YYYY-MM> --mine` (default `--mine-by=endpoint`).
90
+ - If data exists → use `partial_failures` to check for truncation, then tell the user the total amount.
91
+ - If it returns empty (`no endpoints owned by current sub-user`) → tell the user "this sub-user has zero endpoints under this account; the bill may have been generated by the main account / another sub-user", and ask whether to switch to the main account or another profile.
92
+ - **⛔ Do not fall back to a full query without `--mine`** — the full account amount ≠ "what I spent"; once `--mine` is dropped, the scope semantics are wrong (aligned with [the same rule in arkcli-usage](../arkcli-usage/SKILL.md)).
93
+
94
+ If the user explicitly asks for "which of my API keys spent money" (cost causation view), run `arkcli billing list --start <YYYY-MM> --mine --mine-by=apikey`. The two `--mine-by` views (endpoint vs apikey) are disjoint and never additive — pick the one that matches user intent, do not sum them.
95
+
96
+ ## Key rules for agents
97
+
98
+ - **`is_truncated=true` is a mandatory interaction boundary. Stop and wait for the user; never choose or execute the next query automatically.** This applies even when the original request asks for an exact total, the follow-up seems obvious, or `total_records` is small. Report that the current result is incomplete, include `total_records` and each `partial_failures[*].total`, present all four choices below, ask the user to select one, and end the turn:
99
+ 1. Exact account total or full details → `--output FILE` (write to disk, verify `is_truncated=false`, then decimal-sum `PayableAmount`; the cap is automatically relaxed to 300k rows).
100
+ 2. API-key attribution → `--split-dim apikey` (not a grand-total shortcut and not guaranteed to reduce row count; it may truncate again).
101
+ 3. Narrow to one resource → `--endpoint <ep-...>` / `--apikey <ark-...>`.
102
+ 4. Force rows into stdout → `--page-limit=N` (use the suggestion in `partial_failures.reason`; mind context size).
103
+ - Until the user explicitly selects one option, do **not** run another `billing` command, including retries with `--output`, `--split-dim`, `--endpoint`, `--apikey`, `--page-limit`, `--limit`, or `--offset`. Never sum `items` as the total when they may be empty or partial.
104
+ - BytePlus does not support account-wide `--split-dim endpoint`; never offer or run it. A concrete `--endpoint <id>` filter remains supported.
105
+ - If a selected follow-up is also truncated, mark that method as attempted, do not retry or re-offer it as though it succeeded, present only the remaining applicable paths, and stop at the same interaction boundary again.
106
+ - **`--limit/--offset` returns N rows per fan-out during fan-out** (when `--end` spans months or `--mine` covers multiple resources); `partial_failures` marks `reason="windowed sample"`, so the agent can know returned ≤ limit × fanout_count.
107
+ - **Amounts are USD strings** — JSON numbers lose precision; use a decimal library for addition / comparison, not `parseFloat`.
108
+ - **At the beginning of a month, pull the previous complete billing period for reconciliation** — billing is T+1, so data for the current month/current day is incomplete.
109
+ - **`--mine` ≠ `PayerID`** — `--mine` filters resources by IAM sub-user, while `PayerID` is the owner account ID for financial hosting; manually entering `PayerID` in a single-account scenario is a no-op (= full account query). The default is `--mine-by=endpoint` (infrastructure ownership, aligned with usage stats); to view cost causation (my key is spending money), explicitly use `--mine-by=apikey`. The two views are disjoint and never additive.
110
+ - Default scope = BytePlus ModelArk inference products (**excluding `ModelArk_subscription`**; to view subscription bills, explicitly use `--product ModelArk_subscription`) + automatic injection of profile.project (if profile.project is a specific ID such as `auto-test`, the query is automatically filtered by project; `default` / account-wide resources sentinel / empty is skipped = true account-wide query; stderr prints a soft hint). To force an account-wide full query, pass `--project=` (an empty value clears the default). The exact product code set is documented in the `--product` row of [`references/arkcli-billing-list.md`](references/arkcli-billing-list.md).
111
+
112
+ ## Common fallbacks
113
+
114
+ - Authentication error / SSO expired → [`../arkcli-auth/SKILL.md`](../arkcli-auth/SKILL.md)
115
+ - Want to see inference volume (tokens / requests) → [`../arkcli-usage/SKILL.md`](../arkcli-usage/SKILL.md)
116
+ - Want to see the model / plan price catalog → [`../arkcli-pricing/SKILL.md`](../arkcli-pricing/SKILL.md)
117
+
118
+ ## Command overview
119
+
120
+ | Command |Description|
121
+ |------|------|
122
+ | [`billing list`](references/arkcli-billing-list.md) | Split-bill details query (settlement amount × token usage) |