Working with multiple LLM providers means juggling dozens of API keys, environment variables, and authentication flows. llm-gate brings order to the chaos. It serves as a unified, central hub CLI to efficiently store, manage, verify, and seamlessly inject API keys for over 30 LLM providers.
- 🌐 30+ Supported Providers: OpenAI, Anthropic, Google Gemini, Groq, Mistral, Code Llama, xAI (Grok), and many more.
- 🛡️ Secure Storage: Keys are permanently stored in
~/.config/llm-gate/config.yamlusing strict0600file permissions. - 🚀 Seamless Shell Integration: Activate or deactivate any provider's environment variables directly within your current terminal session via
eval. - ✅ Real-Time Connectivity: Ping any network to verify if your API credentials are active and healthy, retrieving latencies and specific JSON error payloads if failures occur.
- 🧭 Interactive Onboarding: Provides interactive, guided flows that will automatically open the exact API-key generation URLs in your browser for standard providers.
- 🔄 Smart Aliasing: Resolves popular names (e.g.
grok->xai,github-copilot->copilot).
To get up and running, clone the repository and build from the source:
# Clone the repository
git clone https://github.com/amin-tehrani/llm-gate.git
cd llm-gate
# Build and install to your PATH
make installSince child processes cannot modify the parent shell's environment variables, llm-gate uses an eval wrapper function. You must add the following snippet to your shell configuration (~/.zshrc, ~/.bashrc, or ~/.config/fish/config.fish):
# Add this line to the end of your shell rc file:
eval "$(llm-gate shell-init)"Restart your terminal, and llm-gate activate will now work seamlessly! Furthermore, opening new terminal tabs or splits will automatically pull your persisted configuration from llm-gate current and keep your API keys active across sessions.
Start by authenticating an LLM provider. The interactive CLI will prompt you and even open your browser directly to the provider's API Key generation page:
llm-gate auth openai(Alternatively, you can skip the interactive prompt by running: llm-gate set openai sk-...)
Make sure your key works:
llm-gate check openai
# Output: ✓ OpenAI connected (1338ms)Export the API key natively into your shell's current session:
llm-gate activate openai
# Your shell now has $OPENAI_API_KEY exported perfectly!| Command | Description |
|---|---|
help |
Standard help & usage command list. |
list |
Show all 30+ fully supported LLM providers and their mapped aliases. |
status |
Print a clean table of all providers and their localized configuration statuses. |
current |
Echoes the active environment variable export and unset statements tailored for your shell. |
auth <provider> |
Launch the interactive authentication wizard, guiding you with browser URLs. |
set <provider> <key> |
Save an API key directly without interactive prompts. |
update <provider> <key> |
Update/overwrite an API key (alias for set). |
activate <provider> |
Export the environment variable mapping specifically for this vendor into your active CLI environment. |
deactivate <provider> |
Unset the exported environment variable. |
check [provider] |
Test provider health. Optionally pass --all or -a to ping all customized providers sequentially. |
remove <provider> |
Delete a stored key locally. |
config |
Echo out the location strings for where configurations exist locally. |
completion <shell> |
Generate the autocompletion script (bash, zsh, fish, powershell). |
Run llm-gate list to view the comprehensive list. Highlights include:
- OpenAI (
openai,openai-codex) - Anthropic (
anthropic) - Google Gemini (
gemini, aliases:google) - Meta/Local (
ollama) - xAI/Grok (
xai, aliases:grok) - Cloud Infrastructure Models (
cloudflare,vercel,doubao,qwen,qianfan,bedrock) - High-Performance inference hubs (
groq,together,fireworks,openrouter) - Asian Leading Models (
moonshot,kimi-code,glm,zai,minimax,deepseek) - Others (
mistral,synthetic,opencode,novita,perplexity,cohere,copilot)
Contributions, issues, and feature requests are always welcome!
Feel free to check the issues page. If you want to add a new provider, just append it to the registry.go array with the designated configuration parameters.
This architecture is licensed under MIT.