Claude Code
This guide walks you through setting up Claude Code to work with FastRouter.ai as your API provider.
Introduction
Claude Code is Anthropic's official CLI tool that brings Claude's AI capabilities directly to your terminal and development workflow. It enables you to interact with Claude for coding tasks, file operations, git workflows, and more—all from the command line.
FastRouter.ai is an intelligent AI routing platform that offers access to multiple model providers with a single API, offering cost reduction, improved reliability, and enhanced performance through smart routing algorithms.
By integrating Claude Code with FastRouter.ai, you gain a centralized and enterprise-ready way to operate Claude across your organization. FastRouter acts as the control plane for all usage—allowing you to securely manage and rotate user API keys, standardize access across teams, and eliminate the risks of scattered credentials.
In addition, FastRouter provides built-in observability and governance, giving you clear visibility into usage patterns, spend, and performance. You can enforce rate limits to prevent abuse, define role-based access controls to ensure the right people have the right level of access, and set budgets to keep costs predictable. Together, this integration lets you scale Claude Code safely, efficiently, and with full operational control—without slowing down developers.
Prerequisites
Linux operating system
Terminal access
A FastRouter.ai API key (Get one here)
Installation
Step 1: Install Claude Code
Run the following command in your terminal to install Claude Code on Linux:
curl -fsSL https://claude.ai/install.sh | bashThis will download and install the latest version of Claude Code on your system.
Configuration
Step 2: Navigate to Your Project Directory
Change to the directory where you want to use Claude Code:
Step 3: Set Environment Variables
Run the following commands in your terminal to configure Claude Code to use FastRouter.ai:
Important Notes:
Replace
[YOUR-FASTROUTER-API-KEY]with your actual FastRouter.ai API keySetting
ANTHROPIC_API_KEY=""(empty string) is required for proper functionalityThese environment variables will only persist for your current terminal session
Step 4: Persist Environment Variables (Optional)
To make these settings permanent across terminal sessions, add them to your shell profile file.
For Bash users (~/.bashrc or ~/.bash_profile):
For Zsh users (~/.zshrc):
For Fish users (~/.config/fish/config.fish):
Verification
Step 5: Launch Claude Code
Start Claude Code by running:
Claude Code should now be configured to route all API requests through FastRouter.ai.
Troubleshooting
Common Issues
Issue: Authentication errors
Verify your FastRouter.ai API key is correct
Ensure
ANTHROPIC_API_KEYis set to an empty string ("")Check that
ANTHROPIC_BASE_URLis exactlyhttps://api.fastrouter.ai
Issue: Environment variables not persisting
Make sure you've added the exports to the correct shell profile file
Run
source ~/.bashrc(or appropriate file) to reload the configurationVerify the variables are set with:
echo $ANTHROPIC_BASE_URL
Issue: Claude Code not found after installation
Restart your terminal or open a new terminal window
Check if the installation path is in your
PATHvariableTry running the installation command again
Last updated
