Add Google AI Studio (Gemini API) as a built-in model provider

Open 💬 0 comments Opened Jul 21, 2026 by ImBIOS

Feature Request

Add Google AI Studio (the Gemini API at generativelanguage.googleapis.com) as a first-class built-in model provider in the bundled provider catalog.

Problem

Google's Gemini models (e.g., Gemini 3.5 Flash, Gemini 3.1 Pro Preview) are currently only available in Codex through third-party aggregators like OpenRouter or GitHub Models. There is no built-in provider that connects directly to Google AI Studio using a GEMINI_API_KEY.

This means users who want to use Google's models directly — with lower latency, direct billing, and access to the latest preview models — must either:

  1. Manually configure a custom provider in ~/.codex/config.toml, or
  2. Route through a third-party provider (e.g., OpenRouter), paying markup and losing access to some preview models.

Proposed Solution

Google AI Studio offers an OpenAI-compatible endpoint at:

https://generativelanguage.googleapis.com/v1beta/openai/

This means a new provider entry can be added to the bundled catalog (provider_catalog.json) using wire_api: "chat" with GEMINI_API_KEY as the environment key — no new wire protocol is required.

The provider entry would look like:

{
  "id": "google",
  "name": "Google AI Studio",
  "env_key": "GEMINI_API_KEY",
  "base_url": "https://generativelanguage.googleapis.com/v1beta/openai",
  "wire_api": "chat",
  "sort_priority": 3,
  "models": [
    {
      "id": "gemini-3.5-flash",
      "display_name": "Gemini 3.5 Flash",
      "description": "gemini-flash • Reasoning • Tool calling • Image input • PDF input",
      "reasoning": true,
      "input_modalities": ["text", "image"],
      "context_window": 1048576,
      "priority": 0
    },
    {
      "id": "gemini-3.1-pro-preview",
      "display_name": "Gemini 3.1 Pro Preview",
      "description": "gemini-pro • Reasoning • Tool calling • Image input • PDF input",
      "reasoning": true,
      "input_modalities": ["text", "image"],
      "context_window": 1048576,
      "priority": 1
    }
  ]
}

Context

Previous related issues/PRs were all closed without resolution:

  • #1106 / #1107 — Vertex AI with ADC (closed, different scope — this request is for the simpler AI Studio API key flow)
  • #3848 — Proposed a new generateContent wire_api (closed — unnecessary now that Google provides an OpenAI-compatible endpoint)
  • #1292 — Initial Gemini 2.5 Pro support via native SDK (closed — the OpenAI-compatible endpoint is a simpler path)

Acceptance Criteria

  • A google provider entry exists in the bundled provider catalog
  • Users can select Google AI Studio models by setting GEMINI_API_KEY and configuring model_provider = "google"
  • Gemini 3.5 Flash and Gemini 3.1 Pro Preview are listed as available models

View original on GitHub ↗