块乐Encore
Getting Started

Claude Integration Guide

Connect Claude and Claude Code through the Encore gateway.

This page explains how to use Anthropic Claude models and Claude Code through the Encore gateway.

Typical Use Cases

  • Using the official Anthropic SDK
  • Using Anthropic-compatible clients
  • Using Claude Code CLI
  • Sending direct HTTP requests to Claude endpoints

Basic Configuration

Use the standard Encore gateway:

export ANTHROPIC_BASE_URL="https://api.stillhappy.cn"
export ANTHROPIC_AUTH_TOKEN="YOUR_API_KEY"

Claude Code Configuration

If your tool supports Anthropic-compatible configuration, point the base URL to Encore and use your Encore API key.

HTTP Example

curl https://api.stillhappy.cn/v1/messages \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "claude-sonnet-4",
    "max_tokens": 256,
    "messages": [
      { "role": "user", "content": "Hello" }
    ]
  }'

Latest Model (GPT-5.5) via Claude Code

If you want to use Claude Code CLI with GPT-5.5 (routed through codex group's model mapping), here are the install and configuration steps for all three platforms.

Windows

1) Install Node.js

Claude Code CLI requires Node.js. Use winget to install the LTS version:

winget install OpenJS.NodeJS.LTS

After installation, reopen PowerShell and verify:

node --version
npm --version

2) Install Claude Code CLI

In PowerShell or CMD:

npm install -g @anthropic-ai/claude-code

Verify:

claude --version

3) Configure Claude Code

Config directory on Windows is usually:

%USERPROFILE%\.claude

Config file path:

%USERPROFILE%\.claude\settings.json

Run in PowerShell:

mkdir $env:USERPROFILE\.claude
notepad $env:USERPROFILE\.claude\settings.json

Claude Code settings.json editor

Write the following into settings.json:

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.stillhappy.cn",
    "ANTHROPIC_AUTH_TOKEN": "YOUR_API_KEY",
    "ANTHROPIC_MODEL": "gpt-5.5",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "gpt-5.5",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "gpt-5.5",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "gpt-5.5"
  }
}

Replace YOUR_API_KEY with your actual API key from the Encore console.

Save and restart Claude.

macOS

1) Install Node.js

If you use Homebrew:

brew install node

Verify:

node --version
npm --version

2) Install Claude Code CLI

npm install -g @anthropic-ai/claude-code

Verify:

claude --version

3) Create config file

Config file path on macOS:

~/.claude/settings.json

Run:

mkdir -p ~/.claude
nano ~/.claude/settings.json

Write:

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.stillhappy.cn",
    "ANTHROPIC_AUTH_TOKEN": "YOUR_API_KEY",
    "ANTHROPIC_MODEL": "gpt-5.5",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "gpt-5.5",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "gpt-5.5",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "gpt-5.5"
  }
}

Replace YOUR_API_KEY with your actual API key from the Encore console.

Save and restart Claude.

Linux

1) Install Node.js

curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt-get install -y nodejs

Verify:

node --version
npm --version

2) Install Claude Code CLI

sudo npm install -g @anthropic-ai/claude-code

Verify:

claude --version

3) Create config file

mkdir -p ~/.claude
nano ~/.claude/settings.json

Write:

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.stillhappy.cn",
    "ANTHROPIC_AUTH_TOKEN": "YOUR_API_KEY",
    "ANTHROPIC_MODEL": "gpt-5.5",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "gpt-5.5",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "gpt-5.5",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "gpt-5.5"
  }
}

Replace YOUR_API_KEY with your actual API key from the Encore console.

Save and restart Claude.

Next Step

If you also need Codex configuration, continue with the Codex Integration Guide.

On this page