The site had drifted from the product. Every screenshot predated the v0.5.0 UI redesign, the reading experience shipped no search and no syntax highlighting, and a third of the pages were internal process artefacts — migration task lists addressed to agentic workers, a release runbook, a proposal marked "historical". Reorganise around the only two people who read this: someone getting the desktop app running for the first time, and someone reading the source. Five sections replace nine — start / desktop / im / cli / internals — and the pages that served neither reader are gone. Site rewrite: - Palette lifted from the desktop app's 「纸·墨·印」 themes, so the site and the product read as one thing. Light mirrors 纯白, dark mirrors 墨夜, and dark mode exists at all now. - Fonts are self-hosted. The old @import from Google Fonts is unreachable from mainland China, which left every heading in a fallback serif; it also only requested weight 600 while the CSS asked for 900, so Latin and CJK in the same heading disagreed. - Docs were shipped as one 968KB manifest downloaded on every page view. Split into a 32KB index plus one lazily imported chunk per page; the entry bundle is now 101KB gzipped. - Add search, syntax highlighting, per-route meta with canonical and hreflang, a sitemap, and an error boundary. Replace the 44vh mobile sidebar with a drawer. - Image dimensions are read at build time and written into the tag, so lazy images reserve their space instead of collapsing. Screenshots are recaptured from a real v0.5.0 build against a clean demo project, with tokens, QR codes and paired accounts redacted. The previous set is deleted rather than kept alongside. Routes follow file paths, so the restructure would have broken every inbound link; 37 old paths redirect, in both languages. The PR policy gate and CODEOWNERS also hardcoded docs/guide/contributing.md. Verified: check:docs 78 pages / 323 links / 0 problems, check:policy 127 pass. Walked every route at 1440 and 390 in both themes for overflow, contrast, keyboard reachability and focus management.
6.0 KiB
| title | nav_title | description | order |
|---|---|---|---|
| Environment Variables | Env Vars | Authentication, model, Azure, and local-runtime variables, plus the real precedence order. | 2 |
Environment Variables
Claude Code Haha has two configuration paths:
- Desktop users should select, test, and activate a provider under Settings → Providers. The app manages authentication, model mappings, and protocol translation.
- When running the CLI from source, use a repository
.env, shell variables, or Claude Codesettings.json.
Do not store the same API key in several places. When troubleshooting, first check whether a Desktop provider is active.
Common variables
Anthropic-compatible endpoints
| Variable | Required | Description |
|---|---|---|
ANTHROPIC_API_KEY |
Choose one authentication variable | Sent in the x-api-key request header |
ANTHROPIC_AUTH_TOKEN |
Choose one authentication variable | Sent as Authorization: Bearer |
ANTHROPIC_BASE_URL |
No | Base URL of an Anthropic Messages-compatible endpoint |
ANTHROPIC_MODEL |
No | Default model for the session |
ANTHROPIC_DEFAULT_FABLE_MODEL |
No | Fable model slot; configure it only when the provider supports it |
ANTHROPIC_DEFAULT_HAIKU_MODEL |
No | Haiku model slot |
ANTHROPIC_DEFAULT_SONNET_MODEL |
No | Sonnet model slot |
ANTHROPIC_DEFAULT_OPUS_MODEL |
No | Opus model slot |
API_TIMEOUT_MS |
No | API request timeout in milliseconds; defaults to 600000 |
The correct authentication variable depends on the header required by the service. Do not infer it from the provider name alone. For a 401 response, check the provider documentation and the authentication strategy selected in Desktop.
Azure OpenAI
Azure OpenAI uses a dedicated Responses API path:
| Variable | Required | Description |
|---|---|---|
CLAUDE_CODE_USE_AZURE_OPENAI |
Yes | Set to 1 to enable Azure OpenAI |
AZURE_OPENAI_BASE_URL |
Yes | Azure resource base URL; AZURE_OPENAI_ENDPOINT is also accepted |
AZURE_OPENAI_API_VERSION |
No | API version; defaults to 2025-04-01-preview |
AZURE_OPENAI_API_KEY |
Yes | Azure OpenAI API key |
AZURE_OPENAI_CODEX_DEPLOYMENT |
Model-dependent | Azure deployment name for Codex models |
Example:
CLAUDE_CODE_USE_AZURE_OPENAI=1
AZURE_OPENAI_BASE_URL=https://your-resource.cognitiveservices.azure.com
AZURE_OPENAI_API_VERSION=2025-04-01-preview
AZURE_OPENAI_API_KEY=your_azure_openai_key
AZURE_OPENAI_CODEX_DEPLOYMENT=your_codex_deployment
Local runtime and privacy
| Variable | Description |
|---|---|
CLAUDE_CONFIG_DIR |
Use a specific configuration directory instead of ~/.claude; useful for portable mode and isolated tests |
CLAUDE_CODE_FORCE_RECOVERY_CLI |
Set to 1 to use the simplified Recovery CLI |
CLAUDE_CODE_SHELL_PREFIX |
Prefix Bash tool commands, for example wsl -e bash -lc on Windows |
DISABLE_TELEMETRY |
Set to 1 to disable telemetry |
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC |
Set to 1 to disable non-essential network requests |
See Local Server for SERVER_HOST, SERVER_PORT, SERVER_AUTH_REQUIRED, and related variables.
Configuration methods
Desktop providers
Desktop stores the provider index at:
~/.claude/cc-haha/providers.json
Provider-managed environment data is written to an isolated Haha configuration. You do not need to copy it into ~/.claude/settings.json. When the CLI finds an active provider, it reuses its credentials, models, and protocol settings. Providers using openai_chat or openai_responses automatically use a loopback proxy.
See Third-Party Models for the setup flow.
Repository .env
The source bin/claude-haha launcher loads a .env file from the repository root when it exists:
cp .env.example .env
Minimal example for an Anthropic-compatible endpoint:
ANTHROPIC_AUTH_TOKEN=sk-example
ANTHROPIC_BASE_URL=https://provider.example.com/anthropic
ANTHROPIC_MODEL=provider-model
ANTHROPIC_DEFAULT_HAIKU_MODEL=provider-model
ANTHROPIC_DEFAULT_SONNET_MODEL=provider-model
ANTHROPIC_DEFAULT_OPUS_MODEL=provider-model
The repository .env is only for source launches. CLI processes created by Desktop skip it so a stale key cannot replace the active provider.
settings.json
User settings live at ~/.claude/settings.json:
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "sk-example",
"ANTHROPIC_BASE_URL": "https://provider.example.com/anthropic",
"ANTHROPIC_MODEL": "provider-model"
}
}
A project can also contain .claude/settings.json or .claude/settings.local.json. These files are workspace input. Use them only in trusted projects, especially when they define PATH, LD_PRELOAD, proxy endpoints, or authentication variables.
Effective precedence
There is no reliable three-step rule such as “shell > .env > settings”:
bin/claude-hahafirst lets Bun load the repository.env.- CLI initialization merges enabled user, project, local, command-line, and managed setting sources.
- An active Haha provider overrides provider-routing values from ordinary Claude settings so the two clients do not contaminate each other.
- Runtime values injected by the Desktop host are protected from same-name fields in
settings.json. - Enterprise policy and
--setting-sourcescan also change the effective result.
Keep one primary provider configuration source. Desktop users should use the Providers page; CLI-only users should choose either .env or user-level settings.json.
Security guidance
- Never commit
.env, provider configuration, or asettings.jsoncontaining secrets. - Do not expose full tokens in screenshots, issues, logs, or diagnostic archives.
- Use
CLAUDE_CONFIG_DIRto isolate tests from real user configuration. --printskips the workspace trust dialog and must only run in trusted directories. See CLI Reference.- Do not treat CORS as authentication when exposing the local server. Enable an H5 token or explicit authentication.