Appearance
Deploy Gemini CLI
Configure Gemini CLI to use 3xCoder as its API endpoint.
Prerequisites
Step 1: Install Gemini CLI
bash
npm install -g @anthropic-ai/gemini-cliOr use npx without installing:
bash
npx @anthropic-ai/gemini-cliVerify installation:
bash
gemini --versionStep 2: Configure Gemini CLI
Gemini CLI can be configured using environment variables and a settings file.
Using Environment Variables
powershell
$env:GEMINI_API_KEY = "sk-your-api-key-here"bash
export GEMINI_API_KEY="sk-your-api-key-here"Using .env File
Create a .env file in your project directory or home directory:
bash
GEMINI_API_KEY=sk-your-api-key-hereSettings File
Windows
Edit %APPDATA%\gemini\settings.json:
json
{
"baseUrl": "https://api.3xcoder.com/v1beta/models",
"apiKey": "sk-your-api-key-here"
}macOS
Edit ~/Library/Application Support/gemini/settings.json:
json
{
"baseUrl": "https://api.3xcoder.com/v1beta/models",
"apiKey": "sk-your-api-key-here"
}Linux
Edit ~/.config/gemini/settings.json:
json
{
"baseUrl": "https://api.3xcoder.com/v1beta/models",
"apiKey": "sk-your-api-key-here"
}Step 3: Verify
Run Gemini CLI:
bash
geminiIf configured correctly, Gemini CLI will connect through the 3xCoder relay.
Using CC-Switch
You can also configure Gemini CLI through CC-Switch:
- Run
npx cc-switch@latest - Select Gemini CLI as the target tool
- Set the base URL to
https://api.3xcoder.com/v1beta/models - Enter your API key
- Apply the configuration
Troubleshooting
gemini: command not found
- Ensure Node.js is installed and npm global bin is in your PATH
- Try
npx @anthropic-ai/gemini-cliinstead
Authentication errors
- Verify your API key is correct
- Make sure the key has access to Gemini models in your 3xCoder dashboard
- Check that the base URL matches exactly:
https://api.3xcoder.com/v1beta/models
Connection timeouts
- Check your internet connection
- Try:
curl https://api.3xcoder.com/v1/models -H "Authorization: Bearer sk-your-key" - If behind a proxy, configure the
HTTPS_PROXYenvironment variable
