Grok CLI
Use Grok CLI with NanoGPT to access Grok models and 50+ other models through a single API key.NanoGPT provides an OpenAI-compatible endpoint that works with the Grok CLI. This lets you:
- Use Grok CLI with your NanoGPT credits
- Access Grok models without a separate xAI account
- Use any other NanoGPT model through the same CLI
Step 1: Install Grok CLI
Prerequisites: Node.js 18 or newerNote: 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
1
Get API Key
- Go to NanoGPT API
- Create an account or log in
- Copy your API key
2
Set Required Environment Variables
Grok CLI reads these environment variables:Replace
- macOS & Linux
- Windows PowerShell
- Windows Cmd
sk-nano-YOUR-API-KEY with your actual API key. Open a new terminal for changes to take effect if you set persistent variables.3
Optional: Make It Persistent
Add the variables to your shell profile (for example,
~/.zshrc or ~/.bashrc):