SEI Robotics Logo
Internal Staff Guide

Claude Code Setup Guide

Install Claude Code and connect it to OpenRouter for AI-powered coding assistance. Follow the steps below for your operating system.

1

Prerequisites

🌐

Internet

Required for installation and API calls.

💻

Terminal

macOS Terminal, Linux shell, or Windows PowerShell / CMD.

🔑

OpenRouter Account

Free sign-up at openrouter.ai.

📦

Git (Windows only)

Install Git for Windows before proceeding.

2

Create an OpenRouter API Key

  1. 1

    Go to openrouter.ai and click Sign Up.

    You can sign up with Google, GitHub, or email.

  2. 2

    Navigate to Settings → Keys.

  3. 3

    Click "Create Key".

    Give it a descriptive name, e.g., claude-code-work.

  4. 4

    Copy your API key immediately.

    It starts with sk-or-v1- and is only shown once. Store it in a password manager.

  5. 5

    (Optional) Add credits at openrouter.ai/credits.

    Credits are required to make API calls. Usage is pay-as-you-go.

Security reminder: Treat your API key like a password. Never share it, commit it to git, or paste it in Slack/Teams/email.

3

Install Claude Code

Option A — Native Install Recommended

Auto-updates in the background. Open Terminal and run:

curl -fsSL https://claude.ai/install.sh | bash

Option B — Homebrew

Does not auto-update — run brew upgrade claude-code periodically.

brew install --cask claude-code

Native Install Recommended

Works on most Linux distributions and WSL. Open your terminal and run:

curl -fsSL https://claude.ai/install.sh | bash

Prerequisite: Install Git for Windows first. Accept all defaults during installation.

Option A — PowerShell Recommended

Open PowerShell and run:

irm https://claude.ai/install.ps1 | iex

Option B — Command Prompt (CMD)

curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd

Option C — WinGet

Does not auto-update — run winget upgrade Anthropic.ClaudeCode periodically.

winget install Anthropic.ClaudeCode

Option D — WSL

If you have WSL set up, open your WSL terminal and use the Linux install command above.

4

Configure Environment Variables

Tell Claude Code to route requests through OpenRouter by setting these environment variables.

Step 1: Open your shell profile in a text editor.

Zsh (default on macOS)

nano ~/.zshrc

Bash (default on most Linux)

nano ~/.bashrc

Step 2: Add these lines at the bottom of the file. Replace the placeholder with your actual key.

# Claude Code — OpenRouter Configuration
export OPENROUTER_API_KEY="sk-or-v1-YOUR_KEY_HERE"
export ANTHROPIC_BASE_URL="https://openrouter.ai/api"
export ANTHROPIC_AUTH_TOKEN="$OPENROUTER_API_KEY"
export ANTHROPIC_API_KEY=""

Step 3: Save the file (in nano: Ctrl+OEnterCtrl+X).

Step 4: Reload your profile:

source ~/.zshrc    # or: source ~/.bashrc

Option A — PowerShell Commands Recommended

Run these in PowerShell. Replace the placeholder with your actual key.

[Environment]::SetEnvironmentVariable("OPENROUTER_API_KEY", "sk-or-v1-YOUR_KEY_HERE", "User")
[Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", "https://openrouter.ai/api", "User")
[Environment]::SetEnvironmentVariable("ANTHROPIC_AUTH_TOKEN", "sk-or-v1-YOUR_KEY_HERE", "User")
[Environment]::SetEnvironmentVariable("ANTHROPIC_API_KEY", "", "User")

After running, close and reopen PowerShell.


Option B — System Environment Variables (GUI)

  1. Press Win+R, type sysdm.cpl, press Enter.
  2. Go to Advanced tab → Environment Variables.
  3. Under User variables, click New and add each:
Variable Name Value
OPENROUTER_API_KEYsk-or-v1-YOUR_KEY_HERE
ANTHROPIC_BASE_URLhttps://openrouter.ai/api
ANTHROPIC_AUTH_TOKENsk-or-v1-YOUR_KEY_HERE
ANTHROPIC_API_KEY(leave empty)

Click OK to save, then close and reopen your terminal.

Important: Do not put these variables in a .env file in your project. The native Claude Code installer does not read .env files. They must be in your shell profile or set as system-level environment variables.
5

Launch & Verify

1

Open a new terminal window

Old windows won't have the new environment variables.

2

Navigate to any project folder and launch Claude Code:

cd your-project-folder
claude
3

If you were previously logged in to Anthropic, log out first:

/logout

This clears cached Anthropic credentials so OpenRouter takes over.

4

Verify the connection:

/status

You should see confirmation that your connection is active and routed through OpenRouter.

5

Try a test prompt:

What files are in this directory?

If Claude responds with a file listing — you're all set!

Success! Claude Code is now connected through OpenRouter. You can start using it for coding tasks.

6

Troubleshooting

"Authentication failed" or "Invalid API key"
  • Double-check your OPENROUTER_API_KEY starts with sk-or-v1-.
  • Make sure you opened a new terminal window after setting variables.
  • Run /logout inside Claude Code to clear old Anthropic credentials.
  • Ensure ANTHROPIC_API_KEY is set to an empty string (""), not left unset.
"Insufficient credits" or rate limit errors
"claude" command not found
  • Close and reopen your terminal after installation.
  • On Windows, ensure Git for Windows is installed.
  • Try reinstalling with the native installer.
Environment variables not being picked up
  • Do not put variables in a .env file — the native installer ignores them.
  • Variables must be in your shell profile (~/.zshrc or ~/.bashrc) or system environment variables.
  • Verify: echo $ANTHROPIC_BASE_URL (macOS/Linux) or echo %ANTHROPIC_BASE_URL% (Windows CMD).
Behind a corporate proxy

Add your proxy to your shell profile:

export HTTPS_PROXY="https://your-proxy:port"
ESAFENET (亿赛通) encryption blocking Claude Code

ESAFENET CDG uses kernel-level transparent encryption that blocks node.exe and git.exe from reading encrypted source files. IT admins need to whitelist Claude Code processes.

View full ESAFENET Compatibility Guide
7

Department CLI Tools

Curated command-line tools for each SEI Robotics department. Click any command to copy it.

8

AI Tool Recommendations

Ask our AI assistant for personalized CLI tool recommendations based on your role and workflow.

Your key is only used in your browser and sent directly to OpenRouter. It is never stored or sent anywhere else.

Hello! I'm your SEI Robotics AI assistant. Tell me your department and what you're working on, and I'll recommend the best CLI tools for your workflow.

9

Getting Started Scenarios

Three common workflows for setting up a project with Claude Code and a CLAUDE.md file. Pick the scenario that matches your situation.

1

Create your project directory

mkdir my-project && cd my-project
2

Initialize a git repository

git init
3

Launch Claude Code

claude
4

Paste the prompting framework into Claude Code

Copy the structured brief below, fill in your details, and paste it as your first message to Claude.

5

Ask Claude to generate a CLAUDE.md file

Claude will create a CLAUDE.md based on your project context.

6

Review and refine CLAUDE.md

Check the generated file, then ask Claude to adjust anything that's missing or incorrect.

7

Create a GitLab repo and push

git add -A
git commit -m "Initial project setup with CLAUDE.md"
git remote add origin https://gitlab.company.com/your-group/project-name.git
git push -u origin main

Replace gitlab.company.com with your actual self-hosted GitLab hostname.

Prompting Framework for New Projects

Copy this template, fill in the bracketed fields, and paste it as your first message to Claude Code:

I'm starting a new project. Here's the context:

Project: [name]
Department: [Android Source / APK Tools / Embedded Linux / Smart Devices / Cloud Engineering]
Purpose: [one sentence — what does this project do?]
Platform: [Android TV / Set-top box / Linux SBC / Cloud service / etc.]
Languages: [Java / Kotlin / C / C++ / Python / Go / TypeScript / etc.]
Framework: [AOSP / Buildroot / Spring Boot / FastAPI / React / etc.]
Build system: [Gradle / Make / CMake / Bazel / npm / etc.]
Key dependencies: [list main libraries or services]
Team conventions: [e.g., comments in Chinese, commit messages in English, etc.]

Please:
1. Set up the initial project structure
2. Create a CLAUDE.md file that captures all of the above
3. Include build/run/test commands in CLAUDE.md
1

Navigate to your project folder

cd /path/to/your-project
2

Initialize git if not already a repo

git init

Skip this if your project already has a .git directory.

3

Launch Claude Code

claude
4

Ask Claude to analyze and generate CLAUDE.md

Analyze this project and create a CLAUDE.md file. Include:
- Project overview and tech stack
- Build, run, and test commands
- Project structure
- Code conventions
- Key dependencies
- Deployment info
5

Review and refine CLAUDE.md

Check the generated file and ask Claude to adjust anything that's missing or incorrect.

6

Create a GitLab repo and push

git add CLAUDE.md
git commit -m "Add CLAUDE.md project documentation"
git remote add origin https://gitlab.company.com/your-group/project-name.git
git push -u origin main

Replace gitlab.company.com with your actual self-hosted GitLab hostname.

1

Clone the repository from GitLab

git clone https://gitlab.company.com/your-group/project-name.git

Replace gitlab.company.com with your actual self-hosted GitLab hostname.

2

Enter the project directory

cd project-name
3

Launch Claude Code

claude
4

Ask Claude to analyze and create CLAUDE.md

Analyze this project and create a CLAUDE.md file. Include:
- Project overview and tech stack
- Build, run, and test commands
- Project structure
- Code conventions
- Key dependencies
- Deployment info
5

Commit and push CLAUDE.md

git add CLAUDE.md
git commit -m "Add CLAUDE.md project documentation"
git push

SEI CLAUDE.md Template

Use this as a starting point when creating your CLAUDE.md file:

# Project Name

## Overview
Brief description of what this project does and which SEI Robotics department owns it.

## Tech Stack
- **Language**:
- **Framework**:
- **Build System**:
- **Target Platform**:

## Getting Started
### Prerequisites
### Build
### Run
### Test

## Project Structure
Key directories and what they contain.

## Code Conventions
- Comment language: [Chinese / English / both]
- Naming: [camelCase / snake_case / etc.]
- Commit messages: [language, format]
- Branch naming: [feature/xxx, bugfix/xxx]

## Key Dependencies
| Package | Version | Purpose |
|---------|---------|---------|

## Deployment
How and where this project is deployed.

## Team
- Department:
- GitLab group:
- Maintainers:

## Claude Code Notes
Special instructions for Claude Code when working on this project.
- Preferred models/tools
- Files to never modify
- Testing requirements before commits

Quick Reference

What Command / Link
Install (macOS / Linux) curl -fsSL https://claude.ai/install.sh | bash
Install (Windows PS) irm https://claude.ai/install.ps1 | iex
Install (Homebrew) brew install --cask claude-code
Install (WinGet) winget install Anthropic.ClaudeCode
Launch claude
Check status /status
Log out /logout
OpenRouter keysopenrouter.ai/settings/keys
OpenRouter creditsopenrouter.ai/credits
Usage dashboardopenrouter.ai/activity

Tips & Best Practices

Monitor Costs

Check openrouter.ai/activity regularly. Set spending limits in your account settings.

Stay Updated

Native installs auto-update. Homebrew/WinGet users: upgrade manually.

Provider Failover

OpenRouter routes between multiple Anthropic providers for high availability.

Never Commit Keys

Keep your API key out of code, git repos, and shared documents. Use env vars only.

Copied to clipboard