This guide helps you diagnose and resolve common issues with LLM Environment Manager.
Current Version: v1.1.0
- v1.1.0: Added --help, test, backup/restore, bulk operations, debug mode
- v1.0.0: Initial release with basic provider switching
llm-env --help: Comprehensive help systemllm-env test <provider>: API connectivity testingllm-env config backup/restore: Configuration backup and restorellm-env config bulk <action>: Bulk enable/disable operationsLLM_ENV_DEBUG=1: Debug mode for troubleshooting- Enhanced installer with multi-shell support and uninstall
# Verify all providers and keys
llm-env list
# Check current environment
llm-env show
# Test provider connectivity (new in v1.1.0)
llm-env test cerebras
# Test a simple request manually
curl -H "Authorization: Bearer $OPENAI_API_KEY" $OPENAI_BASE_URL/models
# Get comprehensive help
llm-env --help# Enable detailed logging
export LLM_ENV_DEBUG=1
llm-env listSymptoms:
- Error message when setting a provider
- Empty
$OPENAI_API_KEYvariable
Solutions:
-
Check if the environment variable is set:
# For OpenAI echo $LLM_OPENAI_API_KEY # For Cerebras echo $LLM_CEREBRAS_API_KEY
-
Add API keys to your shell profile:
# Edit your shell profile nano ~/.bashrc # or ~/.zshrc # Add your API keys export LLM_OPENAI_API_KEY="your_key_here" export LLM_CEREBRAS_API_KEY="your_key_here" # Reload your shell source ~/.bashrc
-
Check the API key variable name in configuration:
# Check what variable name is expected grep -A5 "\[openai\]" ~/.config/llm-env/config.conf
Symptoms:
- Provider not listed in
llm-env list - Error when trying to set a provider
Solutions:
-
Check available providers:
llm-env list
-
Verify provider is enabled in configuration:
# Check if provider exists and is enabled grep -A6 "\[provider_name\]" ~/.config/llm-env/config.conf
-
Add missing provider to configuration:
# Add provider interactively llm-env config add provider_name
Symptoms:
- Shell can't find the
llm-envcommand - Script works with full path but not as command
Solutions:
-
Check if script is in PATH:
which llm-env ls -la /usr/local/bin/llm-env
-
Verify script is executable:
chmod +x /usr/local/bin/llm-env
-
Check shell function is defined:
# Check if function exists type llm-env # Add function to shell profile if missing echo 'llm-env() { source /usr/local/bin/llm-env "$@"; }' >> ~/.bashrc source ~/.bashrc
Symptoms:
- Changes to configuration file not taking effect
- Default providers still showing after customization
Solutions:
-
Check configuration file location:
# Check which config file is being used export LLM_ENV_DEBUG=1 llm-env list
-
Verify file permissions:
ls -la ~/.config/llm-env/config.conf # Should be readable by your user
-
Validate configuration syntax:
llm-env config validate
Symptoms:
- 401 Unauthorized errors
- Connection timeouts
- Invalid model errors
Solutions:
-
Test API key manually:
# Test OpenAI API (using curl) curl -H "Authorization: Bearer $LLM_OPENAI_API_KEY" \ https://api.openai.com/v1/models # Or using wget wget -q -S -O - --header="Authorization: Bearer $LLM_OPENAI_API_KEY" \ https://api.openai.com/v1/models # Test Cerebras API curl -H "Authorization: Bearer $LLM_CEREBRAS_API_KEY" \ https://api.cerebras.ai/v1/models
-
Check model availability:
# List available models for current provider curl -H "Authorization: Bearer $OPENAI_API_KEY" \ "$OPENAI_BASE_URL/models"
-
Verify base URL is correct:
echo $OPENAI_BASE_URL # Should end with /v1 for most providers
Symptoms:
llm-env test anthropicshows "Method not allowed (HTTP 405)" but says "connected successfully"- Tools expecting
OPENAI_variables don't work when Anthropic is set
Solutions:
-
HTTP 405 is normal for testing: Anthropic's
/v1/messagesendpoint only accepts POST requests. The test command sends a GET request to check connectivity. A 405 error confirms the endpoint exists and is reachable, sollm-envconsiders this a success. -
Variable Swapping: When you
llm-env set anthropic(if configured withprotocol=anthropic), it exportsANTHROPIC_API_KEYand unsetsOPENAI_API_KEY.- Tools that only support OpenAI will fail.
- Use this mode only for tools that natively support Anthropic.
- If you need to use Anthropic with an OpenAI-only tool, consider using a proxy or checking if the tool supports a custom compatible endpoint (some "Anthropic" providers might offer an OpenAI-compatible endpoint, in which case use
protocol=openai).
Symptoms:
- Variables work in current session but disappear after restart
- Need to run
llm-env setevery time
Solutions:
-
Check shell profile is being loaded:
# For bash echo $BASH_VERSION cat ~/.bashrc | grep LLM_ # For zsh echo $ZSH_VERSION cat ~/.zshrc | grep LLM_
-
Add API keys to correct profile:
# Determine your shell echo $SHELL # Edit the appropriate file # For bash: ~/.bashrc # For zsh: ~/.zshrc
-
Source the profile after changes:
source ~/.bashrc # or ~/.zshrc
# Enable debug mode
export LLM_ENV_DEBUG=1
# Check configuration loading
llm-env list
# This will show:
# - Which config files are checked
# - Which file is actually loaded
# - How providers are parsed# Show all LLM-related environment variables
env | grep LLM_
# Show current OpenAI variables
env | grep OPENAI_
# Check specific provider variables
echo "Cerebras: $LLM_CEREBRAS_API_KEY"
echo "OpenAI: $LLM_OPENAI_API_KEY"
echo "Groq: $LLM_GROQ_API_KEY"# Test each provider's endpoint
for provider in cerebras openai groq openrouter; do
echo "Testing $provider..."
llm-env set $provider
curl -s -o /dev/null -w "%{http_code}" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
"$OPENAI_BASE_URL/models"
echo
done# Verify script hasn't been corrupted
head -1 /usr/local/bin/llm-env
# Should show: #!/bin/bash
# Check script permissions
ls -la /usr/local/bin/llm-env
# Should be executable (-rwxr-xr-x)
# Test script directly
/usr/local/bin/llm-env list-
Gatekeeper blocking script:
# Remove quarantine attribute xattr -d com.apple.quarantine /usr/local/bin/llm-env -
PATH issues with different shells:
# Check default shell echo $SHELL # macOS might use different profile files # Try ~/.bash_profile instead of ~/.bashrc
-
Permission issues:
# Ensure user can write to config directory mkdir -p ~/.config/llm-env chmod 755 ~/.config/llm-env
-
Different shell configurations:
# Some distributions use different profile files # Check: ~/.profile, ~/.bash_profile, ~/.bashrc
-
Line ending issues:
# Convert line endings if needed dos2unix /usr/local/bin/llm-env -
PATH differences:
# Windows paths might need adjustment # Use /c/Users/username/ instead of ~
-
WSL-specific issues:
# Check WSL version wsl --version # Ensure proper shell configuration echo $SHELL # WSL2 networking issues # May need to restart WSL if API calls fail wsl --shutdown
-
PowerShell integration:
# If using PowerShell, you can create a wrapper function function llm-env { bash -c "source /usr/local/bin/llm-env '$args'" }
Before reporting issues, collect this information:
# System information
echo "OS: $(uname -a)"
echo "Shell: $SHELL"
echo "Script location: $(which llm-env)"
# Configuration information
echo "Config file:"
find ~/.config /usr/local/etc . -name "*llm-env*" 2>/dev/null
# Environment variables
echo "LLM variables:"
env | grep LLM_ | sed 's/=.*/=***HIDDEN***/'
# Current state
echo "Current provider:"
llm-env showWhen reporting issues, include:
- Error message (exact text)
- Steps to reproduce the issue
- System information (OS, shell)
- Configuration (sanitized, no API keys)
- Debug output (with
LLM_ENV_DEBUG=1)
- GitHub Issues: Report bugs and feature requests
- Discussions: Ask questions and share tips
- Wiki: Community-maintained documentation
For configuration help, see the Configuration Guide. For general usage, see the main documentation.