Run Claude Code for free via an alternative model
Connect Claude Code to a free model via a third-party API and start coding with an AI assistant without a subscription
- 1.Install Node.js (version 18 or higher) if it is not already installed. Check it with the 'node -v' command in the terminal. If Node.js is not installed - download it from the official website and install it.
If the service is unavailable in your region - use a VPN to access the download site.
Node.js ↗ - 2.Install Claude Code globally with the command: npm install -g @anthropic-ai/claude-code. After installation, check it: claude --version.
If the installation fails with a permissions error - add sudo before the command (macOS/Linux).
Claude Code CLI ↗About this tool - 3.Register on OpenRouter and create an API key. Go to the Keys section, click Create Key, copy the key (starts with sk-or-). Free models are marked with a 'free' badge.
Do not share your API key with third parties - it gives access to your account. Free models have a limit of 20 requests per day.
OpenRouter ↗About this tool - 4.In the terminal, in your project folder, launch Claude Code specifying the OpenRouter provider and a free model. Copy and paste your key instead of [YOUR_OPENROUTER_KEY]:
The deepseek/deepseek-chat-v3-0324:free model is one of the few free ones supporting tool-use, which Claude Code needs. If it is unavailable - check the current list of free models on OpenRouter.
Terminal ↗Promptexport ANTHROPIC_BASE_URL='https://openrouter.ai/api/v1' export ANTHROPIC_API_KEY='[YOUR_OPENROUTER_KEY]' claude --model deepseek/deepseek-chat-v3-0324:free
What this prompt doesThe command sets the base API URL to OpenRouter, substitutes your key for [YOUR_OPENROUTER_KEY], and launches Claude Code with the free DeepSeek V3 model. Replace [YOUR_OPENROUTER_KEY] with the key obtained in step 3. - 5.When Claude Code launches, write your first prompt right in the terminal. For example, ask it to explain the project structure or find a bug. Claude Code will automatically read the files in the current folder.
If you get an authorization error - double-check that the key is copied fully without extra spaces, and that ANTHROPIC_BASE_URL is set exactly as in the command above.
Claude Code CLI ↗PromptExplain the structure of this project and list the main entry points. Focus on [main technology or framework used].
What this prompt doesThe prompt asks Claude Code to analyze the project structure and list the main entry points. Replace [main technology or framework used] with your stack, for example 'React' or 'Python FastAPI'.
- freeNode.jsCompletely free runtime, installed once.
- freeClaude Code CLIThe CLI tool itself is free; you only pay for calls to the API provider you choose.
- APIOpenRouter (free tier)Free models (marked with free) are available at no cost; the limit is 20 requests per day per free model. Paid models are billed per request, see openrouter.ai/pricing.
Why today
AI services change fast - interfaces and free limits may differ from what's described.