Use ZhiFlo in Claude Code
This path is for people already using Claude Code. You temporarily point the current terminal at ZhiFlo, and closing the window returns later sessions to your previous Claude Code environment.
Before you start
Section titled “Before you start”- Follow the Claude Code setup guide, then confirm that
claude --versionprints version information. - Create a Token dedicated to this device.
- Copy a complete model ID available to your account.
1. Set the gateway for this terminal
Section titled “1. Set the gateway for this terminal”Claude Code uses the ZhiFlo root address without /v1. Bearer authentication belongs in ANTHROPIC_AUTH_TOKEN; do not substitute ANTHROPIC_API_KEY, which uses a different header.
macOS, Linux, or Bash
Section titled “macOS, Linux, or Bash”Set the address, then paste the Token into hidden input:
export ANTHROPIC_BASE_URL="https://api.zhiflo.com"read -s ANTHROPIC_AUTH_TOKENexport ANTHROPIC_AUTH_TOKENPowerShell
Section titled “PowerShell”Set the address, then paste the Token into the secure prompt:
$env:ANTHROPIC_BASE_URL = "https://api.zhiflo.com"$secureToken = Read-Host "Paste your ZhiFlo Token" -AsSecureString$env:ANTHROPIC_AUTH_TOKEN = [System.Net.NetworkCredential]::new("", $secureToken).PasswordThese values live in the current process environment. Keep the Token out of project files, command arguments, and synchronized shell configuration.
2. Start Claude Code and inspect its status
Section titled “2. Start Claude Code and inspect its status”-
In the same terminal, replace the placeholder with your complete model ID and start Claude Code:
Terminal window claude --model "<MODEL_FROM_ZHIFLO>" -
Run this command inside Claude Code:
/statusCheck that
Anthropic base URLishttps://api.zhiflo.comand that the credential source corresponds to the current environment. -
Send a read-only prompt:
Do not modify any files. Reply with OK only.
An OK reply confirms that the temporary switch worked: Claude Code read the current terminal variables, used the ZhiFlo gateway, and got a real model response.
Common recovery steps
Section titled “Common recovery steps”/statusstill shows the default address: exit Claude Code and start it again from the exact terminal where you set the variables.401response: confirm the variable name isANTHROPIC_AUTH_TOKEN, then paste an active Token again.404response: remove/v1fromANTHROPIC_BASE_URL. Claude Code appends/v1/messagesitself.- Model unavailable: copy the account’s current model ID and start again with
--model.
Close the terminal to remove the temporary gateway settings. A later Claude Code session will use your previous sign-in and environment.