Hướng dẫn tích hợp

Gemini CLI integration

Configure the Gemini-compatible endpoint for Gemini CLI.

Overview

Gemini CLI is a terminal coding agent. Point its Gemini-compatible base URL to MoLoop to access Gemini, Claude, GPT, and other catalog models with one API key.

Quick configuration

The Gemini SDK uses a bare host; the client appends its paths.

Configure Gemini CLI with CC Switch

Import the current MoLoop Gemini endpoint and API key into the Gemini configuration in CC Switch.

Endpoint: https://api.moloop.io

text
Base URL: https://api.moloop.io
API key: YOUR_API_KEY

Compatibility

  • Chat Completions

  • Streaming

  • Tool calling

  • Image input (model dependent)

Step-by-step setup

Install Gemini CLI

Install globally with npm. On Windows, run it inside WSL.

bash
npm install -g @google/gemini-cli

Set environment variables

Create ~/.gemini/.env with GEMINI_API_KEY and a bare GOOGLE_GEMINI_BASE_URL; do not add /v1.

dotenv
GEMINI_API_KEY=YOUR_API_KEY
GOOGLE_GEMINI_BASE_URL=https://api.moloop.io

Start Gemini

Run gemini in the project directory to start a session.

bash
gemini

Not every OpenAI-compatible model is available through the Gemini endpoint; confirm endpoint type and model ID in the catalog.

Things to know

  • GOOGLE_GEMINI_BASE_URL must be a bare host without /v1; the SDK appends the path.

  • For authentication failures, check that the current shell reads ~/.gemini/.env.

Sẵn sàng bắt đầu?

Lấy API key và bắt đầu sử dụng MoLoop trong các công cụ này.