docs: update Claude Code setup to use env vars instead of proxy

This commit is contained in:
@uayucar 2026-04-09 11:29:54 +02:00
parent 4edb7a1386
commit 212d70bda0
1 changed files with 58 additions and 49 deletions

View File

@ -4,28 +4,36 @@
Third-party scaffoldings may be serving your data outside your environment.
For **privacy** and **cybersecurity refusal optimization**, use **CAI** to obtain the best performance.
Claude Code is Anthropic's official CLI for agentic coding. Because it speaks the **Anthropic API format** natively, it cannot talk directly to the Alias API (which is OpenAI-compatible). A small proxy is required to translate between the two.
!!! warning "Support Disclaimer"
Alias Robotics **does not provide support** for developments or integrations related to Claude Code. This page documents API compatibility only. Alias simply allows usage of the Alias API through your preferred scaffolding.
---
## How It Works
## Step 1: Install Claude Code
```
Claude Code → Anthropic API format
claude-code-proxy (localhost:8082)
OpenAI-compatible format → Alias API
### Prerequisites
- **Node.js 18** or newer
- For **macOS**, use [nvm](https://github.com/nvm-sh/nvm) to install Node.js — installing the package directly may cause permission issues
- For **Windows**, additionally install [Git for Windows](https://gitforwindows.org/)
```bash
# Install Claude Code
npm install -g @anthropic-ai/claude-code
# Navigate to your project
cd your-awesome-project
# Launch
claude
```
The proxy ([github.com/1rgs/claude-code-proxy](https://github.com/1rgs/claude-code-proxy)) intercepts Anthropic-format requests from Claude Code and forwards them to any OpenAI-compatible backend — in this case, the Alias API.
!!! note
If macOS users encounter permission issues during installation, use `nvm` to install Node.js.
---
## Setup
## Step 2: Configure the Alias API
### 1. Get your Alias API Key
@ -34,58 +42,59 @@ An `ALIAS_API_KEY` (format: `sk-...`) can be obtained from either of the followi
- **[CAI PRO](https://aliasrobotics.com/cybersecurityai.php)** — full cybersecurity AI platform with access to `alias1` and other models.
- **[Alias LLMs](https://aliasrobotics.com/aliasLLMs.php)** — acquire `alias2-mini` and other Alias language models directly.
### 2. Clone and configure the proxy
### 2. Configure Environment Variables
```bash
git clone https://github.com/1rgs/claude-code-proxy.git
cd claude-code-proxy
Set up environment variables using one of the following methods for macOS/Linux or Windows.
!!! note
Some commands show no output when setting environment variables — that's normal as long as no errors appear. A new terminal window may be required for the changes to take effect.
#### macOS & Linux
Edit the Claude Code configuration file `~/.claude/settings.json`. Add or modify the `env` fields `ANTHROPIC_BASE_URL` and `ANTHROPIC_AUTH_TOKEN`.
Replace `your_alias_api_key` with the API Key you obtained in the previous step.
```json
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "your_alias_api_key",
"ANTHROPIC_BASE_URL": "https://api.aliasrobotics.com:666/",
"API_TIMEOUT_MS": "3000000"
}
}
```
Create a `.env` file:
#### Windows Cmd
```bash
# Point to the Alias API
OPENAI_API_KEY="sk-your-alias-api-key-here"
OPENAI_BASE_URL="https://api.aliasrobotics.com:666/"
Run the following commands in Cmd. Replace `your_alias_api_key` with the API Key you obtained in the previous step.
# Map Claude model names to Alias models
BIG_MODEL="alias1"
SMALL_MODEL="alias1"
PREFERRED_PROVIDER="openai"
```cmd
setx ANTHROPIC_AUTH_TOKEN your_alias_api_key
setx ANTHROPIC_BASE_URL https://api.aliasrobotics.com:666/
```
### 3. Run the proxy
#### Windows PowerShell
Install `uv` if needed, then start the server:
Run the following commands in PowerShell. Replace `your_alias_api_key` with the API Key you obtained in the previous step.
```bash
uv run uvicorn server:app --host 0.0.0.0 --port 8082 --reload
```
Or with Docker:
```bash
docker run -d --env-file .env -p 8082:8082 ghcr.io/1rgs/claude-code-proxy:latest
```
### 4. Launch Claude Code via the proxy
```bash
ANTHROPIC_BASE_URL=http://localhost:8082 claude
```
To avoid setting this every time, export it in your shell profile:
```bash
echo 'export ANTHROPIC_BASE_URL=http://localhost:8082' >> ~/.zshrc
```powershell
[System.Environment]::SetEnvironmentVariable('ANTHROPIC_AUTH_TOKEN', 'your_alias_api_key', 'User')
[System.Environment]::SetEnvironmentVariable('ANTHROPIC_BASE_URL', 'https://api.aliasrobotics.com:666/', 'User')
```
---
## Verification
## Step 3: Start with Claude Code
Inside Claude Code, run a quick prompt and confirm the response is served via `alias1`. Token usage and billing will appear in your Alias account.
Once the configuration is complete, start using Claude Code in your terminal:
```bash
cd your-project-directory
claude
```
Token usage and billing will appear in your Alias account.
---