Skip to content

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.

  • Follow the Claude Code setup guide, then confirm that claude --version prints version information.
  • Create a Token dedicated to this device.
  • Copy a complete model ID available to your account.

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.

Set the address, then paste the Token into hidden input:

Terminal window
export ANTHROPIC_BASE_URL="https://api.zhiflo.com"
read -s ANTHROPIC_AUTH_TOKEN
export ANTHROPIC_AUTH_TOKEN

Set the address, then paste the Token into the secure prompt:

Terminal window
$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).Password

These 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”
  1. In the same terminal, replace the placeholder with your complete model ID and start Claude Code:

    Terminal window
    claude --model "<MODEL_FROM_ZHIFLO>"
  2. Run this command inside Claude Code:

    /status

    Check that Anthropic base URL is https://api.zhiflo.com and that the credential source corresponds to the current environment.

  3. 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.

  • /status still shows the default address: exit Claude Code and start it again from the exact terminal where you set the variables.
  • 401 response: confirm the variable name is ANTHROPIC_AUTH_TOKEN, then paste an active Token again.
  • 404 response: remove /v1 from ANTHROPIC_BASE_URL. Claude Code appends /v1/messages itself.
  • 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.

Next: Troubleshoot connection problems by symptom.