cyrus-setup-claude-auth

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
CRITICAL: Never use
Read
,
Edit
, or
Write
tools on
~/.cyrus/.env
or any file inside
~/.cyrus/
. Use only
Bash
commands (
grep
,
printf >>
, etc.) to interact with env files — secrets must never be read into the conversation context.
重要提示:绝对不要对
~/.cyrus/.env
~/.cyrus/
目录下的任何文件使用
Read
Edit
Write
工具。仅使用
Bash
命令(
grep
printf >>
等)操作环境变量文件——密钥绝对不能被读取到对话上下文中。

Setup Claude Auth

配置Claude身份验证

Configures Claude Code credentials so Cyrus can run AI sessions.
配置Claude Code凭证,让Cyrus可以运行AI会话。

Step 1: Check Existing Auth

步骤1:检查现有身份验证配置

Check if credentials are already configured:
bash
grep -c -E '^(ANTHROPIC_API_KEY|CLAUDE_CODE_OAUTH_TOKEN)=' ~/.cyrus/.env 2>/dev/null || echo "0"
If the count is >= 1, inform the user:
Claude Code authentication is already configured. Skipping this step. To reconfigure, remove the existing key from
~/.cyrus/.env
and re-run this skill.
Skip to completion.
检查是否已经配置了凭证:
bash
grep -c -E '^(ANTHROPIC_API_KEY|CLAUDE_CODE_OAUTH_TOKEN)=' ~/.cyrus/.env 2>/dev/null || echo "0"
如果计数大于等于1,告知用户:
Claude Code身份验证已配置,跳过此步骤。 如果需要重新配置,请从
~/.cyrus/.env
中删除现有密钥后重新运行本技能。
直接跳转到完成步骤。

Step 2: Choose Auth Method

步骤2:选择身份验证方式

Ask the user:
How would you like to authenticate Claude Code?
  1. Current account (easiest) — use the credentials from your active
    claude
    CLI session
  2. API Key — from console.anthropic.com
  3. Separate OAuth token — run
    claude setup-token
    to generate a token for a specific account
  4. Third-Party Provider — Vertex AI, AWS Bedrock, Azure, etc.
询问用户:
你希望使用哪种方式完成Claude Code身份验证?
  1. 当前账户(最简单)——使用你活跃的
    claude
    CLI会话中的凭证
  2. API Key——来自console.anthropic.com
  3. 独立OAuth令牌——运行
    claude setup-token
    为指定账户生成令牌
  4. 第三方提供商——Vertex AI、AWS Bedrock、Azure等

Step 3: Configure Credentials

步骤3:配置凭证

CRITICAL: Secrets must NEVER appear in the conversation. Do not explore
~/.claude/
looking for credential files. Use only the methods below.
Detect the OS for the right clipboard command:
bash
uname -s
**重要提示:密钥绝对不能出现在对话中。**不要浏览
~/.claude/
目录查找凭证文件,仅使用如下方法操作。
检测操作系统以选择正确的剪贴板命令:
bash
uname -s

Option 1: Current Account

选项1:当前账户

Check if
claude
is authenticated on this machine:
bash
claude auth status
If authenticated, instruct the user to run
claude setup-token
which will output a token.
To capture it safely, append a placeholder line to the env file, then open it in a GUI window so the user can paste the token:
bash
grep -q '^CLAUDE_CODE_OAUTH_TOKEN=' ~/.cyrus/.env || echo 'CLAUDE_CODE_OAUTH_TOKEN=' >> ~/.cyrus/.env
Then open the file in a separate window — use whatever GUI editor is available:
bash
undefined
检查本机上的
claude
是否已完成身份验证:
bash
claude auth status
如果已验证,指导用户运行
claude setup-token
生成令牌。
为了安全捕获令牌,先向环境变量文件追加一行占位符,然后在GUI窗口中打开文件让用户粘贴令牌:
bash
grep -q '^CLAUDE_CODE_OAUTH_TOKEN=' ~/.cyrus/.env || echo 'CLAUDE_CODE_OAUTH_TOKEN=' >> ~/.cyrus/.env
然后在独立窗口中打开文件——使用可用的任意GUI编辑器:
bash
undefined

macOS: VS Code if available, otherwise TextEdit

macOS: 优先使用VS Code,否则用TextEdit

code --new-window ~/.cyrus/.env 2>/dev/null || open -a TextEdit ~/.cyrus/.env
code --new-window ~/.cyrus/.env 2>/dev/null || open -a TextEdit ~/.cyrus/.env

Linux

Linux

code ~/.cyrus/.env 2>/dev/null || xdg-open ~/.cyrus/.env

Tell the user:

> 1. Run `claude setup-token` in a separate terminal
> 2. Copy the token it outputs
> 3. I've opened `~/.cyrus/.env` — find the `CLAUDE_CODE_OAUTH_TOKEN=` line
> 4. Paste the token right after the `=` (no spaces, no newline)
> 5. Save and close the file
code ~/.cyrus/.env 2>/dev/null || xdg-open ~/.cyrus/.env

告知用户:

> 1. 在独立终端中运行`claude setup-token`
> 2. 复制输出的令牌
> 3. 我已经打开了`~/.cyrus/.env`文件,找到`CLAUDE_CODE_OAUTH_TOKEN=`这一行
> 4. 将令牌粘贴在`=`后面(不要加空格、不要换行)
> 5. 保存并关闭文件

Option 2: API Key

选项2:API Key

Instruct the user to copy their API key from the Anthropic Console, then provide the appropriate command:
macOS:
bash
printf 'ANTHROPIC_API_KEY=%s\n' "$(pbpaste)" >> ~/.cyrus/.env
Linux:
bash
printf 'ANTHROPIC_API_KEY=%s\n' "$(xclip -selection clipboard -o)" >> ~/.cyrus/.env
Universal fallback:
bash
read -s -p "Paste your Anthropic API key: " val && printf 'ANTHROPIC_API_KEY=%s\n' "$val" >> ~/.cyrus/.env && echo " ✓ Saved"
指导用户从Anthropic控制台复制API密钥,然后运行对应命令:
macOS:
bash
printf 'ANTHROPIC_API_KEY=%s\n' "$(pbpaste)" >> ~/.cyrus/.env
Linux:
bash
printf 'ANTHROPIC_API_KEY=%s\n' "$(xclip -selection clipboard -o)" >> ~/.cyrus/.env
通用回退方案:
bash
read -s -p "粘贴你的Anthropic API密钥: " val && printf 'ANTHROPIC_API_KEY=%s\n' "$val" >> ~/.cyrus/.env && echo " ✓ 保存成功"

Option 3: Separate OAuth Token

选项3:独立OAuth令牌

This is for when the user wants to generate a token for a different account than the one currently logged in (e.g., running
claude setup-token
on another machine).
Append the placeholder, then open the file for the user to paste:
bash
grep -q '^CLAUDE_CODE_OAUTH_TOKEN=' ~/.cyrus/.env || echo 'CLAUDE_CODE_OAUTH_TOKEN=' >> ~/.cyrus/.env
bash
undefined
该方案适用于用户需要为当前登录账户之外的其他账户生成令牌的场景(例如在另一台机器上运行
claude setup-token
)。
追加占位符,然后打开文件让用户粘贴令牌:
bash
grep -q '^CLAUDE_CODE_OAUTH_TOKEN=' ~/.cyrus/.env || echo 'CLAUDE_CODE_OAUTH_TOKEN=' >> ~/.cyrus/.env
bash
undefined

macOS

macOS

code --new-window ~/.cyrus/.env 2>/dev/null || open -a TextEdit ~/.cyrus/.env
code --new-window ~/.cyrus/.env 2>/dev/null || open -a TextEdit ~/.cyrus/.env

Linux

Linux

code ~/.cyrus/.env 2>/dev/null || xdg-open ~/.cyrus/.env

Tell the user:

> 1. On the other machine, run `claude setup-token`
> 2. Copy the token it outputs
> 3. I've opened `~/.cyrus/.env` — find `CLAUDE_CODE_OAUTH_TOKEN=` and paste the token after the `=`
> 4. Save and close
code ~/.cyrus/.env 2>/dev/null || xdg-open ~/.cyrus/.env

告知用户:

> 1. 在另一台机器上运行`claude setup-token`
> 2. 复制输出的令牌
> 3. 我已经打开了`~/.cyrus/.env`文件,找到`CLAUDE_CODE_OAUTH_TOKEN=`这一行,将令牌粘贴在`=`后面
> 4. 保存并关闭文件

Option 4: Third-Party Provider

选项4:第三方提供商

Inform the user:
For third-party providers, you'll need to set provider-specific environment variables. See Third-Party Integrations for details.
Common configurations:
AWS Bedrock:
CLAUDE_CODE_USE_BEDROCK=1
AWS_REGION=us-east-1
Google Vertex AI:
CLAUDE_CODE_USE_VERTEX=1
CLOUD_ML_REGION=us-east5
ANTHROPIC_VERTEX_PROJECT_ID=your-project-id
Guide the user to add the appropriate variables to
~/.cyrus/.env
using the clipboard-to-env pattern.
告知用户:
对于第三方提供商,你需要设置对应提供商的专属环境变量。 查看第三方集成文档获取详情。
常用配置:
AWS Bedrock:
CLAUDE_CODE_USE_BEDROCK=1
AWS_REGION=us-east-1
Google Vertex AI:
CLAUDE_CODE_USE_VERTEX=1
CLOUD_ML_REGION=us-east5
ANTHROPIC_VERTEX_PROJECT_ID=your-project-id
指导用户使用剪贴板写入环境变量的模式,将对应变量添加到
~/.cyrus/.env
中。

Step 4: Verify

步骤4:验证配置

After the user runs the command, verify the key was written:
bash
grep -c -E '^(ANTHROPIC_API_KEY|CLAUDE_CODE_OAUTH_TOKEN|CLAUDE_CODE_USE_BEDROCK|CLAUDE_CODE_USE_VERTEX)=' ~/.cyrus/.env
If the count is 0, the credential was not saved. Ask the user to try again.
用户运行命令后,验证密钥是否已写入:
bash
grep -c -E '^(ANTHROPIC_API_KEY|CLAUDE_CODE_OAUTH_TOKEN|CLAUDE_CODE_USE_BEDROCK|CLAUDE_CODE_USE_VERTEX)=' ~/.cyrus/.env
如果计数为0,说明凭证未保存成功,让用户重试。

Completion

完成

✓ Claude Code authentication configured.
✓ Claude Code身份验证配置完成。