What do I need first?
- Claude Code installed on your machine (follow the official Anthropic install guide). Check with
claude --version. - A MaCloud AI account with balance. Sign up, then top up at Top up; the page shows the payment methods currently available.
- An API key from API Keys. Creating a dedicated key named "claude-code" makes it easy to see and revoke later.
How do I set it up?
- Create an API key in the console and copy it.
- Choose a Claude model on the models page and copy its exact name.
- Set
ANTHROPIC_BASE_URLtohttps://api.macloudai.com. Do not add/v1: Claude Code adds its own path. - Set
ANTHROPIC_AUTH_TOKENto your key andANTHROPIC_MODELto the model name. - Open a new terminal (or reload your shell profile) and run
claudein your project folder. - Send a short message, then check Usage to confirm the call shows up with tokens and cost.
macOS and Linux
For the current terminal session:
export ANTHROPIC_BASE_URL=https://api.macloudai.com
export ANTHROPIC_AUTH_TOKEN=sk-...
export ANTHROPIC_MODEL=hk-5-5
claude
To keep it permanently, add the three export lines to ~/.zshrc (default shell on macOS) or ~/.bashrc (most Linux distributions), then run source ~/.zshrc or open a new terminal.
Windows
$env:ANTHROPIC_BASE_URL="https://api.macloudai.com"
$env:ANTHROPIC_AUTH_TOKEN="sk-..."
$env:ANTHROPIC_MODEL="hk-5-5"
claude
setx ANTHROPIC_BASE_URL "https://api.macloudai.com"
setx ANTHROPIC_AUTH_TOKEN "sk-..."
setx ANTHROPIC_MODEL "hk-5-5"
setx only affects terminals opened afterwards. Close every PowerShell, Command Prompt and VS Code window, then open a new one. You can also check or edit the values in Windows: Start menu, search Edit environment variables for your account.
Using settings.json instead of shell variables
Claude Code reads an env block from its settings file. This works the same on every operating system and does not depend on which shell or IDE launches Claude Code. Edit ~/.claude/settings.json (on Windows: %USERPROFILE%\.claude\settings.json):
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.macloudai.com",
"ANTHROPIC_AUTH_TOKEN": "sk-...",
"ANTHROPIC_MODEL": "hk-5-5"
}
}
If the file already has other settings, add the env key next to them instead of replacing the whole file. Keep the JSON valid: a missing comma or a trailing comma will make Claude Code ignore the file.
Do not commit this file, or a project-level .claude/settings.json with your key in it, to git. For a team, have each person keep the key in their own user settings or environment, and share only the base URL and model name.
How do I check that it is working?
- Start
claudeand type a short prompt such as "list the files in this folder". - Inside Claude Code, run
/statusto see which API base URL and model it is using. - Open Usage in the console. The last 50 calls are listed with model, input tokens, output tokens and cost. If your prompt is there, the setup is correct.
If you get an error instead, the most common causes are a base URL ending in /v1, a model name that is not on the models page, or variables that were set in a different terminal. See Claude Code API errors and fixes.
How do I keep the cost down?
Claude Code is an agent: it reads files, runs commands and sends the whole conversation, including file contents, back to the model on every turn. A long session can use far more input tokens than a chat. A few habits make a big difference:
- Start a fresh session (
/clear) when you switch to an unrelated task, so old context is not resent. - Use
/compactin long sessions to summarize the history into a shorter context. - Point it at specific files or folders instead of asking it to "look at the whole repo".
- Use a smaller, cheaper model for simple edits and switch to a larger one only for hard problems (change
ANTHROPIC_MODELor use/model). - Check Usage after a session to see what a typical task costs you.
Current per-token prices for each model:
Real prices now
Estimated from the prices on the models page: 2,000 input tokens and 500 output tokens per chat. The console shows the actual charge.
| Models | Per chat | 1,000 chats |
|---|---|---|
| GEM 3.8 Flash | Rp 4 | Rp 4.434 |
| TT-6 Luna | Rp 11 | Rp 10.642 |
| TT-6.1 Terra | Rp 7 | Rp 7.263 |
| HK-5.5 | Rp 3 | Rp 3.487 |
| GEM 4 Argon | Rp 85 | Rp 84.649 |
| TT-6.1 Sol | Rp 15 | Rp 14.526 |
FAQ
Q1Should ANTHROPIC_BASE_URL end with /v1?
Q2ANTHROPIC_AUTH_TOKEN or ANTHROPIC_API_KEY?
Q3Can I use non-Claude models in Claude Code?
Q4Do I need a Claude Pro or Max subscription?
Q5Does it work in VS Code or JetBrains?
More guides
- One API key for Claude, GPT, Gemini and DeepSeek
- Claude Code API errors and fixes: 401, 403, 404, 429, 5xx
- How to use Cursor with your own API key and base URL
- Claude vs GPT vs Gemini vs DeepSeek: which model for which job
How AI API token pricing works and how to estimate your bill
- Add AI to n8n workflows with an OpenAI-compatible API