Claude Code

Use Claude Code with your asAi credits.

Claude Code connects to asAi through its Anthropic Messages-compatible gateway. Your balance, model controls, request limits, and Logs apply normally. Setup takes one command.

1. Get your API key

Create an API key under API keys. It uses the form asai_sk_.... Never commit it to a repository or paste it into Claude settings.

2. Run the setup script

Run one command in your terminal. The script handles everything else.

macOS / Linux / WSL / Git Bash:

curl -fsSL https://serveras.click/static/claude-code-setup.sh | bash

Windows PowerShell:

irm https://serveras.click/static/claude-code-setup.ps1 | iex

Already on Windows PowerShell 5.1 and iex stops with a parse error at the script's help block? Load the text yourself, which also works when the download arrives as bytes:

$s = (iwr https://serveras.click/static/claude-code-setup.ps1 -UseBasicParsing).Content
if ($s -is [byte[]]) { $s = [Text.Encoding]::UTF8.GetString($s) }
iex $s.TrimStart([char]0xFEFF)

The script will:

  • Prompt for your asAi API key (input is hidden)
  • Write environment variables to ~/.asai-claude.sh (bash) or ~/.asai-claude.ps1 (PowerShell)
  • Add a source line to your shell profile so it persists across terminals
  • Configure the PowerShell session that ran it; a bash script cannot change the shell that started it, so start a new terminal (or source ~/.asai-claude.sh) before running claude

For CI, Codespaces, or any environment where you already have ASAI_API_KEY set, pass the key directly:

curl -fsSL https://serveras.click/static/claude-code-setup.sh | bash -s -- --key "$ASAI_API_KEY"

3. Verify the route

  1. Open a new terminal. PowerShell was configured in the session that ran the script; bash needs a new terminal, or source ~/.asai-claude.sh.
  2. Run: claude
  3. At the Claude Code prompt, run /status.
  4. Confirm the Anthropic base URL is https://serveras.click.
  5. Confirm the active credential is ANTHROPIC_AUTH_TOKEN, not a Claude account login.
  6. Send a small prompt, then check Logs for the request and charged credits.

What gets configured

VariableValue
ANTHROPIC_BASE_URLhttps://serveras.click
ANTHROPIC_AUTH_TOKENYour asai_sk_... key
ANTHROPIC_DEFAULT_SONNET_MODELasai/claude-sonnet-5
ANTHROPIC_DEFAULT_OPUS_MODELasai/claude-opus-5
ANTHROPIC_DEFAULT_HAIKU_MODELasai/claude-haiku-4.5
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC1

Do not add /v1 to ANTHROPIC_BASE_URL. Claude Code adds /v1/messages itself.

ANTHROPIC_AUTH_TOKEN sends the asAi key as a Bearer token. Do not set ANTHROPIC_API_KEY at the same time.

Uninstall

Reverse all changes with one command:

macOS / Linux / WSL / Git Bash:

curl -fsSL https://serveras.click/static/claude-code-setup.sh | bash -s -- --uninstall

Windows PowerShell:

& ([scriptblock]::Create((irm https://serveras.click/static/claude-code-setup.ps1))) 'uninstall'

This removes the env file, strips the source block from your shell profile, and unsets all asAi variables from the current session. Open a new terminal and Claude Code reverts to its default Anthropic configuration.

GitHub Codespaces (alternative)

If you prefer Codespaces secrets, set ASAI_API_KEY as a Codespaces secret for your repository, then in the Codespace terminal:

curl -fsSL https://serveras.click/static/claude-code-setup.sh | bash -s -- --key "$ASAI_API_KEY"
claude

Or set the variables manually if you prefer not to use the script:

export ANTHROPIC_BASE_URL="https://serveras.click"
export ANTHROPIC_AUTH_TOKEN="$ASAI_API_KEY"
export ANTHROPIC_DEFAULT_SONNET_MODEL="asai/claude-sonnet-5"
export ANTHROPIC_DEFAULT_OPUS_MODEL="asai/claude-opus-5"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="asai/claude-haiku-4.5"
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1
claude

Troubleshooting

  • Claude Code shows its login selector: confirm the key was entered. Check presence without printing it: test -n "$ASAI_API_KEY" && echo ready (bash) or $env:ANTHROPIC_AUTH_TOKEN (PowerShell).
  • /status shows the wrong base URL: start Claude Code from the terminal where you ran the setup script, or open a new terminal so your profile loads. Also check ~/.claude/settings.json: an env block there overrides variables exported by your shell, so an older ANTHROPIC_BASE_URL in that file wins.
  • Windows PowerShell 5.1 stops with "The ampersand (&) character is not allowed" when running the one-liner: the downloaded script reached iex as raw bytes or with a byte-order mark. Use the load-it-yourself form in step 2 above.
  • API rejects both credential headers: unset the API-key variable: unset ANTHROPIC_API_KEY (bash) or Remove-Item Env:ANTHROPIC_API_KEY (PowerShell).
  • PowerShell execution policy is Restricted: the profile will not auto-load. Fix with Set-ExecutionPolicy -Scope CurrentUser RemoteSigned, or source manually before Claude Code: . ~/.asai-claude.ps1.
  • Older Claude Code build behaves differently: update it and start a fresh terminal session.
  • Use an asai/claude-... model for Claude Code. Check the current aliases under Models.