Skip to main content
Configure Grok CLI to use Adaptive’s intelligent routing for 60-90% cost savings while maintaining the same AI-powered command line experience.
Save 60-90% on AI development costs with intelligent model routing. Works as a drop-in replacement for Grok CLI’s API backend. The installer automatically configures your shell environment.

Get Your Adaptive API Key

Sign up here to create an account and generate your API key.

Quick Setup

Run Installer

curl -fsSL https://raw.githubusercontent.com/Egham-7/adaptive/main/scripts/installers/grok-cli.sh | bash
The installer will automatically:
  • Install Grok CLI if not present
  • Configure Adaptive API settings
  • Add environment variables to your shell config

Verify Configuration

grok --version
grok "Hello, test Adaptive integration"

Start Using

Begin using Grok CLI with cost-optimized intelligent routing for all your AI tasks.

Alternative Setup Methods

export ADAPTIVE_API_KEY='your-api-key-here'
curl -fsSL https://raw.githubusercontent.com/Egham-7/adaptive/main/scripts/installers/grok-cli.sh | bash
# The installer will automatically add the API key to your shell config

Advanced Configuration

The installer automatically handles environment variable setup for all major shells (bash, zsh, fish). Manual configuration is typically not needed.

Custom Model Selection

# Override default intelligent routing with specific model
export ADAPTIVE_MODEL="anthropic:claude-sonnet-4-5"
export ADAPTIVE_MODELS='["anthropic:claude-sonnet-4-5","openai:gpt-5-mini","gemini:gemini-2.5-flash-lite"]'

Shell-Specific Configuration

# Adaptive LLM API Configuration
export ADAPTIVE_API_KEY="your-adaptive-api-key"
export ADAPTIVE_BASE_URL="https://api.llmadaptive.uk/v1"

Troubleshooting

  • Ensure you have the required dependencies (Node.js, Python, etc.)
  • Check installation logs for specific error messages
  • Try the interactive installation method for better error handling
  • Verify your API key at llmadaptive.uk/dashboard
  • Check that API key is properly set in ~/.grok/user-settings.json
  • Ensure environment variables are exported in your shell config:
    # Check if variables are set
    echo $ADAPTIVE_API_KEY
    echo $ADAPTIVE_BASE_URL
    
    # If not set, restart terminal or source your shell config
    source ~/.bashrc  # or ~/.zshrc for Zsh users
    

Next Steps


Was this page helpful? Contact us at info@llmadaptive.uk for feedback or assistance with your Grok CLI integration.