{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-@l10n/zh/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"快速开始"},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"快速开始","__idx":0},"children":["快速开始"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["先检查版本和帮助，再检查正在运行的客户端。",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["doctor --output-json"]}," 返回诊断报告，应同时查看字段和退出码。"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"ml-cli --version\nml-cli doctor --output-json\nml-cli status\nml-cli env list --page-no 1 --page-size 20\nml-cli cloudphone list --page-no 1 --page-size 20\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"认证与端口选择","__idx":1},"children":["认证与端口选择"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["需要登录时为 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["login"]}," 提供 API ID 和 API Key。Local API 配置的 Bearer 安全密钥在调用时另外提供。下列内容均为占位示例。端口优先级为 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--port"]}," → ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ML_PORT"]}," → IPC 自动发现。"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"ml-cli login --api-id YOUR_API_ID --api-key YOUR_API_KEY\nexport ML_API_KEY=\"YOUR_LOCAL_API_KEY\"\nml-cli --port 40000 env list\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"powershell","header":{"controls":{"copy":{}}},"source":"$env:ML_API_KEY = \"YOUR_LOCAL_API_KEY\"\nml-cli --port 40000 env list\n","lang":"powershell"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"json输出与退出码","__idx":2},"children":["JSON、输出与退出码"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--json-data"]},"（别名 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--json"]},"）提供基础 JSON 对象；显式 flags 覆盖同名字段，省略的 flags 保留 JSON 值。团队应用布尔参数必须显式传 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]}," 或 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["false"]},"，",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["false"]}," 不会丢失。必填字段以命令帮助为准。"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"ml-cli --format table env list\nml-cli --fail-on-business-error cloudphone info --id \"$PHONE_ID\"\nml-cli --verbose env list\nml-cli --quiet env list\nml-cli env list | jq \".data.dataList\"\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["默认输出 JSON。",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--format table"]}," 提供便于阅读的视图；完整嵌套字段及管道处理应使用 JSON。",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--verbose"]}," 向 stderr 输出请求诊断信息，并遮盖已知敏感键；",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--quiet"]}," 抑制成功时的 stdout，两者不能同时使用。"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["0"]},"：正常结束。API 调用在未启用严格检查时，即使 HTTP 2xx 也可能包含业务失败。"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["1"]},"：启用 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--fail-on-business-error"]}," 后检测到顶层非零业务 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["code"]},"，或操作不受支持（如 Linux 上的 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["env arrange"]},"）。"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["2"]},"：参数或 JSON 非法、本地校验失败、端口/连接失败、HTTP 非 2xx 或输出错误。客户端命令的检测失败、严格完整性校验失败也可返回 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["2"]},"，应结合状态字段判断。"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"超时与排障","__idx":3},"children":["超时与排障"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["请求默认超时 15 秒；",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["env core-download"]}," 默认 1810 秒。显式 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--timeout"]}," 覆盖默认值。浏览器 start/open 建议 30 秒，云手机 open/power-on 使用 120 秒。"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["IPC 在 macOS/Linux 使用 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/tmp/MoreLogin-cli"]},"，Windows 使用 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\\\\.\\pipe\\MoreLogin-cli"]},"。遇到 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["connect EPERM 127.0.0.1:<port>"]},"，应先处理 AI 宿主的本地访问权限；不要重复启动，先查状态。超时意味着结果未知，重试写入前先读取状态。"]}]},"headings":[{"value":"快速开始","id":"快速开始","depth":1},{"value":"认证与端口选择","id":"认证与端口选择","depth":2},{"value":"JSON、输出与退出码","id":"json输出与退出码","depth":2},{"value":"超时与排障","id":"超时与排障","depth":2}],"frontmatter":{"seo":{"title":"快速开始"}},"lastModified":"2026-10-20T08:43:16.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/zh/cli/quick-start","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}