Menu

Products Models Use Cases AI Agents API

Claude Code Quick Switch to Cloudwise MaaS

Configure Claude Code to use Cloudwise MaaS and access the full Claude model series through a simple environment variable setup

Claude Code is Anthropic's official agentic coding tool that lives in your terminal. Through Cloudwise MaaS, you can redirect Claude Code to use our API gateway, giving you flexible billing and seamless access to Claude Sonnet, Opus, Haiku and more.

Prerequisites

Before you begin, make sure you have the following:

RequirementDetails
Claude CodeInstalled via npm install -g @anthropic-ai/claude-code. See official docs.
Node.jsVersion 18 or higher required.
Cloudwise API KeyGet your key from Cloudwise MaaS.

Test Key: You can use this test key to try it out: ak_f58064831857443bbfc75b0b4fb9d9c3

Quick Start

The fastest way to get started — just 3 commands in your terminal:

1
Set the API Base URL

Point Claude Code to the Cloudwise MaaS API gateway:

export ANTHROPIC_BASE_URL=https://api.cloudwise.ai/api
2
Set your API Key

Replace YOUR_API_KEY with your actual Cloudwise API key:

export ANTHROPIC_AUTH_TOKEN=YOUR_API_KEY
3
Launch Claude Code

Start Claude Code as usual:

claude

That's it! Claude Code will now route all requests through Cloudwise MaaS. You should see the Claude Code interface with model info like "Sonnet 4.6 · API Usage Billing".

Environment Variable Configuration

Claude Code uses two environment variables to connect to Cloudwise MaaS:

VariableValueDescription
ANTHROPIC_BASE_URLhttps://api.cloudwise.ai/apiCloudwise MaaS API endpoint (Asia region)
ANTHROPIC_AUTH_TOKENYour API KeyYour Cloudwise API key (starts with ak_)

Complete Example

Copy and paste this entire block into your terminal:

# Configure Claude Code to use Cloudwise MaaS (Asia Region) export ANTHROPIC_BASE_URL=https://api.cloudwise.ai/api export ANTHROPIC_AUTH_TOKEN=YOUR_API_KEY # Launch Claude Code claude

Persistent Configuration

To avoid setting environment variables every time you open a new terminal, add them to your shell profile:

For macOS / Linux (Zsh)

# Add to ~/.zshrc echo 'export ANTHROPIC_BASE_URL=https://api.cloudwise.ai/api' >> ~/.zshrc echo 'export ANTHROPIC_AUTH_TOKEN=YOUR_API_KEY' >> ~/.zshrc # Reload the configuration source ~/.zshrc

For macOS / Linux (Bash)

# Add to ~/.bashrc or ~/.bash_profile echo 'export ANTHROPIC_BASE_URL=https://api.cloudwise.ai/api' >> ~/.bashrc echo 'export ANTHROPIC_AUTH_TOKEN=YOUR_API_KEY' >> ~/.bashrc # Reload the configuration source ~/.bashrc

For Windows (PowerShell)

# Set environment variables permanently for current user [System.Environment]::SetEnvironmentVariable('ANTHROPIC_BASE_URL', 'https://api.cloudwise.ai/api', 'User') [System.Environment]::SetEnvironmentVariable('ANTHROPIC_AUTH_TOKEN', 'YOUR_API_KEY', 'User') # Restart your terminal, then launch claude

Security Tip: Replace YOUR_API_KEY with your actual API key. Never share your API key publicly or commit it to version control.

Verify Connection

After launching Claude Code, verify that it's connected to Cloudwise MaaS:

1
Check the status bar

Look at the bottom-left of the Claude Code interface. You should see the model name (e.g., Sonnet 4.6) followed by "API Usage Billing", which indicates it's using the Cloudwise MaaS API.

2
Send a test message

Type any message to confirm the connection works:

> how do you do?

If you receive a response, the configuration is working correctly. Notice the status bar shows "Sonnet 4.6 · API Usage Billing", confirming Cloudwise MaaS is active.

Claude Code connected to Cloudwise MaaS - chat demo
3
Check model info

Use the /model command inside Claude Code to verify the current model:

> /model

You should see output like: Kept model as Sonnet 4.6 (default)

Supported Models

Through Cloudwise MaaS, Claude Code can access the full Claude model family:

ModelDescriptionBest For
claude-sonnet-4-6Latest Sonnet — fast and capableDaily coding tasks, debugging
claude-sonnet-4-5-20250929Previous Sonnet versionGeneral coding tasks
claude-opus-4-7Latest Opus — most powerfulComplex architecture, deep analysis
claude-opus-4-5-20251101Previous Opus versionComplex reasoning tasks
claude-haiku-4-5-20251001Haiku — fastest and most affordableQuick tasks, high-volume usage

To switch models inside Claude Code, use the /model command and select your preferred model.

Troubleshooting

Authentication Error

If you see an authentication error, verify your API key is correct:

# Check if the environment variable is set echo $ANTHROPIC_AUTH_TOKEN # Make sure it starts with "ak_" # If empty, set it again: export ANTHROPIC_AUTH_TOKEN=YOUR_API_KEY
Connection Timeout

If you experience connection issues, check the API endpoint:

# Verify the base URL is set correctly echo $ANTHROPIC_BASE_URL # Should output: https://api.cloudwise.ai/api # Test connectivity curl -s https://api.cloudwise.ai/api -o /dev/null -w "%{http_code}"
Still using Anthropic's API directly?

Make sure no other configuration is overriding your environment variables. Check for conflicting settings:

# Check all ANTHROPIC-related environment variables env | grep ANTHROPIC

You should only see ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN. If you see ANTHROPIC_API_KEY, unset it:

unset ANTHROPIC_API_KEY

Summary

You have successfully configured Claude Code to use Cloudwise MaaS. Here's a recap of what was set up:

ItemValue
API Endpointhttps://api.cloudwise.ai/api
Auth VariableANTHROPIC_AUTH_TOKEN
Default ModelClaude Sonnet 4.6
Available ModelsFull Claude family (Sonnet, Opus, Haiku)

All requests are routed through Cloudwise MaaS API gateway. Your usage will be billed through your Cloudwise account. Visit maas.cloudwise.ai to manage your API keys and monitor usage.