# How to Use Claude Code CLI Without the $20 Monthly Subscription

> Run Claude Code on a pay-as-you-go basis via Zeabur AI Hub. No monthly fees.

<AIHubShutdownNotice />

Anthropic  launched  our beloved coding tool: **Claude Code**, an incredible CLI tool that lets you code directly in your terminal with AI assistance. Usually, accessing the best models (like the new Sonnet or Haiku 4.5) requires a **Claude Pro subscription ($20/month)**.

But what if you just want to try it out? Or what if you don't code enough to justify another monthly bill?

By connecting the Claude CLI to **Zeabur AI Hub**, you can use the exact same tool on a **pay-as-you-go** basis. No fixed fees—you only pay for the tokens you actually use.

Here is how to set it up in under 2 minutes.

## 🧱 Prerequisites

1. **Install Claude Code**:
    
    ```bash
    npm install -g @anthropic-ai/claude-code
    
    ```
    
2. **Zeabur Credentials**:
    - Go to your Zeabur Dashboard to get your **AI Hub API Key**.
3. **Choose your Endpoint**
    
    Zeabur currently provides two endpoints. For the fastest response time in your terminal, pick the one geographically closest to you:
    
    - **Asia (Tokyo):** `https://hnd1.aihub.zeabur.ai/`
    - **US West (San Francisco):** `https://sfo1.aihub.zeabur.ai/`

---

## ⚙️ Quick Setup Guide

You need to point the Claude CLI to Zeabur's server instead of the default Anthropic server.

> **Note:** You must also set `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1`. Without it, Claude Code sends experimental beta headers that AI Hub's gateway rejects with an `invalid beta flag` error.

### Option A: Just trying it out (Temporary)

If you want to test the waters for a single session without saving any settings:

```bash
# Choose hnd1 (Asia) or sfo1 (US)
export ANTHROPIC_BASE_URL="https://hnd1.aihub.zeabur.ai/"
export ANTHROPIC_AUTH_TOKEN="Your_Zeabur_AI_Hub_API_Key"
export CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1

```

### Option B: Set it and forget it (Permanent)

If you want to use this whenever you need it, add it to your profile.

1. Open your shell configuration (e.g., `~/.zshrc`):
    
    ```bash
    nano ~/.zshrc
    
    ```
    
2. Paste these lines at the bottom:
    
    ```bash
    # Choose hnd1 (Asia) or sfo1 (US)
    export ANTHROPIC_BASE_URL="https://hnd1.aihub.zeabur.ai/"
    export ANTHROPIC_AUTH_TOKEN="Your_Zeabur_AI_Hub_API_Key"
    export CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1
    
    ```
    
3. Save (`Ctrl+O` -> `Enter`) and Exit (`Ctrl+X`).
4. Reload your settings: `source ~/.zshrc`

---

## 💸 Start Coding (And Saving)

Now you can run the CLI tool. You will get the full power of Claude without the subscription lock-in.

```bash
# Run with the latest models
claude --model claude-sonnet-4-5

```

**Why this is better for light users:**

- **Official Subscription:** $20/month (flat rate).
- **Zeabur Method:** Pay ~$0.50 if you only use it for a weekend project. $0 if you don't code that month.

Happy Coding!
