arkcli-auth

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

arkcli auth

arkcli auth

CRITICAL — 开始前 MUST 先用 Read 工具读取
../arkcli-shared/SKILL.md
,其中包含认证闸门、配置排查与共享安全规则
CRITICAL — 用户目标是其他业务命令时,必须先判断是不是被认证阻塞,再决定是否进入本 skill。 CRITICAL —
auth
是身份/TTY 工作流,全域不注册
--dry-run
;不要生成该 flag。
CRITICAL — Key 列表、当前 Profile 选中 Key、最近有调用的 Key 是三个不同事实。声称“最近使用”前,须完整分页并按真实
LastAccessTime
解析时区后取最大值;列表第一条、名称中的日期、
CreateTime
或
Active
状态都不能代替最近调用证据。查询/聚合与披露边界见 API Key 查询与交付。
⚠️ 0.1.16 变化总览(必读):
  1. SSO 登录引入 Gate 1+2:浏览器流后比对 SSO trn 与
    is_default profile.OwnerTrn
    ,4-case 分别走
    BuildFirstProfile
    (新建) /
    GUIDE_SKIP
    (复用) / 提示切 default / 提示新建。详见
    docs/runtime/volc-sso.md
    。
  2. AK/SK 登录通道暂关:
    auth login --access-key / --secret-key
    已注释,promptui 也移除"AK/SK"选项;SSO(火山)+
    arkcli auth login --no-browser
    (注册在 auth login,由 volc-sso 继承)是唯一登录入口。
  3. auth status / auth whoami 输出新增 profile 切面字段:
    active_profile.{name,type,region,project,owner_trn}
    和
    profiles_summary[...]
    ;顶层
    auth_method/logged_in/volc_sso/ark_api_key
    等老字段全部保留(向后兼容)。
  4. Profile 管理迁移到
    arkcli profile
    :
    config init/list/show/switch/delete
    已 deprecated,详见
    ../arkcli-config/SKILL.md
    。
  5. 0.1.17 首登动态选 project:
    BuildFirstProfile
    的 project 步骤改为经 IAM
    ListProjects
    拉当前身份名下真实 active project 列表交互选(拉取失败/无权限回退兜底
    default
    ,不阻断登录)。登录后想换 project 不必重登:
    arkcli profile project [<name>]
    (拉同一列表重选,把 platform profile 重派生到新 project,个人版 plan profile 保留),详见
    ../arkcli-profile/SKILL.md
    。
  6. 1.0.4 起
    arkcli auth login
    交互式浏览器 SSO 分支支持借用本机 volcengine-cli 登录态
    :检测到
    ve >= 1.0.45
    且已
    ve login
    时,直接接管 STS 落一份 arkcli identity (
    identity_store/<key>/metadata.json.source="ve"
    , 不写 IDToken/refresh_token/ClientID; STS 由 volcengine-go-sdk 内部持 refresh_token 自动 refresh)。用户视角: 少一次浏览器授权; agent 视角:
    auth_method
    变成
    "sts"
    而非
    "sso"
    , 但
    logged_in=true
    。检测失败 / ve 未登录 → 自动降级 arkcli 原生 SSO OAuth 流。详见
    references/arkcli-auth-login.md
    的"volcengine-cli 登录态借用"节。
CRITICAL — Before starting, you MUST first use the Read tool to read
../arkcli-shared/SKILL.md
, which contains the authentication gates, configuration troubleshooting guidance, and shared security rules
CRITICAL — When the user's goal is another business command, you must first determine whether it is blocked by authentication before deciding whether to enter this skill. CRITICAL —
auth
is an identity/TTY workflow, and
--dry-run
is not registered anywhere in this workflow; do not generate that flag.
CRITICAL — The Key list, the Key selected for the current Profile, and the Key used most recently are three distinct facts. Before claiming that a Key was "used most recently," you must fully paginate through the list, parse the time zone from the actual
LastAccessTime
, and select the maximum value. The first item in the list, a date in the name,
CreateTime
, or
Active
status cannot serve as evidence of the most recent invocation. See API Key Query and Delivery for query, aggregation, and disclosure boundaries.
⚠️ 0.1.16 Change Overview (Required Reading):
  1. SSO login introduces Gate 1+2: after the browser flow, compare the SSO trn with
    is_default profile.OwnerTrn
    . Route the four cases respectively to
    BuildFirstProfile
    (create a new Profile),
    GUIDE_SKIP
    (reuse the existing Profile), a prompt to switch the default Profile, or a prompt to create a new Profile. See
    docs/runtime/volc-sso.md
    .
  2. The AK/SK login channel is temporarily disabled:
    auth login --access-key / --secret-key
    has been commented out, and the "AK/SK" option has also been removed from promptui. SSO (Volcengine) and
    arkcli auth login --no-browser
    (registered under auth login and inherited by volc-sso) are the only login entry points.
  3. The
    auth status
    /
    auth whoami
    output now includes Profile facet fields
    :
    active_profile.{name,type,region,project,owner_trn}
    and
    profiles_summary[...]
    . All legacy top-level fields, including
    auth_method/logged_in/volc_sso/ark_api_key
    , are retained for backward compatibility.
  4. Profile management has moved to
    arkcli profile
    :
    config init/list/show/switch/delete
    are deprecated. See
    ../arkcli-config/SKILL.md
    .
  5. Starting with 0.1.17, project selection during first login is dynamic: the project step in
    BuildFirstProfile
    now uses IAM
    ListProjects
    to fetch the real list of active projects under the current identity and lets the user select interactively. If the request fails or the user lacks permission, it falls back to
    default
    without blocking login. To change the project after login, there is no need to log in again: use
    arkcli profile project [<name>]
    to fetch the same list and select another project. This re-derives the platform Profile for the new project while preserving the Personal plan Profile. See
    ../arkcli-profile/SKILL.md
    .
  6. Starting with 1.0.4, the interactive browser SSO branch of
    arkcli auth login
    can borrow the local volcengine-cli login state
    : when
    ve >= 1.0.45
    is detected and the user has run
    ve login
    , arkcli directly takes over the STS session and writes an arkcli identity (
    identity_store/<key>/metadata.json.source="ve"
    ; IDToken/refresh_token/ClientID are not written because the STS session is held internally by volcengine-go-sdk and automatically refreshed using refresh_token). From the user's perspective, this saves one browser authorization. From the agent's perspective,
    auth_method
    becomes
    "sts"
    instead of
    "sso"
    , while
    logged_in=true
    . If detection fails or ve is not logged in, arkcli automatically falls back to its native SSO OAuth flow. See the "Borrowing the volcengine-cli Login State" section in
    references/arkcli-auth-login.md
    .

适用场景

Applicable Scenarios

  • 第一次登录
    arkcli
  • 切换到 Volc SSO
<!-- AK/SK 通道在 0.1.16 暂关 (见上方说明); 恢复后取消下条注释 --> <!-- - 使用 AK/SK 做非交互登录 -->
  • 登录后重新获取或切换 ARK API Key
  • 查看当前凭证状态
  • 回答"我是谁 / 我的 IAM ID 是多少 / 我属于哪个账号"——用
    arkcli auth whoami
  • 清理本地登录状态
  • 其他业务 skill 因未登录、凭证过期、身份不匹配而被阻塞
  • 云开发机 / CI 已注入
    VOLC_INIT_*
    凭证,无交互引导
    —— 用
    arkcli init-volc
    (不是 SSO)
  • Log in to
    arkcli
    for the first time
  • Switch to Volc SSO
<!-- The AK/SK channel is temporarily disabled as of 0.1.16 (see the overview above); remove the comment below when it is restored --> <!-- - Use AK/SK for non-interactive login -->
  • Re-obtain or switch the ARK API Key after logging in
  • View the current credential status
  • Answer "Who am I / What is my identity / Who is the current user / Which account am I using / What is my IAM user ID" — use
    arkcli auth whoami
  • Clear the local login state
  • Another business skill is blocked because the user is not logged in, the credentials have expired, or the identity does not match
  • Cloud development machines / CI already have
    VOLC_INIT_*
    credentials injected and require a non-interactive bootstrap — use
    arkcli init-volc
    , not SSO

无交互引导(init-volc)

Non-Interactive Bootstrap (init-volc)

云开发机 / CI 等已经把火山凭证注入成
VOLC_INIT_*
环境变量
的场景,用
arkcli init-volc
一条命令、零交互地落一个火山 platform profile 并设为 default,让后续 arkcli / OpenCode 调用开箱即用(数据面用 API Key,控制面用 STS)。
  • 触发词:"云开发机引导 / 无交互初始化 / 已注入 VOLC_INIT 怎么让 arkcli ready / CI 里跳过 SSO"
  • 跟
    auth login
    的区别:
    init-volc
    不登录、不交互、不联网,纯消费环境变量;本地终端用户首次引导仍走
    auth login
    (SSO)
  • 详细环境变量契约、落地行为、输出见
    references/arkcli-auth-init-volc.md
In scenarios where cloud development machines, CI, or other environments have already injected Volcengine credentials as
VOLC_INIT_*
environment variables,
arkcli init-volc
can write a Volcengine platform Profile to local storage and set it as the default with a single zero-interaction command. Subsequent arkcli / OpenCode calls then work out of the box: the data plane uses an API Key, while the control plane uses STS.
  • Trigger phrases: "cloud development machine bootstrap / non-interactive initialization / VOLC_INIT is already injected, how do I make arkcli ready / skip SSO in CI"
  • Difference from
    auth login
    :
    init-volc
    does not log in, interact, or access the network; it only consumes environment variables. First-time bootstrap for local terminal users still uses
    auth login
    (SSO)
  • See
    references/arkcli-auth-init-volc.md
    for the detailed environment-variable contract, persistence behavior, and output

Agent 快速执行顺序

Agent Quick Execution Order

待授权优先于重新登录。 本轮或用户提供的上一轮状态为
stage=authorize_pending
、用户尚未完成授权且没有 code 时,等待用户;不要重新执行任何
auth login
、
config init
或原业务命令。可只读检查一次
auth status
:若已有所需的有效凭据则恢复原任务;
logged_in=false
只说明尚未登录,不表示 pending 过期或丢失,仍须等待。仅收到 CLI 明确的会话过期/不存在错误或用户明确要求重启登录,才重开 Phase 1。
  1. 业务命令开始前如果不确定认证状态,先执行
    arkcli auth status
  2. 需要识别当前用户身份("我创建的 / 我的 xxx" 语义)时,用
    arkcli auth whoami
    ,不要去
    ~/.arkcli/.env
    里手动解 JWT
  3. 未登录或凭证失效时,火山方舟场景直接通过 Bash 执行
    arkcli auth login volc-sso
    (不要只是"提示用户去跑")。SSO 是 0.1.16 唯一可用登录通道,覆盖控制面 BFF + 数据面绝大多数能力
    • 执行前用一句话告知用户:"检测到未登录,我现在为你启动 SSO 登录,请在弹出的浏览器中完成授权"
    • Bash 调用必须设
      timeout=600000
      (10 分钟)
    • 启动失败(浏览器没装、
      open
      失败、端口被占用、超时等)→ 不原地重试,把 stderr 贴回给用户,请用户手动在终端跑对应租户的登录命令(火山:
      arkcli auth login volc-sso
      )
    • 命令成功后立即回到用户原始任务,不要停在 auth 结果
  4. agent / 沙箱 / CI 无浏览器登录走两段式
    --no-browser
    (AK/SK 通道 0.1.16 暂关,提到 AK/SK 时告知并引导走这里):agent 终端通常非 TTY,
    --no-browser
    现为两段式,不再阻塞读 stdin(旧版在沙箱必报
    读取授权码失败: EOF
    —— 进程在拿到授权码前就被 EOF 打断):
    • Phase 1:跑
      arkcli auth login --no-browser
      。它打印授权 URL 并以 JSON 输出
      {"stage":"authorize_pending","authorize_url":"...","next_command":"..."}
      后立即退出(不傻等)。把
      authorize_url
      原样转发给用户,请他在任意设备浏览器完成 SSO,复制页面显示的 base64 授权码回来。
    • Phase 2:拿到授权码后跑
      arkcli auth login --no-browser --code <授权码>
      完成登录(读 Phase 1 落盘的 PKCE/state 换 token)。
      --code
      必须连
      --no-browser
      (单独写会报
      --code 仅在 --no-browser 模式下有效
      )。
    • 两段必须同一运行环境:Phase 1 落盘
      ~/.arkcli/.sso-pending.json
      、Phase 2 读它接力,两条命令须共享同一
      HOME
      / 同一持久化卷
      (同一容器 / 开发机);跨容器或跨 HOME 派发会让 Phase 2 报「没有待完成的…会话」。期间不要动
      ~/.arkcli/
      。
    • flag 位置:
      --no-browser
      /
      --code
      注册在
      auth login
      ,并由
      volc-sso
      继承;两种入口都支持。Agent 示例统一用
      arkcli auth login --no-browser
      ,Phase 2 同时带
      --no-browser --code
      。
    • 出错恢复:
      会话过期(TTL 10min)
      /
      没有待完成的会话
      → 重跑 Phase 1(确保同一 HOME);
      base64 解码失败
      /
      state 不匹配(CSRF)
      / token 交换瞬时失败 → pending 仍在盘,TTL 内纠正后直接重试 Phase 2(贴对当前 authorize_url 的码,必要时从同一 URL 重新授权拿新码),不必重跑 Phase 1。
    • 真人终端(TTY)下
      arkcli auth login --no-browser
      仍是一条命令交互式(打印 URL 后当场粘贴),行为不变。
  5. 用户明确要求挑选登录方式时,因 stdin 交互 agent 无法替用户选,让用户自己跑
    arkcli auth login
  6. 只有在用户明确要求清理本地凭证时,才执行
    arkcli auth logout
Pending authorization takes priority over logging in again. If the current turn or the user-provided state from the previous turn is
stage=authorize_pending
, the user has not completed authorization, and no code is available, wait for the user. Do not rerun any
auth login
,
config init
, or original business command. You may perform one read-only
auth status
check: if the required valid credentials already exist, resume the original task.
logged_in=false
only means that the user has not logged in; it does not mean that the pending session has expired or been lost, so you must still wait. Restart Phase 1 only when the CLI explicitly reports that the session has expired or does not exist, or when the user explicitly requests restarting login.
  1. If you are unsure about the authentication state before starting a business command, run
    arkcli auth status
    first.
  2. When you need to identify the current user, such as for semantics such as "created by me" or "my xxx," use
    arkcli auth whoami
    . Do not manually decode the JWT in
    ~/.arkcli/.env
    .
  3. When the user is not logged in or the credentials are invalid, run
    arkcli auth login volc-sso
    directly through Bash for Volcengine Ark scenarios
    ; do not merely tell the user to run it. SSO is the only available login channel as of 0.1.16 and covers most control-plane BFF and data-plane capabilities.
    • Before running it, tell the user in one sentence: "Authentication was not detected. I will now start SSO login for you. Please complete the authorization in the browser that opens."
    • The Bash call must set
      timeout=600000
      (10 minutes).
    • If startup fails, such as because the browser is not installed,
      open
      fails, the port is occupied, or the command times out, do not retry in place. Return the stderr to the user and ask them to run the login command for the corresponding tenant manually (Volcengine:
      arkcli auth login volc-sso
      ).
    • Immediately return to the user's original task after the command succeeds. Do not stop at the authentication result.
  4. For agent, sandbox, or CI environments without a browser, use the two-stage
    --no-browser
    flow
    . The AK/SK channel is temporarily disabled as of 0.1.16; when the user mentions AK/SK, explain this and direct them here. Agent terminals are usually non-TTY, and
    --no-browser
    is now a two-stage flow that no longer blocks while reading stdin. The old version always failed in sandboxes with
    读取授权码失败: EOF
    because the process was interrupted by EOF before it received the authorization code.
    • Phase 1: Run
      arkcli auth login --no-browser
      . It prints the authorization URL, outputs JSON such as
      {"stage":"authorize_pending","authorize_url":"...","next_command":"..."}
      , and exits immediately instead of waiting indefinitely. Forward
      authorize_url
      to the user exactly as-is and ask them to complete SSO in a browser on any device, then copy the base64 authorization code shown on the page.
    • Phase 2: After receiving the authorization code, run
      arkcli auth login --no-browser --code <authorization code>
      to complete login. Phase 2 reads the PKCE/state persisted by Phase 1 and exchanges it for a token.
      --code
      must be used together with
      --no-browser
      ; using it alone results in
      --code 仅在 --no-browser 模式下有效
      .
    • Both phases must run in the same runtime environment: Phase 1 writes
      ~/.arkcli/.sso-pending.json
      , and Phase 2 reads it for handoff. Both commands must share the same
      HOME
      or persistent volume, such as the same container or development machine. Dispatching them across different containers or different HOME directories causes Phase 2 to report
      没有待完成的…会话
      . Do not modify
      ~/.arkcli/
      during this period.
    • Flag location:
      --no-browser
      and
      --code
      are registered under
      auth login
      and inherited by
      volc-sso
      ; both entry points support them. Agent examples consistently use
      arkcli auth login --no-browser
      , and Phase 2 includes both
      --no-browser
      and
      --code
      .
    • Error recovery: For
      会话过期(TTL 10min)
      or
      没有待完成的会话
      , rerun Phase 1 while ensuring it uses the same HOME. For
      base64 解码失败
      ,
      state 不匹配(CSRF)
      , or a transient token-exchange failure, the pending session remains on disk. Correct the issue and retry Phase 2 directly within the TTL; paste the code associated with the current
      authorize_url
      , and reauthorize from the same URL for a new code if necessary. There is no need to rerun Phase 1.
    • In a human-operated TTY,
      arkcli auth login --no-browser
      remains a single interactive command that prints the URL and accepts a pasted code immediately. Its behavior is unchanged.
  5. When the user explicitly asks to choose a login method, an agent using stdin-based interaction cannot make the selection for them. Ask the user to run
    arkcli auth login
    themselves.
  6. Run
    arkcli auth logout
    only when the user explicitly requests that local credentials be cleared.

核心规则

Core Rules

  • auth status
    是默认入口;不要上来就
    login
  • 登录成功后,应回到用户原始目标继续执行,而不是停在 auth 结果本身
  • auth logout
    是破坏性操作,必须由用户明确提出
  • auth status
    会对敏感字段做掩码,可直接用于排障,并会展示当前生效的
    project_name
  • auth login
    成功后会输出
    auth_method
    ;凭证存储位置是实现细节,不再回显路径
  • SSO 登录(
    arkcli auth login volc-sso
    )与
    auth apikey
    都会在选中 API Key 之后写入凭证存储;0.1.16 final clean-slate 模型: 整 arkcli 同一时间只 active 一个 identity, 新 SSO 跟旧 sub 不一致时清空所有 profile (含跨 tenant) 重建
  • API Key 必须按 profile 类型分池理解:
    platform
    /
    coding-plan
    个人版使用普通 API Key;
    agent-plan
    个人版使用
    Scene=RealAgentPlanPersonal
    的专属 Key;
    agent-plan-team
    /
    coding-plan-team
    使用
    GetSeatInfo
    返回的席位 Key。普通池里“有 Key”不能证明 Agent Plan/团队版 Key 可用。
  • TTY 首登发现普通池为空时会先询问是否创建;确认后只调用一次
    CreateApiKey
    ,再最多读 3 次状态。Agent Plan 专属记录存在但非 Active 时会询问是否轮转;确认后也只轮转一次、最多读 3 次状态。非 TTY、用户拒绝或无专属记录时绝不写。
  • TTY 首登中,如果用户选择的 profile 类型在 API Key 获取阶段报错(例如 Agent Plan 轮转后检查 3 次仍为
    Restricted
    ),CLI 会保留已选 region/project、从本轮候选中移除该失败类型,并重新让用户选择其他消费场景。失败类型不会再次 silent backfill,避免重复获取或二次轮转;这属于 profile 级重选,绝不会拿普通/Coding Plan Key 冒充 Agent Plan 专属 Key。
  • v3 ve handoff 分支 (1.0.4 起, 仅火山 SSO 交互式登录): 检测到本机装有
    volcengine-cli >= 1.0.45
    且已
    ve login
    时,
    arkcli auth login
    会先尝试借用其登录态直接落 arkcli identity (省一次浏览器授权)。落盘差异见
    references/arkcli-auth-login.md
    : 不落
    token.json
    (IDToken/refresh_token/ClientID 由 ve SDK 管), 但落
    sts.json
    +
    metadata.json.source="ve"
    ;
    auth whoami
    显示
    auth_method="sts"
    而非
    "sso"
    , 是合法登录态。检测失败 / ve 未登录 → 自动降级 arkcli 原生 SSO OAuth。
  • arkcli auth apikey
    只列举并选择普通 API Key 池,写入 identity/.env 兼容凭证;它不读取或修复 Agent Plan 专属 Key、也不读取团队席位 Key。当前是 Plan profile 时优先使用
    profile apikey refresh
    或对应 Plan 的轮转/席位流程,不能把
    auth apikey
    的
    saved=true
    解读为 Plan Key 已恢复。它也不能让广场语音模型获得
    +chat
    /
    +gen
    /
    +deploy
    /
    +code-example
    /
    usage
    /
    pricing
    能力。
  • arkcli auth apikey create
    创建、验证并保存一把普通 API Key到当前 identity/.env 兼容凭证;TTY 必须确认,非交互环境收到
    requires_confirmation
    后必须走共享 Skill 的宿主确认流程;只发一次
    CreateApiKey
    ,随后最多做 3 次只读状态检查,成功输出不包含明文 Key。它同样不能创建或修复 Agent Plan 专属 Key、团队席位 Key;已有 Profile 要切换默认 Key 时仍用
    profile apikey refresh/use
    。
  • 火山 Agent Plan 个人版/企业版 TTS 使用
    arkcli-gen
    的
    +gen --modality audio
    ;个人版使用专属 Key,企业版使用席位 Key,不能用
    auth apikey
    的普通 Key 替代。原生 ASR 同样使用已绑定的 Agent Plan Key,走
    +understand asr/asr-align --audio-protocol ws-bidirectional|ws-unidirectional
    。其他未实现语音能力只说明边界。
  • 只查不切的 list API Key(只想看 account 下有哪些 key,不想切换当前 key): 跑
    arkcli api apikey.list --params '{"PageSize":100}' --page-all --format json
    ,不要跑
    auth apikey
    — 后者是交互式选择并写入凭证存储,会改变当前生效 key
  • 当前已选 key 的元信息(name / suffix / project / 状态): 看
    auth status
    输出里的
    ark_api_key
    字段,不需要再调远端
  • auth status
    is the default entry point; do not start with
    login
    .
  • After login succeeds, return to the user's original goal and continue executing it instead of stopping at the authentication result.
  • auth logout
    is destructive and must be explicitly requested by the user.
  • auth status
    masks sensitive fields, so its output can be used directly for troubleshooting. It also displays the currently effective
    project_name
    .
  • After
    auth login
    succeeds, it outputs
    auth_method
    . The credential storage location is an implementation detail and is no longer echoed.
  • Both SSO login through
    arkcli auth login volc-sso
    and
    arkcli auth apikey
    write the selected API Key to the credential store. In the final clean-slate model introduced in 0.1.16, arkcli has only one active identity at a time. If a new SSO identity is inconsistent with the old
    sub
    , all Profiles, including those from other tenants, are cleared and rebuilt.
  • API Keys must be understood as pools separated by Profile type:
    platform
    and
    coding-plan
    Personal use ordinary API Keys;
    agent-plan
    Personal uses a dedicated Key with
    Scene=RealAgentPlanPersonal
    ;
    agent-plan-team
    and
    coding-plan-team
    use the seat Key returned by
    GetSeatInfo
    . The presence of a Key in the ordinary pool does not prove that an Agent Plan or team Key is available.
  • When the ordinary pool is empty during TTY first login, the CLI first asks whether to create one. After confirmation, it calls
    CreateApiKey
    exactly once and then reads the status at most three times. When a dedicated Agent Plan record exists but is not Active, it asks whether to rotate it. After confirmation, it also rotates the Key exactly once and reads the status at most three times. In non-TTY environments, when the user declines, or when no dedicated record exists, it must never write anything.
  • If API Key acquisition fails for the Profile type selected during TTY first login, such as when an Agent Plan Key remains
    Restricted
    after three checks following rotation, the CLI preserves the selected region and project, removes the failed type from the current round's candidates, and asks the user to select another usage scenario. The failed type is never silently backfilled again, preventing repeated acquisition or a second rotation. This is a Profile-level reselection and never uses an ordinary or Coding Plan Key as a substitute for a dedicated Agent Plan Key.
  • v3 ve handoff branch (available since 1.0.4, only for interactive Volcengine SSO login): when a local volcengine-cli version of at least 1.0.45 is detected and the user has run
    ve login
    ,
    arkcli auth login
    first attempts to borrow that login state and directly create an arkcli identity, saving one browser authorization. The persistence differences are documented in
    references/arkcli-auth-login.md
    :
    token.json
    is not written because IDToken/refresh_token/ClientID are managed by the ve SDK, but
    sts.json
    and
    metadata.json.source="ve"
    are written.
    auth whoami
    reports
    auth_method="sts"
    instead of
    "sso"
    , which is a valid authenticated state. If detection fails or ve is not logged in, arkcli automatically falls back to its native SSO OAuth flow.
  • arkcli auth apikey
    only enumerates and selects a Key from the ordinary API Key pool and writes it to the identity/.env-compatible credential store. It does not read or repair Agent Plan dedicated Keys or team seat Keys. When the current Profile is a Plan Profile, prefer
    profile apikey refresh
    or the corresponding Plan rotation or seat flow. Do not interpret
    auth apikey
    returning
    saved=true
    as evidence that the Plan Key has been restored. It also does not enable
    +chat
    ,
    +gen
    ,
    +deploy
    ,
    +code-example
    ,
    usage
    , or
    pricing
    capabilities for marketplace speech models.
  • arkcli auth apikey create
    creates, validates, and saves one ordinary API Key to the current identity/.env-compatible credential store. TTY use requires confirmation. In a non-interactive environment,
    requires_confirmation
    must follow the host confirmation flow defined by the shared Skill. The command sends
    CreateApiKey
    exactly once and then performs at most three read-only status checks. Successful output does not include the plaintext Key. It likewise cannot create or repair Agent Plan dedicated Keys or team seat Keys. To switch the default Key for an existing Profile, continue to use
    profile apikey refresh/use
    .
  • For TTS on Volcengine Agent Plan Personal/Enterprise, use
    arkcli-gen
    's
    +gen --modality audio
    . Personal uses a dedicated Key, while Enterprise uses a seat Key; an ordinary Key from
    auth apikey
    cannot be substituted. Native ASR also uses the already-bound Agent Plan Key and the
    +understand asr/asr-align --audio-protocol ws-bidirectional|ws-unidirectional
    entry point. For other unimplemented speech capabilities, only explain their boundaries.
  • Read-only API Key list (only wanting to see which Keys exist under the account without switching the current Key): run
    arkcli api apikey.list --params '{"PageSize":100}' --page-all --format json
    . Do not run
    auth apikey
    ; the latter interactively selects a Key, writes it to the credential store, and changes the currently effective Key.
  • Metadata for the currently selected Key (name / suffix / project / status): inspect the
    ark_api_key
    field in the
    auth status
    output. There is no need to make another remote request.

与其他 skill 的串联

Integration with Other Skills

查询 Key 列表、辨别掩码与明文、向下游注入凭证前,先读 API Key 查询与交付。保留“查元数据 → 定位真实 ID → 必要时授权导出”的业务流程;不要默认回显全部明文。
  • arkcli-models
    、
    arkcli-chat
    、
    arkcli-gen
    、
    arkcli-deploy
    、
    arkcli-usage
    被鉴权错误阻塞时,先回到这里
  • 如果用户其实是在排查 profile / base-url / region 覆盖问题,应转
    ../arkcli-config/SKILL.md
Before querying the Key list, distinguishing masked values from plaintext, or injecting credentials into downstream systems, read API Key Query and Delivery. Preserve the workflow of querying metadata, locating the real ID, and authorizing an export when necessary. Do not echo all plaintext values by default.
  • If
    arkcli-models
    ,
    arkcli-chat
    ,
    arkcli-gen
    ,
    arkcli-deploy
    , or
    arkcli-usage
    is blocked by an authentication error, return here.
  • If the user is actually troubleshooting a Profile, base-url, or region override issue, redirect them to
    ../arkcli-config/SKILL.md
    .

自然语言触发词 + 跨技能指引表

Natural-Language Trigger and Cross-Skill Guidance Table

用户怎么说走哪个命令/skill
"我是谁/我的身份/当前用户/哪个账号/我自己的 IAM 用户 ID"
arkcli auth whoami
"查同事 zhangsan 的 IAM 用户 ID/查别人的 IAM 用户 ID"转
arkcli-profile
(查看当前 profile 并列出可用 API Key)+ 提示用户使用
arkcli iam
命令(如有)
"API Key 泄露/废弃旧 Key/换新 Key/rotate/轮换 API Key"转
arkcli-plans
:
plans personal rotate-apikey
或
plans team rotate-apikey
"命令突然报 key 失效/401/InvalidApiKey 但我没换过 key"(疑似后端轮换)转
arkcli-profile
:先
arkcli profile apikey refresh
同步后端 key 再重试(遇失败才触发的反应式自愈,非预防性);refresh 救不了再看
references/auth-modes.md
"看账号有哪些 Key/Key 列表/只查不切"
arkcli api apikey.list
,按上述 reference 分页查看元数据,不改变当前 Key
"看当前 Profile 的 Key 库存"转
arkcli-profile
:说明同步影响后用
profile apikey list
"切换默认 Key/用另一个 Key"转
arkcli-profile
:
arkcli profile apikey use <key>
"创建一把普通 API Key"
arkcli auth apikey create
;非交互环境按
requires_confirmation
走宿主确认流程
"AK/SK 登录/access key/secret key"告知通道暂关:当前版本 AK/SK 登录通道暂时关闭,请使用 SSO 登录,运行
arkcli auth login
What the user saysWhich command/skill to use
"Who am I / my identity / current user / which account / my own IAM user ID"
arkcli auth whoami
"Find colleague zhangsan's IAM user ID / find another person's IAM user ID"Transfer to
arkcli-profile
to view the current Profile and list available API Keys, and suggest the
arkcli iam
command if available
"API Key leaked / deprecate an old Key / replace it / rotate the API Key"Transfer to
arkcli-plans
: use
plans personal rotate-apikey
or
plans team rotate-apikey
"The command suddenly reports that the Key is invalid / 401 / InvalidApiKey even though I never changed it" (suspected backend rotation)Transfer to
arkcli-profile
: first run
arkcli profile apikey refresh
to synchronize the backend Key, then retry. This is reactive self-healing triggered by a failure, not a preventive step. If refresh does not resolve the issue, see
references/auth-modes.md
"Show the account's Keys / list Keys / list only without switching"
arkcli api apikey.list
; paginate and view metadata according to the reference above without changing the current Key
"Show the current Profile's Key inventory"Transfer to
arkcli-profile
and explain the synchronization impact before using
profile apikey list
"Switch the default Key / use another Key"Transfer to
arkcli-profile
:
arkcli profile apikey use <key>
"Create an ordinary API Key"
arkcli auth apikey create
; in a non-interactive environment, follow the host confirmation flow when
requires_confirmation
is returned
"AK/SK login / access key / secret key"Explain that the channel is temporarily disabled: the AK/SK login channel is temporarily closed in the current version. Use SSO login by running
arkcli auth login

命令一览

Command Overview

命令说明
arkcli auth status
查看当前认证状态(凭证健康度)
arkcli auth whoami
查看当前认证身份(用户名 / IAM 用户 ID / 账号 ID 等),脚本与 Skill 用
arkcli auth login
交互式选择登录方式(火山 SSO 浏览器 / 火山 SSO 无浏览器)
arkcli auth login volc-sso
浏览器 SSO 登录
arkcli auth login --no-browser
无浏览器 SSO(cross-device)。TTY:一条命令交互式粘贴;非 TTY(agent/沙箱):Phase 1,打印 URL +
authorize_pending
JSON 后退出
arkcli auth login --no-browser --code <授权码>
无浏览器 SSO Phase 2:把 base64 授权码喂回完成登录(agent/沙箱两段式的第二步)
<!-- AK/SK 通道 0.1.16 暂关; 恢复后取消下行注释 --> <!-- \| `arkcli auth login --access-key <ak> --secret-key <sk>` \| 非交互 AK/SK 登录 \| -->
|
arkcli auth apikey
| 选择普通 API Key 并写入对应 identity store;不代表 Agent Plan 专属/团队席位 Key 可用 | |
arkcli auth apikey create
| 创建、验证并保存一把普通 API Key 到当前身份;不输出明文 Key,不处理 Plan 专属/席位 Key | |
arkcli auth logout
| 删除本地凭证 |
CommandDescription
arkcli auth status
View the current authentication state and credential health
arkcli auth whoami
View the currently authenticated identity, such as the username, IAM user ID, or account ID; intended for scripts and Skills
arkcli auth login
Interactively select a login method: Volcengine SSO in a browser or Volcengine SSO without a browser
arkcli auth login volc-sso
Browser-based SSO login
arkcli auth login --no-browser
Browserless SSO for cross-device use. In a TTY, this is one interactive command for pasting the code. In a non-TTY environment such as an agent or sandbox, Phase 1 prints the URL and
authorize_pending
JSON, then exits
arkcli auth login --no-browser --code <authorization code>
Browserless SSO Phase 2: feed the base64 authorization code back to complete login. This is the second step of the two-stage agent/sandbox flow
<!-- The AK/SK channel is temporarily disabled as of 0.1.16; remove the comment below when it is restored --> <!-- | `arkcli auth login --access-key <ak> --secret-key <sk>` | Non-interactive AK/SK login | -->
|
arkcli auth apikey
| Select an ordinary API Key and write it to the corresponding identity store; this does not mean that an Agent Plan dedicated Key or team seat Key is available | |
arkcli auth apikey create
| Create, validate, and save an ordinary API Key for the current identity without exposing the plaintext Key; does not handle Plan dedicated Keys or seat Keys | |
arkcli auth logout
| Delete local credentials |

参考

References

  • references/arkcli-auth-login.md
  • references/arkcli-auth-status.md
  • references/arkcli-auth-whoami.md
  • references/arkcli-auth-login.md
  • references/arkcli-auth-status.md
  • references/arkcli-auth-whoami.md