Loading...
Loading...
Compare original and translation side by side
| Task | Codex CLI | Claude Code CLI |
|---|---|---|
| Interactive session | | |
| With prompt | | |
| Non-interactive | | |
| Resume last | | |
| Resume by ID | | |
| 任务 | Codex CLI | Claude Code CLI |
|---|---|---|
| 交互式会话 | | |
| 带初始提示 | | |
| 非交互式 | | |
| 恢复最近会话 | | |
| 通过ID恢复会话 | | |
| Mode | Codex CLI | Claude Code CLI |
|---|---|---|
| Read-only | | |
| Workspace write | | (default) |
| Full access | | |
| Auto mode | | |
| YOLO mode | | |
| 模式 | Codex CLI | Claude Code CLI |
|---|---|---|
| 只读 | | |
| 工作区可写 | | (默认) |
| 完全访问 | | |
| 自动模式 | | |
| YOLO模式 | | |
| Task | Codex CLI | Claude Code CLI |
|---|---|---|
| Select model | | |
| Use local OSS | | N/A |
| Fallback model | N/A | |
| 任务 | Codex CLI | Claude Code CLI |
|---|---|---|
| 选择模型 | | |
| 使用本地OSS模型 | | N/A |
| 备用模型 | N/A | |
npm i -g @openai/codexnpm i -g @openai/codexundefinedundefinedcodex login # OAuth via ChatGPT
codex login --with-api-key # Read API key from stdin
codex login status # Check auth status
codex logout # Remove credentialscodex login # 通过ChatGPT进行OAuth认证
codex login --with-api-key # 从标准输入读取API密钥
codex login status # 检查认证状态
codex logout # 删除凭证codexcodexcodex # Start TUI
codex "fix all TypeScript errors" # With initial prompt
codex -i screenshot.png "explain" # With image
codex --full-auto "refactor" # Low-friction mode
codex --search "find docs" # Enable web searchcodex # 启动终端用户界面(TUI)
codex "fix all TypeScript errors" # 带初始提示启动
codex -i screenshot.png "explain" # 附带图片
codex --full-auto "refactor" # 低摩擦模式
codex --search "find docs" # 启用网页搜索codex execcodex execcodex exec "write tests" # Run and exit
codex e "task" # Short alias
echo "task" | codex exec - # From stdin
codex exec --json "task" # JSONL output
codex exec -o result.txt "task" # Save to file
codex exec --output-schema schema.json "task" # Validate outputcodex exec "write tests" # 执行任务后退出
codex e "task" # 短别名
echo "task" | codex exec - # 从标准输入读取任务
codex exec --json "task" # 输出JSONL格式
codex exec -o result.txt "task" # 将结果保存到文件
codex exec --output-schema schema.json "task" # 验证输出格式codex resumecodex resumecodex resume # Interactive picker
codex resume --last # Most recent
codex resume --all # Show all (any directory)
codex resume <session-id> # Specific session
codex resume <id> "continue with this" # With promptcodex resume # 交互式选择会话
codex resume --last # 恢复最近的会话
codex resume --all # 显示所有会话(任意目录)
codex resume <session-id> # 恢复指定会话
codex resume <id> "continue with this" # 带提示恢复会话codex reviewcodex reviewcodex review # Review current branch vs main
codex review --uncommitted # Review uncommitted changes
codex review --base develop # Against specific branch
codex review --commit abc123 # Review specific commit
codex review "focus on security" # Custom instructionscodex review # 评审当前分支与main分支的差异
codex review --uncommitted # 评审未提交的更改
codex review --base develop # 与指定分支对比评审
codex review --commit abc123 # 评审指定提交
codex review "focus on security" # 自定义评审指令codex applycodex applycodex apply <task-id> # Apply diff from cloud taskcodex apply <task-id> # 应用云端任务的差异codex cloudcodex cloudcodex cloud # Browse cloud tasks
codex cloud exec "task" --env <env-id> # Submit task
codex cloud status <task-id> # Check status
codex cloud diff <task-id> # Show diff
codex cloud apply <task-id> # Apply changescodex cloud # 浏览云端任务
codex cloud exec "task" --env <env-id> # 提交任务
codex cloud status <task-id> # 检查任务状态
codex cloud diff <task-id> # 显示差异
codex cloud apply <task-id> # 应用更改codex mcpcodex mcpcodex mcp list # List servers
codex mcp list --json # JSON output
codex mcp get <name> # Server details
codex mcp add <name> -- npx my-server # Add stdio server
codex mcp add <name> --url https://... # Add HTTP server
codex mcp add <name> --env API_KEY=xxx -- cmd # With env vars
codex mcp remove <name> # Remove server
codex mcp login <name> --scopes read,write # OAuth for HTTP
codex mcp logout <name> # Remove OAuthcodex mcp list # 列出服务器
codex mcp list --json # 以JSON格式输出
codex mcp get <name> # 查看服务器详情
codex mcp add <name> -- npx my-server # 添加标准输入输出服务器
codex mcp add <name> --url https://... # 添加HTTP服务器
codex mcp add <name> --env API_KEY=xxx -- cmd # 附带环境变量
codex mcp remove <name> # 删除服务器
codex mcp login <name> --scopes read,write # 为HTTP服务器进行OAuth认证
codex mcp logout <name> # 移除OAuth认证codex sandboxcodex sandboxundefinedundefinedundefinedundefinedcodex completioncodex completioncodex completion bash >> ~/.bashrc
codex completion zsh >> ~/.zshrc
codex completion fish > ~/.config/fish/completions/codex.fishcodex completion bash >> ~/.bashrc
codex completion zsh >> ~/.zshrc
codex completion fish > ~/.config/fish/completions/codex.fish| Command | Purpose |
|---|---|
| Switch model (gpt-5-codex, gpt-5, etc.) |
| Change approval policy |
| Summarize conversation, free context |
| Show git diff |
| Analyze working tree |
| Show config and token usage |
| List available MCP tools |
| Attach files |
| Branch conversation |
| Reopen previous session |
| Fresh conversation |
| Create AGENTS.md scaffold |
| Submit logs/diagnostics |
| Exit CLI |
| 命令 | 用途 |
|---|---|
| 切换模型(gpt-5-codex、gpt-5等) |
| 更改审批策略 |
| 总结对话,释放上下文空间 |
| 显示Git差异 |
| 分析工作目录 |
| 显示配置和令牌使用情况 |
| 列出可用的MCP工具 |
| 附加文件 |
| 分支对话 |
| 重新打开之前的会话 |
| 开启新对话 |
| 创建AGENTS.md脚手架 |
| 提交日志/诊断信息 |
| 退出CLI |
~/.codex/config.toml~/.codex/config.tomlmodel = "gpt-5-codex"
approval_policy = "on-request"
[sandbox]
mode = "workspace-write"
[features]
web_search = true
[profiles.ci]
model = "gpt-4.1"
approval_policy = "never"model = "gpt-5-codex"
approval_policy = "on-request"
[sandbox]
mode = "workspace-write"
[features]
web_search = true
[profiles.ci]
model = "gpt-4.1"
approval_policy = "never"-m, --model <MODEL> Model selection
-s, --sandbox <MODE> read-only|workspace-write|danger-full-access
-a, --ask-for-approval <P> untrusted|on-failure|on-request|never
-c, --config <KEY=VALUE> Override config
-C, --cd <DIR> Working directory
-i, --image <FILE> Attach image(s)
-p, --profile <NAME> Config profile
--full-auto Low-friction mode
--yolo Bypass all safety (DANGEROUS)
--search Enable web search
--add-dir <DIR> Grant additional write access
--enable <FEATURE> Enable feature flag
--disable <FEATURE> Disable feature flag
--oss Use local OSS model-m, --model <MODEL> 选择模型
-s, --sandbox <MODE> 沙箱模式:read-only|workspace-write|danger-full-access
-a, --ask-for-approval <P> 审批策略:untrusted|on-failure|on-request|never
-c, --config <KEY=VALUE> 覆盖配置项
-C, --cd <DIR> 指定工作目录
-i, --image <FILE> 附加图片
-p, --profile <NAME> 使用配置文件
--full-auto 低摩擦模式
--yolo 绕过所有安全检查(危险)
--search 启用网页搜索
--add-dir <DIR> 授予额外的写入权限
--enable <FEATURE> 启用功能标志
--disable <FEATURE> 禁用功能标志
--oss 使用本地OSS模型npm install -g @anthropic-ai/claude-codenpm install -g @anthropic-ai/claude-codeclaude # First run prompts login
claude setup-token # Set up long-lived tokenclaude # 首次运行时提示登录
claude setup-token # 设置长期令牌undefinedundefinedclaudeclaudeclaude # Start REPL
claude "explain this project" # With prompt
claude -c # Continue last conversation
claude -r "session-name" # Resume by name/ID
claude --model opus # Select model
claude --chrome # Enable Chrome integration
claude --ide # Auto-connect to IDEclaude # 启动REPL环境
claude "explain this project" # 带初始提示启动
claude -c # 继续上一次对话
claude -r "session-name" # 通过名称/ID恢复会话
claude --model opus # 选择模型
claude --chrome # 启用Chrome集成
claude --ide # 自动连接到IDEclaude -pclaude -pclaude -p "explain this function" # Query and exit
cat file | claude -p "explain" # Process piped input
claude -p --output-format json "q" # JSON output
claude -p --output-format stream-json "q" # Streaming JSON
claude -p --max-turns 3 "task" # Limit agent turns
claude -p --max-budget-usd 5 "task" # Spending limit
claude -p --json-schema '{...}' "q" # Validate output schemaclaude -p "explain this function" # 执行查询后退出
cat file | claude -p "explain" # 处理管道输入
claude -p --output-format json "q" # 输出JSON格式
claude -p --output-format stream-json "q" # 流式JSON输出
claude -p --max-turns 3 "task" # 限制代理交互轮次
claude -p --max-budget-usd 5 "task" # 设置支出限额
claude -p --json-schema '{...}' "q" # 验证输出JSON格式claude mcpclaude mcpclaude mcp list # List servers
claude mcp get <name> # Server details
claude mcp add <name> <cmd> # Add stdio server
claude mcp add -t http <name> <url> # Add HTTP server
claude mcp add -e KEY=val <name> -- cmd # With env vars
claude mcp add -H "Auth: Bearer x" <name> <url> # With headers
claude mcp add -s project <name> <cmd> # Project scope
claude mcp remove <name> # Remove server
claude mcp serve # Run as MCP server
claude mcp add-from-claude-desktop # Import from desktop app
claude mcp reset-project-choices # Reset approvalsclaude mcp list # 列出服务器
claude mcp get <name> # 查看服务器详情
claude mcp add <name> <cmd> # 添加标准输入输出服务器
claude mcp add -t http <name> <url> # 添加HTTP服务器
claude mcp add -e KEY=val <name> -- cmd # 附带环境变量
claude mcp add -H "Auth: Bearer x" <name> <url> # 附带请求头
claude mcp add -s project <name> <cmd> # 项目范围
claude mcp remove <name> # 删除服务器
claude mcp serve # 作为MCP服务器运行
claude mcp add-from-claude-desktop # 从桌面应用导入
claude mcp reset-project-choices # 重置审批选项claude pluginclaude pluginclaude plugin list # List plugins
claude plugin install <name> # Install plugin
claude plugin install <name>@marketplace # From specific marketplace
claude plugin uninstall <name> # Remove plugin
claude plugin enable <name> # Enable disabled plugin
claude plugin disable <name> # Disable plugin
claude plugin update <name> # Update plugin
claude plugin validate <path> # Validate manifest
claude plugin marketplace # Manage marketplacesclaude plugin list # 列出插件
claude plugin install <name> # 安装插件
claude plugin install <name>@marketplace # 从指定市场安装
claude plugin uninstall <name> # 卸载插件
claude plugin enable <name> # 启用已禁用的插件
claude plugin disable <name> # 禁用插件
claude plugin update <name> # 更新插件
claude plugin validate <path> # 验证插件清单
claude plugin marketplace # 管理插件市场claude updateclaude updateclaude update # Check and install updatesclaude update # 检查并安装更新claude doctorclaude doctorclaude doctor # Check health/issuesclaude doctor # 检查健康状态/问题claude installclaude installclaude install # Install native build
claude install stable # Specific version
claude install latest # Latest versionclaude install # 安装原生构建版本
claude install stable # 安装稳定版本
claude install latest # 安装最新版本| Command | Purpose |
|---|---|
| Generate CLAUDE.md |
| Reset context |
| Summarize conversation |
| Report issues |
| Run diagnostics |
| Switch model |
| View/edit settings |
| Manage permissions |
| View/edit memory |
| Project-specific commands |
| User-specific commands |
| 命令 | 用途 |
|---|---|
| 生成CLAUDE.md文件 |
| 重置上下文 |
| 总结对话 |
| 报告问题 |
| 运行诊断 |
| 切换模型 |
| 查看/编辑设置 |
| 管理权限 |
| 查看/编辑记忆 |
| 项目特定命令 |
| 用户特定命令 |
.claude/commands/fix-issue.mdFix GitHub issue #$ARGUMENTS
1. Read the issue details
2. Identify the problem
3. Implement the fix
4. Write tests
5. Create a commit/project:fix-issue 1234.claude/commands/fix-issue.md修复GitHub问题#$ARGUMENTS
1. 阅读问题详情
2. 定位问题
3. 实现修复
4. 编写测试
5. 创建提交/project:fix-issue 1234~/.claude/settings.json{
"model": "claude-sonnet-4-5-20250929",
"verbose": false,
"theme": "dark"
}.claude/settings.json{
"allowedTools": ["Bash(git:*)", "Read", "Edit"],
"disallowedTools": ["Bash(rm:*)"]
}~/.claude/settings.json{
"model": "claude-sonnet-4-5-20250929",
"verbose": false,
"theme": "dark"
}.claude/settings.json{
"allowedTools": ["Bash(git:*)", "Read", "Edit"],
"disallowedTools": ["Bash(rm:*)"]
}-p, --print Non-interactive mode
-c, --continue Continue last conversation
-r, --resume <ID> Resume specific session
-v, --version Show version-p, --print 非交互模式
-c, --continue 继续上一次对话
-r, --resume <ID> 恢复指定会话
-v, --version 显示版本号--model <MODEL> sonnet|opus|haiku or full name
--fallback-model <MODEL> Fallback when overloaded
--settings <FILE> Load settings JSON
--setting-sources <LIST> user,project,local
--session-id <UUID> Use specific session ID--model <MODEL> 模型选择:sonnet|opus|haiku或完整模型名称
--fallback-model <MODEL> 过载时使用的备用模型
--settings <FILE> 加载指定的JSON设置文件
--setting-sources <LIST> 设置来源:user,project,local
--session-id <UUID> 使用指定的会话ID--system-prompt <TEXT> Replace default prompt
--append-system-prompt <T> Append to default
--system-prompt-file <F> Replace with file (print only)
--append-system-prompt-file Replace with file (print only)--system-prompt <TEXT> 替换默认系统提示
--append-system-prompt <T> 追加到默认系统提示
--system-prompt-file <F> 使用文件内容替换默认提示(仅打印模式)
--append-system-prompt-file 使用文件内容追加到默认提示(仅打印模式)--agent <NAME> Specify agent
--agents <JSON> Define custom subagents
--tools <LIST> Restrict built-in tools
--allowedTools <LIST> Auto-approve tools
--disallowedTools <LIST> Remove tools from context--agent <NAME> 指定代理
--agents <JSON> 定义自定义子代理
--tools <LIST> 限制内置工具
--allowedTools <LIST> 自动批准的工具
--disallowedTools <LIST> 从上下文中移除的工具--permission-mode <MODE> acceptEdits|bypassPermissions|default|delegate|dontAsk|plan
--dangerously-skip-permissions Skip all prompts (DANGEROUS)
--allow-dangerously-skip-permissions Enable bypass option--permission-mode <MODE> 权限模式:acceptEdits|bypassPermissions|default|delegate|dontAsk|plan
--dangerously-skip-permissions 跳过所有权限提示(危险)
--allow-dangerously-skip-permissions 启用绕过选项--output-format <FMT> text|json|stream-json
--input-format <FMT> text|stream-json
--include-partial-messages Include streaming chunks
--verbose Verbose logging
--debug [FILTER] Debug mode with filtering--output-format <FMT> 输出格式:text|json|stream-json
--input-format <FMT> 输入格式:text|stream-json
--include-partial-messages 包含流式输出的片段
--verbose 详细日志
--debug [FILTER] 调试模式,支持过滤--max-turns <N> Limit agent turns (print only)
--max-budget-usd <AMT> Spending limit (print only)
--json-schema <SCHEMA> Validate JSON output
--chrome / --no-chrome Chrome integration
--ide IDE auto-connect
--fork-session Create new session on resume
--no-session-persistence Don't save session
--add-dir <DIRS> Additional directories
--plugin-dir <DIRS> Load plugins
--disable-slash-commands Disable all skills
--mcp-config <FILES> MCP server configs
--strict-mcp-config Only use specified MCP
--betas <HEADERS> Beta API headers--max-turns <N> 限制代理交互轮次(仅打印模式)
--max-budget-usd <AMT> 支出限额(仅打印模式)
--json-schema <SCHEMA> 验证JSON输出
--chrome / --no-chrome 启用/禁用Chrome集成
--ide 自动连接IDE
--fork-session 恢复会话时创建新会话
--no-session-persistence 不保存会话
--add-dir <DIRS> 额外的目录
--plugin-dir <DIRS> 加载指定目录的插件
--disable-slash-commands 禁用所有斜杠命令
--mcp-config <FILES> MCP服务器配置文件
--strict-mcp-config 仅使用指定的MCP配置
--betas <HEADERS> Beta API请求头claude --agents '{
"reviewer": {
"description": "Code reviewer. Use after changes.",
"prompt": "You are a senior code reviewer...",
"tools": ["Read", "Grep", "Glob"],
"model": "sonnet"
}
}'claude --agents '{
"reviewer": {
"description": "Code reviewer. Use after changes.",
"prompt": "You are a senior code reviewer...",
"tools": ["Read", "Grep", "Glob"],
"model": "sonnet"
}
}'- name: Run Codex
run: |
echo "${{ secrets.OPENAI_API_KEY }}" | codex login --with-api-key
codex exec --json -o result.txt "fix linting errors"- name: Run Claude
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
run: |
claude -p --output-format json "review this PR" > review.json- name: Run Codex
run: |
echo "${{ secrets.OPENAI_API_KEY }}" | codex login --with-api-key
codex exec --json -o result.txt "fix linting errors"- name: Run Claude
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
run: |
claude -p --output-format json "review this PR" > review.json--fallback-modelclaude -p --fallback-model haiku "quick task"--fallback-modelclaude -p --fallback-model haiku "quick task"undefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedcodex exec --output-schema schema.json "generate API spec"claude -p --json-schema '{"type":"object","properties":{"name":{"type":"string"}}}' "extract data"codex exec --output-schema schema.json "generate API spec"claude -p --json-schema '{"type":"object","properties":{"name":{"type":"string"}}}' "extract data"codex -i screenshot.png "explain this UI"
codex -i img1.png -i img2.png "compare these"undefinedcodex -i screenshot.png "explain this UI"
codex -i img1.png -i img2.png "compare these"undefinedundefinedundefinedundefinedundefinedundefinedundefinedcodex mcp list --json | jq .claude --debug "mcp" --mcp-config ./mcp.jsoncodex mcp list --json | jq .claude --debug "mcp" --mcp-config ./mcp.json| Problem | Codex | Claude |
|---|---|---|
| Not logged in | | |
| Token expired | | |
| API key issues | Check | Check |
| 问题 | Codex解决方案 | Claude解决方案 |
|---|---|---|
| 未登录 | | |
| 令牌过期 | | |
| API密钥问题 | 检查 | 检查 |
| Problem | Solution |
|---|---|
| Permission denied | Use |
| Can't run commands | Check sandbox mode, use |
| Network blocked | Sandbox may block network; use |
| 问题 | 解决方案 |
|---|---|
| 权限被拒绝 | 对特定目录使用 |
| 无法运行命令 | 检查沙箱模式,使用 |
| 网络被阻止 | 沙箱可能限制网络;谨慎使用 |
| Problem | Solution |
|---|---|
| Server not found | Check |
| Connection failed | Check server logs, verify URL/command |
| Auth required | Use |
| 问题 | 解决方案 |
|---|---|
| 服务器未找到 | 运行 |
| 连接失败 | 检查服务器日志,验证URL/命令是否正确 |
| 需要认证 | 使用 |
| Problem | Solution |
|---|---|
| Slow responses | Use lighter model (gpt-4.1-mini / haiku) |
| Context overflow | Use |
| High costs | Set |
| 问题 | 解决方案 |
|---|---|
| 响应缓慢 | 使用轻量模型(gpt-4.1-mini / haiku) |
| 上下文溢出 | 使用 |
| 成本过高 | 使用 |
--max-budget-usd/diffcodex cloud diff--max-budget-usd/diffcodex cloud diff