June 28, 20264 min readClaude CodeFreeSetup

How to use Claude Code for free (and cheaper after that)

Short answer: you can try Claude Code without Claude Max by connecting it to the AnyModel API. Linking Telegram grants free tokens, so you can install the tool, run a real task and verify the setup before paying. When the credits run out, usage becomes pay-as-you-go; this is not a permanent unlimited free plan.

This guide covers macOS, Linux and Windows, explains what the free offer includes and separates the free-credit question from the custom API endpoint setup.

What you need

  • Claude Code already installed;
  • a free AnyModel account and API key;
  • Terminal on macOS/Linux or PowerShell on Windows;
  • a few minutes for configuration and a small test.

The AnyModel command configures an existing Claude Code installation. It does not install the Claude Code CLI itself.

Step 1: get free tokens and an API key

AnyModel uses pay-per-token billing with no subscription or minimums. Link Telegram to receive 5,000,000 free tokens; registration itself does not include a token grant.

Create your account, open the dashboard instructions and copy the API key. Never commit the key to Git, paste it into an issue or include it in a screenshot.

Step 2: connect Claude Code

macOS and Linux

bash <(curl -fsSL "https://anymodel.org/i?tool=claude") <YOUR_API_KEY>

Replace <YOUR_API_KEY> with the full key, without angle brackets. The installer updates Claude Code's settings with the AnyModel Anthropic-compatible endpoint and authorization token.

Windows PowerShell

$env:AM_KEY="<YOUR_API_KEY>"; irm "https://anymodel.org/i?os=windows&tool=claude" | iex

Replace the placeholder before running the command. If your PowerShell policy blocks scripts, use the manual configuration shown in the dashboard.

Step 3: verify the connection

Start Claude Code in a small test folder:

mkdir claude-test && cd claude-test
claude

Ask it to perform a short, safe task such as creating a small README.md. Then open AnyModel usage statistics. If the response arrives and the request appears in usage, the connection is working.

The current model catalog shows available models and prices. The Claude Code endpoint page covers model switching and the complete technical setup. If your question is specifically about regional access or payment, use the Claude Code in Russia guide.

What “free Claude Code” means here

The free part is the Telegram bonus balance, not unlimited Claude Code forever. How long it lasts depends on the chosen model, repository size, conversation history and number of agent actions. A long autonomous session can make many API calls.

To stretch the trial:

  • begin with one small folder rather than a whole monorepo;
  • state a concrete task and definition of done;
  • exclude files unrelated to the task;
  • choose a cheaper suitable model for simple work;
  • inspect usage after the first few requests.

Free API credits vs Claude Max

Option Billing Best fit
AnyModel Telegram bonus Free first, then per token Test without a card, irregular use, model switching
Claude Max Monthly subscription with plan limits Regular use of Anthropic's consumer service and supported first-party features

These are different products. AnyModel provides an independent compatible API endpoint; it does not grant Claude Max benefits or an Anthropic API key. Whether pay-as-you-go costs less depends on your workload and model.

Common problems

claude command not found

Install Claude Code first and restart the terminal. The AnyModel command configures the CLI but does not install it.

401 or authentication error

Check that the entire key was pasted without spaces or angle brackets. If a key was exposed, revoke it and create another one.

Claude Code still uses the previous endpoint

Inspect ~/.claude/settings.json, close the existing Claude Code process and start it again. The setting should point to the AnyModel endpoint.

Free tokens disappeared quickly

Check both the selected model and request history. Agentic coding may include repeated reads, tool calls and follow-up requests, so it uses more tokens than a single chat answer.

Privacy when you need it

For sensitive work, enable Ghost Mode on a zero-retention key so prompts and responses are not stored by AnyModel. The selected upstream provider still has to receive a request to generate a response. Do not place passwords, private keys or unnecessary secrets in prompts.

FAQ

Can I use Claude Code free forever?

No. Only the Telegram bonus tokens are free. After they are consumed, you must add balance or stop sending API requests.

Do I need Claude Max?

No. This setup charges requests to the AnyModel API balance and does not require a Claude consumer subscription.

Is a payment card required to start?

No. A card is not required to receive the Telegram bonus tokens.

Can I switch models later?

Yes. One AnyModel key works with available models in the catalog. The exact model selection is controlled by the Claude Code configuration.

Get a free key, connect Claude Code and test it on one small task before opening a large repository.

Read next