Skip to main content
Gemini CLI is a powerful command-line interface tool that provides direct access to Google’s Gemini AI models from your terminal. It offers intelligent code generation, natural language processing, and development assistance capabilities. By integrating Gemini CLI with Unbound Security AI Gateway, you can leverage these AI capabilities while maintaining enterprise-grade security, cost control, and compliance.

Prerequisites

Before setting up the integration, ensure you have:
  • Unbound CLI: Installed and logged in — see the CLI guide
  • Node.js: Version 20 or higher
  • Gemini CLI: Install with npm install -g @google/gemini-cli

Setup with Unbound CLI

This sets the GEMINI_API_KEY and GOOGLE_GEMINI_BASE_URL environment variables to route Gemini CLI through Unbound. To remove the Unbound configuration:
Restart your terminal after setup. When Gemini CLI prompts for authentication, select “Use Gemini API Key” and press Enter — the key is already configured.

Usage

Basic Usage

Once configured, you can start using Gemini CLI in your terminal:
This launches the interactive Gemini interface where you can:
  • Generate code for various programming languages
  • Ask questions about development topics
  • Get assistance with debugging
  • Process and analyze text content

Example Commands

Advanced Usage

Model Selection

You can specify different Gemini models:

Troubleshooting

Common Issues

Gemini CLI not found after installation:
API key not recognized:
Connection issues:
  • Ensure your Unbound API key is valid
  • Check that the base URL is correct
  • Verify your internet connection
  • Confirm the Unbound service is running
Model not found:

Security Benefits

Using Gemini CLI with Unbound Security AI Gateway provides:
  • Request Monitoring: All AI requests are logged and monitored
  • Cost Control: Set spending limits and track usage across all models
  • Compliance: Ensure AI interactions meet your organization’s standards
  • Guardrails: Apply security policies to AI responses
  • Audit Trail: Complete visibility into AI usage patterns
  • Model Routing: Intelligent routing to optimize performance and costs
  • Rate Limiting: Prevent abuse and manage resource usage

Best Practices

Development Workflow

  1. Start with simple prompts to test the integration
  2. Use specific, clear instructions for better results
  3. Iterate on prompts to improve output quality
  4. Monitor usage through Unbound dashboard
  5. Set appropriate guardrails for your use case

Security Considerations

  • Keep your API keys secure and never commit them to version control
  • Use environment variables for configuration
  • Regularly rotate your API keys
  • Monitor usage patterns for anomalies
  • Set up appropriate guardrails for your organization’s needs

Unbound CLI

Install the CLI to set up and manage tools

Tool Policies

Configure security guardrails for AI tools