Skip to content

Claude Code one-line setup with a custom API ​

TL;DR: run curl -fsSL https://sh.flashapi.top/claudecode.sh | bash on macOS / Linux, or irm https://sh.flashapi.top/claudecode.ps1 | iex in Windows PowerShell, then pick 3.

One command installs and configures both the Claude Code CLI and Claude Desktop, with Flash API as the custom base URL. The default model is claude-opus-5-5 with medium reasoning effort.

1. Run the setup command ​

bash
curl -fsSL https://sh.flashapi.top/claudecode.sh | bash
powershell
irm https://sh.flashapi.top/claudecode.ps1 | iex
  • macOS: open Terminal. Linux: open your usual terminal. WSL / Git Bash: use the first command too.
  • Windows: open Windows PowerShell and run the second command. You don't need Git Bash.

The script shows the current status and a menu:

  • 1 Install the Claude Code CLI / Claude Desktop
  • 2 Configure the API for the Claude Code CLI / Claude Desktop
  • 3 Install everything (first time? pick this)

Next it asks which client you use: 1 Claude Code CLI, 2 Claude Desktop, or press Enter for both. Then you pick an endpoint, either direct (ai.flashapi.top, lowest latency across Asia) or the global CDN (cdn.flashapi.top), and paste your API key. The script validates the key before writing any config.

The prompts are in Chinese

The script's prompts are currently in Chinese. Pick 3 for a full install, press Enter at the client question to set up both, choose an endpoint, then paste your key.

2. How things get installed ​

WhatmacOS / LinuxWindows
Claude Code CLIOfficial installer claude.ai/install.sh; falls back to npm, then to a mirror registryOfficial installer claude.ai/install.ps1; falls back to npm + a mirror registry
Claude DesktopmacOS: brew install --cask claude; no official desktop app for Linux yetwinget install Anthropic.Claude
  • Installing via npm requires Node.js. See Install Node.js.
  • No Homebrew / winget? The script opens claude.ai/download. Install it manually, then go back to the script and pick 2 to configure.
  • On Windows, Git for Windows is optional. Without it, Claude Code runs commands through PowerShell.

3. Files the script writes ​

Claude Code CLI: ~/.claude/settings.json (%USERPROFILE%\.claude\settings.json on Windows)

json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://ai.flashapi.top",
    "ANTHROPIC_AUTH_TOKEN": "sk-your-key",
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
  },
  "model": "claude-opus-5-5",
  "effortLevel": "medium"
}

It also writes hasCompletedOnboarding: true to ~/.claude.json so you skip the first-run login flow.

Claude Desktop: switched to third-party inference (gateway) mode. Config locations:

OSLocation
macOS~/Library/Application Support/Claude/ and Claude-3p/
Windows%LOCALAPPDATA%\Claude\ and Claude-3p\
Linux~/.config/Claude/ and Claude-3p/

The script sets deploymentMode to 3p in both claude_desktop_config.json files and writes a gateway config named 闪电API (Flash API) under Claude-3p/configLibrary/, with the endpoint, key and available model list (claude-opus-5-5 first).

Your other settings (permissions, MCP servers and so on) are kept. Every file is backed up first as *.bak.<timestamp> in the same directory.

4. Verify ​

bash
claude -p "Reply with exactly: OK"

If you get OK back, you're live. For Claude Desktop, fully quit the app (including the tray / menu bar icon), reopen it, and send a message.

5. FAQ ​

  • Config changes didn't take effect: for Claude Code, open a new terminal and run it again. Claude Desktop must be fully quit and reopened.
  • 401 / invalid key: make sure you copied the whole key and that it belongs to a Claude pricing group, such as ClaudeCode Dedicated (ClaudeCode专用版), ClaudeCode External (ClaudeCode外接版) or Claude-Mixed (Kiro) (Claude-Mixed).
  • Switch endpoint or key: rerun the script and pick 2. It overwrites the old key and URL.
  • Roll back: rename the *.bak.<timestamp> backups to their original names.

One base URL for GPT, Claude and Gemini