Developers

Claude CLI

Claude CLI with the ChatQT API.

In Iran, direct access to Anthropic's service is often impossible or VPN-dependent. With ChatQT you get the same Claude Code / Claude CLI experience on your own terminal — requests pass through api.chatqt.com .

JSON
{
  "env": {
    "ANTHROPIC_AUTH_TOKEN": "YOUR_CHATQT_API_KEY",
    "ANTHROPIC_BASE_URL": "https://api.chatqt.com/api"
  }
}

Why ChatQT?

Claude CLI without connection hassle.

We wrote this guide for developers who want to use Anthropic's official terminal tool but are looking for a stable solution because of network restrictions or constant VPN dependence.

No VPN

CLI traffic reaches ChatQT's servers, accessible from Iran; no permanent tunnel to anthropic.com is needed.

Stable access

Frequent VPN drops no longer interrupt your coding flow.

Transparent payment and usage

API key from developer console; cost is based on actual usage — details on the Pricing.

Prerequisites

Be ready before you start.

  • 1 Node.js 18+ to install the official Claude Code package from npm.
  • 2 account ChatQT and an API key from the console.
  • 3 A terminal (macOS, Linux or Windows with WSL). Settings path on Windows: %USERPROFILE%\.claude\settings.json

Step 1

Install Claude CLI (Claude Code)

Anthropic's official tool for working in the terminal. The package name may change; always check the Claude Code docs for the latest install command.

Bash
npm install -g @anthropic-ai/claude-code
claude --version

If npm isn't available, check Anthropic's docs for alternative methods (e.g., Homebrew or a dedicated installer). After installation, the claude command should be in your PATH.

Step 2

Configure a custom provider

Since you're using ChatQT's custom address (similar to OpenRouter), set Anthropic's environment variables in the Claude CLI settings file.

1) Create the folder and settings file

Bash
mkdir -p ~/.claude
nano ~/.claude/settings.json

2) Example settings.json

The exact model ID from console.chatqt.com copy it. The values below match the latest generation of Claude models on ChatQT and may match your console slug.
JSON
{
  "env": {
    "ANTHROPIC_AUTH_TOKEN": "YOUR_CHATQT_API_KEY",
    "ANTHROPIC_BASE_URL": "https://api.chatqt.com/api",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "anthropic/claude-opus-4.7",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "anthropic/claude-sonnet-4.6",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "anthropic/claude-haiku-3.5"
  }
}

ANTHROPIC_AUTH_TOKEN is your ChatQT API key (not a direct Anthropic key). ANTHROPIC_BASE_URL must point exactly to the address above.

3) Model variables table

Variable Model on ChatQT Example slug
ANTHROPIC_DEFAULT_OPUS_MODEL Claude Opus 4.7 anthropic/claude-opus-4.7
ANTHROPIC_DEFAULT_SONNET_MODEL Claude Sonnet 4.6 anthropic/claude-sonnet-4.6
ANTHROPIC_DEFAULT_HAIKU_MODEL Claude Haiku (fast) anthropic/claude-haiku-3.5

Step 3

Test the connection

Bash
cd /path/to/your/project
claude

If the configuration is correct, the CLI starts without asking for a direct Anthropic login and requests are sent through ChatQT.

401 error (Unauthorized)

Create the API key in the console and put it in ANTHROPIC_AUTH_TOKEN . Don't add extra spaces or quotes.

Model not found

Copy the model slug from the console; the display name (e.g., Opus 4.7) is not the same as the API ID.

Connection won't establish

ANTHROPIC_BASE_URL check it: it should be https://api.chatqt.com/api .

FAQ

Common questions

Is this the official Claude?
Yes — the CLI software is from Anthropic; only the endpoint and authentication are routed to ChatQT so it works from Iran without a VPN.
What's the difference from the ChatQT REST API?
The REST API is for integration into your application (API documentation). Claude CLI is an interactive terminal tool; for workflow automation, go to n8n guide .
Where should I keep the API key?
Only in ~/.claude/settings.json on your own device. Don't commit it or put it in public repositories.
How is the cost calculated?
Like other API requests — pay-as-you-go. The rate table is on the pricing page.

Ready to code with Claude?

Get an API key, set up settings.json and in the terminal run claude .