Summary
This tutorial demonstrates how to leverage the Claude Code CLI entirely for free by integrating it with Open Router. The guide walks through the complete setup process, including the installation of the Claude Code CLI on Windows, locating and modifying the configuration file, and connecting it to Open Router's API. By selecting free models such as MiniMax from Open Router's library, users can utilize the full functionality of the Claude Code environment for web development and coding tasks without incurring costs, as evidenced by a step-by-step project demonstration.
Key Insights
Claude Code CLI can be legally redirected to third-party API providers like Open Router to access free models.
While Claude Code is designed by Anthropic, its configuration file allows users to change the base URL and API keys. By redirecting the base URL to Open Router (openrouter.ai) and providing a compatible API key, users can bypass standard billing and use any model available on Open Router, including their catalog of free models. This allows developers to use the Claude Code interface and terminal intelligence without a direct Anthropic subscription.
The setup requires specific manual modifications to the settings.json file located in the user's local directory.
To enable integration, the user must locate the .claude folder within their system's User directory. Inside, the settings.json file acts as the primary configuration hub. Users must replace the default settings with specific JSON code derived from Open Router's documentation, which includes parameters for the Anthropic base URL, the Anthropic API key, and the specific model name intended for use.
Open Router provides a wide variety of free, high-performance models suitable for coding tasks.
Open Router acts as an aggregator that offers access to various LLMs. Users can filter for 'free' models to find options like MiniMax or Nvidia's programming-focused models. These models are capable of handling complex coding requests, such as generating full-stack web applications with HTML, CSS, and JavaScript, while maintaining the interactive CLI experience provided by Claude Code.
Sections
Installation of Claude Code CLI
To install Claude Code CLI on Windows, copy the PowerShell command from code.claud.com and execute it within the terminal window.
The process begins by visiting code.claud.com, where users can select the appropriate installation command based on their operating system. For Windows users, a specific PowerShell command is provided. This command must be copied and pasted into the Windows PowerShell terminal. Once entered, the system automatically downloads and installs the Claude Code CLI, which typically takes a few seconds to complete.
Verify the successful installation of the CLI by running the 'claude --help' command to view available options and terminal tools.
After the installation script finishes, it is essential to verify that the tool is correctly registered in the system's path. By typing 'claude --help' in PowerShell, a list of available subcommands and help text should appear. If this information displays correctly, it confirms that the CLI is properly installed and ready for the next configuration steps.
Configuring the Settings File
Users must navigate to the .claude directory in their user folder to find the settings.json file required for API configuration changes.
The configuration file is not located in the standard program files but in a hidden directory. Users must navigate to 'C:\Users\[YourUsername]\.claude'. Inside this folder is a file named 'settings.json'. This file contains the credentials and endpoint directions that the CLI uses to communicate with AI models.
Open the settings.json file with a code editor like Visual Studio Code to replace existing code with Open Router configuration strings.
To modify the settings, right-click the settings.json file and open it with a text editor or IDE such as VS Code or Notepad. The user should navigate to the Open Router documentation to find the specific JSON structure needed for coding agents. This involves copying a template that redirects the 'anthropic_base_url' to Open Router's endpoint.
Connecting to Open Router
Creating an API key on Open Router involves naming the key and leaving limits empty for unlimited usage before copying the unique string.
On the Open Router website, users should navigate to the keys section and click 'Create Key'. After giving it a name like 'Claude Code', leaving the credit limit and expiration fields empty ensures there are no artificial barriers to usage. It is critical to copy the generated API key immediately, as it will not be displayed again once the window is closed.
Search for and select a free model from the Open Router library, then copy its unique identifier into the settings.json file.
Open Router hosts many models, some of which are free. By searching for 'free' in the models tab, users can select a preferred model like 'minimax/minimax-01'. The exact model string must be copied and pasted into the 'anthropic_model' field within the settings.json file to ensure the CLI knows exactly which engine to call.
Running an AI Project
Initialize a new project by navigating to a dedicated folder and launching the Claude CLI to begin the interactive AI development process.
To start building, create a new project folder (e.g., 'claude-project'). Open a command prompt or PowerShell within that directory and type 'claude'. The CLI will prompt the user to choose a theme, such as dark mode, and then establish a connection using the previously configured Open Router free model.
Claude Code can generate complex web structures, including animations and particle effects, based on simple natural language prompts provided by the user.
The demonstration shows a prompt requesting a portfolio website for a 'VIP coder' featuring AI tools. The CLI using the free MiniMax model handles the request by creating an 'index.html' file and associated assets. The resulting website includes advanced features like particle background effects and animations, proving that high-quality development can be achieved using free models via this CLI integration.
Ask a Question
*Uses 1 Wisdom coin from your coin balance
