Gemini configuration

Use Gemini through the dedicated Gemini channel. Create a dashboard API key, choose Gemini as its channel, and use that key in your client. The channel changes consumption speed (0.5×); it does not change the amount of token quota you purchased.

On this channel Gemini can call functions you declare and execute in your client. Requests for hosted tools such as Google Search or Google Maps return HTTP 400 before forwarding. The proxy forwards valid content as it arrives and bills the usage the upstream reports. Explicit cachedContent references can carry tool definitions and are rejected too. Implicit caching remains available.

Generation uses the standard service tier. Requests for an unpriced tier or a remote fileData input return HTTP 400. When the model is also supplied in the body it must match the URL. Use countTokens with the same key to count tokens in text and inline media without consuming generation quota.

Use GET /v1beta/models to list available models.

A generation request is allowed while the API key and its funding source have a positive remaining balance. Output and tool limits are independent of that balance. Each completed request is billed from actual usage, so concurrent requests can take the balance below zero.

Supported models

ModelChannelInputCacheOutput
gemini-3.5-flashGemini · default0.500.051.50
gemini-3.7-flashGemini0.500.051.50
gemini-3.8-flashGemini · new0.500.051.50

Prices shown are the effective Gemini-channel rates in USD per 1M tokens (the upstream rates multiplied by the channel's 0.5× consumption factor). Gemini models cannot be called with AWSQ, CCMAX, or Codex keys. If your work needs GPT models instead, use a Codex key; GPT-6.1 Sol vs Terra compares these two GPT-6.1 models.

Gemini CLI

The official Gemini CLI installation guide requires Node.js 20.0.0 or newer. Check your version first:

1
node --version

If Node.js is missing or older than 20.0.0, install a supported version first. The configuration below has been checked with Gemini CLI 0.67.0; install that version to follow these steps:

1
npm install -g @google/[email protected]
2
gemini --version

Configure the project

Open your project directory and create .gemini/settings.json. If it already exists, merge these fields and append the customOverrides entries to the existing array. Keep the API key in the environment, outside this file.

1
{
2
  "security": { "auth": { "selectedType": "gemini-api-key" } },
3
  "model": { "name": "gemini-3.8-flash" },
4
  "modelConfigs": {
5
    "customOverrides": [
6
      {"match": {"model": "base"}, "modelConfig": {"model": "gemini-3.8-flash"}},
7
      {"match": {"model": "gemini-3-pro-preview"}, "modelConfig": {"model": "gemini-3.8-flash"}},
8
      {"match": {"model": "gemini-3-flash-preview"}, "modelConfig": {"model": "gemini-3.8-flash"}},
9
      {"match": {"model": "gemini-3.1-flash-lite"}, "modelConfig": {"model": "gemini-3.8-flash"}},
10
      {"match": {"model": "gemini-2.5-pro"}, "modelConfig": {"model": "gemini-3.8-flash"}},
11
      {"match": {"model": "gemini-2.5-flash"}, "modelConfig": {"model": "gemini-3.8-flash"}},
12
      {"match": {"model": "gemini-2.5-flash-lite"}, "modelConfig": {"model": "gemini-3.8-flash"}}
13
    ]
14
  },
15
  "agents": {
16
    "overrides": {
17
      "codebase_investigator": { "modelConfig": { "model": "gemini-3.8-flash" } }
18
    }
19
  },
20
  "tools": { "exclude": ["google_web_search", "web_fetch"] }
21
}

This configuration uses API-key authentication and selects gemini-3.8-flash for the main conversation, built-in helper requests, context compression and the codebase investigator. --model alone does not override every helper or subagent model. Hosted Google Search and URL-context tools are excluded because this channel does not support them; local file and shell tools remain available.

Start from the project directory

Replace the placeholder with your Gemini dashboard key. On first launch, confirm project trust in the CLI to load the project settings:

1
export GEMINI_API_KEY="YOUR_DASHBOARD_API_KEY"
2
export GOOGLE_GEMINI_BASE_URL='https://api.aiinide.com'
3
gemini --model gemini-3.8-flash

Keep the explicit model selection: plain gemini without the project settings uses the client’s Auto routing, not the default model shown in this service’s catalog. If you install another CLI version, switch models, or add custom agents/extensions, review their model settings too. For Model "…" is not configured, check the model named in the error and the loaded settings. See the official model configuration and subagent configuration guides.

Use only a dashboard key in the client; never use the server’s upstream GEMINI_API_KEY.

Environment variables

The Gemini client appends /v1beta/models/... to the base URL.

1
export GEMINI_API_KEY="YOUR_DASHBOARD_API_KEY"
2
export GOOGLE_GEMINI_BASE_URL='https://api.aiinide.com'

Generate content

The REST endpoint follows the Gemini generateContent format. This example includes the complete code to explain; it does not read local files. Replace the placeholder with your Gemini dashboard key and run it in a Bash-compatible shell. Both examples below are billable requests that use your available quota.

1
export GEMINI_API_KEY="YOUR_DASHBOARD_API_KEY"
2
 
3
curl --globoff --fail-with-body 'https://api.aiinide.com/v1beta/models/gemini-3.8-flash:generateContent' \
4
  -H "x-goog-api-key: $GEMINI_API_KEY" \
5
  -H "Content-Type: application/json" \
6
  -d '{
7
    "contents": [{
8
      "role": "user",
9
      "parts": [{"text": "Explain in one sentence what this JavaScript function returns: function add(a, b) { return a + b; }"}]
10
    }],
11
    "generationConfig": {"temperature": 0.2}
12
  }'

Check for an answer in candidates[].content.parts[].text and finishReason: "STOP" on that candidate. For example: “It adds two numbers, or concatenates them if either value is a string.” Wording may vary. If no answer appears, inspect promptFeedback and finishReason; MAX_TOKENS means the output limit was reached. The proxy records actual usage after the response; check your usage history.

Streaming responses

Reuse the key exported above. Use streamGenerateContent and display arriving chunks with curl -N:

1
curl --globoff --fail-with-body -N 'https://api.aiinide.com/v1beta/models/gemini-3.8-flash:streamGenerateContent?alt=sse' \
2
  -H "x-goog-api-key: $GEMINI_API_KEY" \
3
  -H "Content-Type: application/json" \
4
  -d '{
5
    "contents": [{"role": "user", "parts": [{"text": "Explain in one sentence what this JavaScript function returns: function add(a, b) { return a + b; }"}]}]
6
  }'

The response contains SSE data: events. Read the answer chunks in candidates[].content.parts[].text in order and confirm that the candidate ends with finishReason: "STOP". The answer should explain the same function. HTTP 200 or a first text chunk alone does not confirm completion; a disconnected stream or another finish reason needs inspection.

Troubleshooting

  • 401: use a valid, non-expired dashboard key with the Gemini channel.
  • 400: check the model name and make sure the key belongs to the Gemini channel.
  • 429: the API key's purchased quota or request limit has been reached.
  • 503: the Gemini upstream is temporarily unavailable; retry later.

Existing Base URLs ending in /api/codex or /api/gemini continue to work with the same keys.

Gemini configuration - AI in IDE Documentation | AI in IDE