Get up and running with Codestral CLI in under 5 minutes.
git clone https://github.com/momominds/codestral-cli.git
cd codestral-cli
./install.shgit clone https://github.com/momominds/codestral-cli.git
cd codestral-cli
pip3 install -r requirements.txt
chmod +x main.pyGet your API key from Mistral Console:
export MISTRAL_API_KEY="your-api-key-here"Or create a config file:
mkdir -p ~/.codestral
echo '{"api_key": "your-api-key"}' > ~/.codestral/config.json# Direct command
codestral-cli "Write a Python function to sort a list"
# Or with the full path
./main.py "Explain how async/await works in JavaScript"# Start interactive session
codestral-cli
# Interactive session example:
👤 You: How do I handle errors in Python?
🤖 Codestral: [streaming response about try/except blocks...]
👤 You: /review myfile.py
🤖 Codestral: [reviews your code file...]
👤 You: exit
👋 Goodbye!Use /command for built-in developer tools:
/explain ls -la # Explain shell commands
/review myfile.py # Code review and feedback
/commit # Generate git commit messages
/debug "ImportError" # Help debug errors
/suggest "deploy app" # Suggest commands for tasksexport MISTRAL_API_KEY="your-key" # Required
export MISTRAL_MODEL="codestral-latest" # Optional, default model
export MISTRAL_BASE_URL="https://..." # Optional, custom endpoint {
"api_key": "your-key-here",
"model": "codestral-latest",
"max_tokens": 2000,
"temperature": 0.1
}# Show help
codestral-cli --help
# Show version
codestral-cli --version
# Set token limit
codestral-cli "Long prompt here" --max-tokens 1000
# Interactive mode
codestral-clihelp # Show available commands
/help # Same as above
config # Show current configuration
clear # Clear conversation history# Fix SSL certificate issues
python3 fix_ssl.py
# Bypass SSL (temporary)
PYTHONHTTPSVERIFY=0 codestral-cli "test prompt"
# Update certificates
pip3 install --upgrade certifi- Read the Commands Reference for all available commands
- Check Configuration for advanced settings
- See Troubleshooting if you encounter issues
- Explore the API Reference for integration options
- Use descriptive prompts - The AI works better with clear, specific requests
- Try the developer tools -
/explain,/review,/debugare very helpful - Check the config - Type
configto see your current settings - Clear conversations - Use
clearto start fresh conversations - Exit gracefully - Use
exit,quit, orCtrl+Cto quit properly