arkcli profile 是 arkcli(版本 0.1.16 引入)中的统一身份切面管理能力,把 (type × region × project × owner_trn × api_keys) 五个属性绑定为一组 profile。所有 profile 写操作统一走 arkcli profile <verb> 命令;旧的 arkcli config init/list/show/switch/delete 已 deprecated,不再引导使用。
用途
用于本地身份切面管理:列出、查看、新建、切换、删除、重命名 profile;管理 profile 内 API Key 列表;管理五类 profile 的默认资源与持久身份切面。适用于用户询问「我有哪些 profile / 当前 profile 是哪个 / 切换 profile」、创建新 profile、查看或更换 default 模型与资源、刷新过期 API Key 列表,以及业务命令报「profile xxx 缺 ...」时转回排查。
需要注意区分核对与管理:只读核对当前身份、默认资源是否可见或凭证是否兼容,不属于 Profile 管理,应改用 arkcli auth status / arkcli auth whoami 和 arkcli resources list。信息缺失不授权进入 profile show/list/keys list。
ProfileType 五种
platform:火山方舟 console 的标准用法,数据面 /api/v3,控制面 OpenTOP,视觉模型使用默认 endpoint。 agent-plan:火山方舟 Agent Plan 订阅(个人版),数据面 /api/plan/v3,控制面 OpenTOP + Plan API,视觉模型为 AgentPlanImage/VideoModels 硬编。 coding-plan:火山方舟 Coding Plan 订阅(个人版),数据面 /api/coding/v3,控制面 OpenTOP + CodingPlan API。 agent-plan-team:Agent Plan 团队席位,数据面 /api/plan/v3。 coding-plan-team:Coding Plan 团队席位,数据面 /api/coding/v3。
plan-tier 取值:agent-plan 为 small / medium / large / max;coding-plan 为 lite / pro。
主要命令
arkcli profile list:列出所有 profile(含 type/region/project 切面),替代 config list。 arkcli profile show [name]:显示当前/指定 profile 详细信息,替代 config show。 arkcli profile use [name]:切换默认 profile(无参时交互选择),替代 config switch。 arkcli profile create --type ...:新建 profile,替代 config init。 arkcli profile delete <name>:删除 profile,必须 --yes 才能跳确认,替代 config delete。 arkcli profile rename <old> --to <new>:重命名 profile。 arkcli profile project [<name>]:重选 active project,不重登。 arkcli profile keys list / keys use <key> / keys refresh:列出、切换默认、刷新 API Key。 arkcli profile models list / models refresh:查看或刷新 plan 类 profile 的模型资源。 arkcli profile set-default --modality <m> <id>:设置某 modality 的 default 资源 ID。
使用方式与行为约定
--profile flag 优先级为:--profile flag > ARK_PROFILE env > config.yaml default_profile > 第一个 type=platform 的 profile > "default" sentinel。在 resources list / profile keys refresh / profile set-default / profile models refresh 等命令上,--profile 会真正切换执行身份(内部用 Factory.RebuildForProfile(name) 重建 invoker)。
执行 profile use 前必须先跑一次 arkcli profile list --format json,只有本轮已有完整、未截断的同源列表时可复用。profile list 的结构化 stdout 是本地 profile 的唯一事实源。切换后必须跑 arkcli profile show --format json 验证实际 active profile。
设置默认资源时,用户未给具体资源 ID 时先确定 modality,再跑一次 arkcli resources list --modality <m> --format json 取候选,执行前复述目标 profile、modality 和精确 ID,并使用默认 inline verify;除非用户明确要求并接受风险,不得自行添加 --skip-verify。
限制与注意事项
Profile 是本地身份切面管理,全域不注册 --dry-run。profile show/list/keys list 会做 best-effort 在线 Key 同步,可能回写本地 Key 库存或默认 Key。运行这些管理查询前,必须在用户可见文本中说明两项影响:尝试在线同步远端 API Key、可能回写本地 Key 库存或默认 Key;执行后不得称其为「纯只读」或保证「本地 Key 未变化」。
一旦确定走 profile create、profile delete 或 profile project,必须先复述对 config.yaml 的影响并征得用户确认;其他写操作(use / set-default / keys use / keys refresh / models refresh / rename)执行前也要复述目标 profile 名。
agents 关于「Token 额度包 / 资源包」的归属:如「19 元 Token 额度包」「Token 资源包」「预付费 Token 抵扣包」等产品仍属于标准 platform 按量调用的计费产品,应沿用 type=platform 的 profile,数据面使用 platform /api/v3;价格、市场名称、Token 数量都不是 ProfileType 判据。用户只问分类时直接解释,禁止自动执行 profile create / use / set-default。
常见错误包括:set-default 的 id 不在当前可用列表、models refresh 仅 agent-plan 支持、keys refresh 遇 NotLogin 时 fetcher 用 .env 缓存单 key 兜底、切账号后 active profile 仍绑旧 identity 等。arkcli auth apikey 只操作普通 API Key 池,返回 saved=true 也不表示 Agent Plan 专属 Key 或团队席位 Key 已恢复。