
Claude Code is a powerful command-line tool that brings AI-powered code generation and analysis to your terminal. While it defaults to Anthropic’s API, you can extend its capabilities by configuring it to work with different AI providers. This guide shows you how to set up Claude Code with various providers to access free and paid model options.
Installing Claude Code
First, install Claude Code for your operating system.
Windows
Run with PowerShell:
irm https://claude.ai/install.ps1 | iex

Linux & macOS
curl -fsSL https://claude.ai/install.sh | bash
Setting up the Environment Path for claude.exe (Windows)
After installation, add the Claude Code binary folder to your system PATH environment variable.
C:\Users\USERNAME\.local\bin

Configuration with Environment Variables
Claude Code can be configured using environment variables to work with different providers. Here are the key environment variables:
- ANTHROPIC_BASE_URL - The API endpoint (default:
https://api.anthropic.com) - ANTHROPIC_MODEL - The selected model to use
- ANTHROPIC_AUTH_TOKEN - Your API key or authentication token
- ANTHROPIC_CUSTOM_HEADERS - Custom headers for specific providers (optional)
Provider Examples
You can use Claude Code with many different providers. Here are some practical examples:
OpenRouter with Google Gemini 3.1 Flash Lite Preview
Set these environment variables:
ANTHROPIC_BASE_URL = https://openrouter.ai/api
ANTHROPIC_MODEL = google/gemini-3.1-flash-lite-preview
ANTHROPIC_AUTH_TOKEN = OPENROUTER_API_TOKEN


OpenCode with MiniMax M2.5
Set these environment variables:
ANTHROPIC_BASE_URL = https://opencode.ai/zen
ANTHROPIC_MODEL = minimax-m2.5-free
ANTHROPIC_AUTH_TOKEN = public
ANTHROPIC_CUSTOM_HEADERS = x-opencode-session: 1

Linux
echo 'export ANTHROPIC_BASE_URL=https://openrouter.ai/api' >> ~/.bashrc && source ~/.bashrc
macOS
echo 'export ANTHROPIC_BASE_URL=https://openrouter.ai/api' >> ~/.zshrc && source ~/.zshrc
Using Claude Code with Different Models
Default Model
Run Claude Code with the default configured model:
claude
Specific Model
Run Claude Code with a specific model using the --model flag:
claude --model z-ai/glm-5
Skip Permission Checks
If needed, you can skip permission confirmations with the --allow-dangerously-skip-permissions flag:
claude --model moonshotai/kimi-k2.5 --allow-dangerously-skip-permissions
Finding Free and Trial Providers
Many providers offer free and trial LLMs that work with Claude Code. Check out this comprehensive list:
Bonus: Add Claude Code to Windows Context Menu
Make Claude Code even more convenient by adding it to your Windows right-click context menu.
Install Context Menu
powershell -ExecutionPolicy Bypass -Command "irm https://raw.githubusercontent.com/bariskisir/ClaudeCodeContextMenu/master/install.ps1 | iex"
Uninstall Context Menu
powershell -ExecutionPolicy Bypass -Command "irm https://raw.githubusercontent.com/bariskisir/ClaudeCodeContextMenu/master/uninstall.ps1 | iex"
References & Documentation
Claude Code Quick Start - https://code.claude.com/docs/en/quickstart
LLM Gateway - https://code.claude.com/docs/en/llm-gateway
Model Configuration - https://code.claude.com/docs/en/model-config
Environment Variables - https://code.claude.com/docs/en/env-vars
Claude Code Context Menu - https://github.com/bariskisir/ClaudeCodeContextMenu
OpenCode Context Menu - https://github.com/bariskisir/OpenCodeContextMenu
