Claude Code
Use Claude Code with NanoGPT to access Claude and 400+ AI models through a single API key.NanoGPT provides an Anthropic API-compatible endpoint that works seamlessly with Claude Code. This allows you to:
- Use Claude Code with your NanoGPT credits
- Access the real Claude models (Sonnet, Opus, Haiku)
- Optionally route to 400+ other models (GPT-4o, Gemini, DeepSeek, and more)
Step 1: Install Claude Code
- Recommended Installation Method
- Cursor Guided Installation Method
Prerequisites: Node.js 18 or newer
Note: If you encounter permission issues during installation, try using
sudo (macOS/Linux) or running the command prompt as an administrator (Windows) to re-execute the installation command.Step 2: Configure NanoGPT
Get API Key
- Go to NanoGPT API
- Create an account or log in
- Copy your API key
Configure Environment Variables
Set up environment variables using one of the following methods:
- One-Click Setup (Mac/Linux)
- Manual Configuration (All Platforms)
Run this command in your terminal:The script will prompt for your API key and automatically configure The installer now supports browser-based login. When the script starts, choose:
~/.claude/settings.json:- Browser login (recommended) - it will open a verification URL, wait for approval, and then save your key in
~/.claude/settings.json. - Paste API key - manual fallback if you prefer.
Step 3: Start Using Claude Code
Once configured, start Claude Code in your terminal:If prompted with “Do you want to use this API key,” select “Yes.”Grant Claude Code permission to access files in your folder and you’re ready to go.
FAQ
What Models Does This Use?
By default, Claude Code uses the real Claude models through NanoGPT:| Claude Code Model | NanoGPT Routes To |
|---|---|
| Opus | Claude Opus 4.5 |
| Sonnet | Claude Sonnet 4.5 |
| Haiku | Claude Haiku 4.5 |
Can I Use Other Models?
Yes. NanoGPT supports 400+ models. You can configure Claude Code to use different models by adding model mappings to your~/.claude/settings.json:
| Use Case | Recommended Model |
|---|---|
| Best overall | openai/gpt-5.2, anthropic/claude-opus-4.5 |
| Fast/cheap | google/gemini-3-flash-preview |
Configuration Not Working?
If your configuration changes don’t take effect:- Restart Claude Code: Close all Claude Code windows, open a new terminal, and run
claudeagain - Check JSON syntax: Ensure your
settings.jsonhas valid JSON (no trailing commas, proper quotes) - Reset configuration: Delete
~/.claude/settings.jsonand reconfigure from scratch
How Do I Check My Configuration?
Run/status inside Claude Code to see your current model configuration.
Recommended Claude Code Version
We recommend using the latest version of Claude Code:How Is This Different From Using Anthropic Directly?
| Feature | Anthropic Direct | NanoGPT |
|---|---|---|
| Pricing | Monthly subscription or API credits | Pay-as-you-go, no minimums |
| Models | Claude only | Claude + 400 other models |
| Billing | Separate Anthropic account | Single NanoGPT account |
| Rate limits | Anthropic limits | NanoGPT limits |
Need Help?
- Check your balance at nano-gpt.com/balance
- View API usage at nano-gpt.com/usage
- Create or manage API keys at nano-gpt.com/api
- Contact support via the chat widget on nano-gpt.com