@lvmk/claude-alias
v1.0.4
Published
Manage Claude Code with custom AI API providers. Secure API key storage in macOS Keychain or Linux secret-tool.
Maintainers
Readme
claude-alias
Manage Claude Code with custom AI API providers using secure credential storage.
claude-alias creates shell aliases that let you run Claude Code with different AI providers like DeepSeek, OpenRouter, Z.AI, and more. Each alias has its own API key stored securely in your system's credential manager.
Features
- 🔐 Secure API key storage - macOS Keychain or Linux secret-tool/encrypted file
- 🎯 Multiple provider presets - DeepSeek, OpenRouter, Z.AI, OpenAI, Anthropic, Groq, and more
- 🤖 Model configuration - Set opus/sonnet/haiku/subagent models per alias
- 📋 LiteLLM integration - Search 100+ models from the LiteLLM registry
- 🐚 Shell integration - Auto-adds aliases to
.zshrcor.bashrc - 🔧 MCP support - Symlinks global settings for MCP servers
Requirements
- Node.js 18+
- Claude Code installed (
claudecommand available) - macOS or Linux
Linux Only
# Recommended: Install libsecret-tools for secure storage
sudo apt install libsecret-tools # Ubuntu/Debian
sudo dnf install libsecret # Fedora/RHELInstallation
# Install globally
npm install -g @lvmk/claude-alias
# Or use directly with npx
npx @lvmk/claude-aliasQuick Start
# Run interactive mode
claude-alias
# Or use commands directly
claude-alias add # Add/edit an alias
claude-alias remove # Remove aliases
claude-alias list # List all aliasesUsage
Adding an Alias
claude-alias addYou'll be guided through:
- Alias name - e.g.,
ccdfor DeepSeek,cczfor Z.AI - Provider - Select from presets or enter custom
- API key - Stored securely in Keychain/secret-tool
- Base URL - Auto-filled for preset providers
- Model configuration - Optional opus/sonnet/haiku/subagent models
- Max output tokens - Optional limit
Example: DeepSeek Setup
$ claude-alias add
? Enter alias name: ccd
? Select provider: DeepSeek
? Enter API key: ****
? Token type: ANTHROPIC_AUTH_TOKEN
? Opus Model: deepseek-chat
✅ Alias 'ccd' created successfully!
# Now use it
$ source ~/.zshrc
$ ccdZ.AI Quick Setup
Z.AI comes pre-configured with optimal models:
$ claude-alias add
? Enter alias name: ccz
? Select provider: Z.AI (GLM Models)
? Enter API key: ****
# Models auto-configured: glm-4.7 (opus/sonnet), glm-4.5-air (haiku)
✅ Alias 'ccz' created!How It Works
- Profile scripts are created in
~/.local/bin/claude-{alias} - Shell aliases are added to your
.zshrcor.bashrc - API keys are stored in macOS Keychain or Linux secret storage
- Each alias gets its own config directory (
~/.claude-{alias}) - MCP settings are symlinked from
~/.claude/settings.json
Provider Presets
| Provider | Base URL |
|----------|----------|
| Z.AI | https://api.z.ai/api/anthropic |
| DeepSeek | https://api.deepseek.com |
| OpenRouter | https://openrouter.ai/api/v1 |
| OpenAI | https://api.openai.com/v1 |
| Anthropic | https://api.anthropic.com |
| Google AI | https://generativelanguage.googleapis.com/v1beta |
| Mistral | https://api.mistral.ai/v1 |
| Groq | https://api.groq.com/openai/v1 |
| Together AI | https://api.together.xyz/v1 |
| Fireworks AI | https://api.fireworks.ai/inference/v1 |
| Perplexity | https://api.perplexity.ai |
Model Environment Variables
| Variable | Description |
|----------|-------------|
| ANTHROPIC_DEFAULT_OPUS_MODEL | Primary model for complex tasks/Plan Mode |
| ANTHROPIC_DEFAULT_SONNET_MODEL | Default model for normal operation |
| ANTHROPIC_DEFAULT_HAIKU_MODEL | Fast model for background tasks |
| CLAUDE_CODE_SUBAGENT_MODEL | Model for subagent operations |
Troubleshooting
API key not found
# Re-add the alias to store the key again
claude-alias add
# Enter the same alias name to reconfigureMCP servers not showing
# Symlink is created automatically, but you can force it:
ln -sf ~/.claude/settings.json ~/.claude-{alias}/settings.jsonCommand not found after adding alias
# Source your shell profile
source ~/.zshrc # or ~/.bashrc
# Or open a new terminalSecurity
- macOS: API keys stored in Keychain (secure enclave)
- Linux with secret-tool: Stored in GNOME Keyring/KDE Wallet
- Linux fallback: AES-256 encrypted file (
~/.config/claude-alias/secrets.enc)
Disclaimer
This project is an independent, community-developed tool and is not affiliated with, endorsed by, or sponsored by Anthropic, PBC.
- Claude and Claude Code are trademarks of Anthropic, PBC.
- This tool is a third-party utility that helps manage environment configurations for Claude Code.
- Use of Claude Code is subject to Anthropic's Terms of Service.
- Provider names mentioned (DeepSeek, OpenRouter, OpenAI, Google, etc.) are trademarks of their respective owners.
This software is provided "as is" without warranty of any kind. The authors are not responsible for any issues arising from the use of this tool with Claude Code or any third-party API providers.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT © 2024
This project is not affiliated with Anthropic. Claude and Claude Code are trademarks of Anthropic, PBC.
