Skip to content

refactor: rename provider 'gemini' to 'google' to match models.dev - #279

Merged
nic-6443 merged 4 commits into
mainfrom
fix/rename-gemini-to-google
May 14, 2026
Merged

refactor: rename provider 'gemini' to 'google' to match models.dev#279
nic-6443 merged 4 commits into
mainfrom
fix/rename-gemini-to-google

Conversation

@jarvis9443

@jarvis9443 jarvis9443 commented May 14, 2026

Copy link
Copy Markdown
Contributor

Align the data-plane provider ID with models.dev's canonical provider identifier (google). The upstream API endpoint and behavior are unchanged — only the wire-level provider string changes from "gemini" to "google".

Changes:

  • Provider::GeminiProvider::Google
  • Rename crate aisix-provider-geminiaisix-provider-google
  • Update all schema enums, OpenAPI specs, test fixtures, and docs

Part of api7/AISIX-Cloud#290 — the CP will start sending "google" as the provider id for Google models to match models.dev.

Summary by CodeRabbit

  • Provider Updates

    • Replaced "gemini" with "google" across model/provider-key configurations and runtime provider registry; provider enum now lists Google instead of Gemini.
    • Default API-base handling and OpenAI-compatible bridge now recognize the "google" provider.
  • Documentation

    • All docs, quickstarts, and compatibility guides updated to reference "google" in examples and provider lists.

Review Change Stack

Align the data-plane provider ID with models.dev's canonical
provider identifier. The upstream API endpoint and behavior are
unchanged — only the wire-level provider string changes from
"gemini" to "google".

- Rename Provider::Gemini → Provider::Google
- Rename crate aisix-provider-gemini → aisix-provider-google
- Update all schema enums, OpenAPI specs, test fixtures, and docs

Ref: api7/AISIX-Cloud#290
Copilot AI review requested due to automatic review settings May 14, 2026 14:37
@coderabbitai

coderabbitai Bot commented May 14, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@jarvis9443 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 8 minutes and 42 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 327ef06c-ea20-4897-bc36-edd19da64ebd

📥 Commits

Reviewing files that changed from the base of the PR and between 76733a4 and 23bc15a.

📒 Files selected for processing (4)
  • docs/configuration/models.md
  • docs/overview/core-concepts.md
  • docs/overview/what-is-aisix-ai-gateway.md
  • docs/reference/provider-compatibility.md
📝 Walkthrough

Walkthrough

This PR replaces the upstream provider identity gemini with google across core types/schemas, provider crate and OpenAI-compatible bridge, workspace and crate dependencies, routing defaults, integration and E2E tests, and documentation.

Changes

Provider Identity Refactor: Gemini → Google

Layer / File(s) Summary
Core Provider Type Definition
crates/aisix-core/src/models/model.rs, crates/aisix-core/src/models/schema.rs, crates/aisix-admin/src/openapi.rs
Provider enum replaces Gemini with Google. Default base URL mapping, as_str, JSON schema, and OpenAPI provider enum updated; unit test updated to assert Provider::Google.default_base_url().
Google Provider Bridge Implementation
crates/aisix-provider-google/Cargo.toml, crates/aisix-provider-google/src/lib.rs, crates/aisix-provider-openai/src/bridge.rs
Crate/package renamed to aisix-provider-google. Introduces GOOGLE_DEFAULT_BASE and google_bridge(); OpenAiBridge maps name "google" to GOOGLE_DEFAULT_BASE. Unit tests updated to construct bridges with with_name("google").
Workspace and Dependency Wiring
Cargo.toml, crates/aisix-proxy/Cargo.toml, crates/aisix-server/Cargo.toml, crates/aisix-server/src/main.rs
Workspace members and crate dependency entries updated to reference aisix-provider-google. Server startup imports google_bridge and registers Provider::Google in the Hub.
Request Routing and Default Base Selection
crates/aisix-proxy/src/passthrough.rs, crates/aisix-proxy/src/rerank.rs
Provider-prefix default-base lookup now handles "google" (Generative Language /v1beta/openai shim); rerank mapping updated to use Provider::Google where previously Provider::Gemini was handled.
Integration Test Fixtures and Constants
crates/aisix-proxy/src/lib.rs, crates/aisix-proxy/src/messages.rs
Test constants and fixtures renamed/repointed: MATRIX_GOOGLE_PK_ID, GOOGLE_PK_ID; fixture JSON provider fields set to "google" and imports adjusted to use google_bridge.
End-to-End and Matrix Tests
tests/e2e/src/cases/*, crates/aisix-proxy/src/lib.rs, crates/aisix-proxy/src/messages.rs
E2E provider unions and case entries updated to use provider: "google". Matrix test wiring and SSE/shared helpers switched to Provider::Google and google_bridge() imports.
Documentation Updates
docs/* (models, provider-keys, integration guides, quickstart, feature matrix, compatibility)
User-facing docs updated to list google instead of gemini, update canonical api_base table and tolerance guidance, and reflect provider enum changes and examples.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: renaming the provider from 'gemini' to 'google' throughout the codebase to match models.dev canonical naming.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
crates/aisix-core/src/models/model.rs (1)

22-27: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Preserve backward deserialization for legacy "gemini" provider values.

After this rename, any persisted model JSON still containing "provider": "gemini" will fail to deserialize. Add a serde alias so reads stay backward-compatible while writes continue emitting "google".

Suggested patch
 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
 #[serde(rename_all = "lowercase")]
 pub enum Provider {
     Openai,
     Anthropic,
+    #[serde(alias = "gemini")]
     Google,
     Deepseek,
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/aisix-core/src/models/model.rs` around lines 22 - 27, The Provider
enum's Google variant must accept legacy "gemini" strings when deserializing;
update the enum definition (enum Provider) to add a serde alias for the Google
variant (e.g., annotate the Google variant with a serde alias "gemini") so reads
remain backward-compatible while writes still emit "google" (leaving the
existing #[serde(rename_all = "lowercase")] in place).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/aisix-admin/src/openapi.rs`:
- Line 274: OpenAPI's Model.provider enum is missing "cohere" and "jina",
causing the spec to diverge from runtime validation; update the provider enum
definition (the line containing "provider": {"type":"string","enum":[...]} in
openapi.rs) to include "cohere" and "jina" so the documented values match the
runtime Model.provider validation and accepted inputs.

In `@docs/tutorials/openai-client-to-anthropic-upstream.md`:
- Line 155: Two remaining docs still reference "Gemini"/"gemini"; update those
mentions to "Google"/"google" to match the code/schema change. Specifically,
search for the literal strings "Gemini", "gemini", and the phrase "Gemini's
OpenAI-compatible surface" in the documentation and replace them with "Google",
"google", and "Google's OpenAI-compatible surface" respectively so the provider
name is consistent with the enum and earlier diff.

---

Outside diff comments:
In `@crates/aisix-core/src/models/model.rs`:
- Around line 22-27: The Provider enum's Google variant must accept legacy
"gemini" strings when deserializing; update the enum definition (enum Provider)
to add a serde alias for the Google variant (e.g., annotate the Google variant
with a serde alias "gemini") so reads remain backward-compatible while writes
still emit "google" (leaving the existing #[serde(rename_all = "lowercase")] in
place).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5b743e09-61ea-4796-9432-b83ac956297c

📥 Commits

Reviewing files that changed from the base of the PR and between 7f57ed6 and 1a70017.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (25)
  • Cargo.toml
  • crates/aisix-admin/src/openapi.rs
  • crates/aisix-core/src/models/model.rs
  • crates/aisix-core/src/models/schema.rs
  • crates/aisix-provider-google/Cargo.toml
  • crates/aisix-provider-google/src/lib.rs
  • crates/aisix-provider-openai/src/bridge.rs
  • crates/aisix-proxy/Cargo.toml
  • crates/aisix-proxy/src/lib.rs
  • crates/aisix-proxy/src/messages.rs
  • crates/aisix-proxy/src/passthrough.rs
  • crates/aisix-proxy/src/rerank.rs
  • crates/aisix-server/Cargo.toml
  • crates/aisix-server/src/main.rs
  • docs/configuration/models.md
  • docs/configuration/provider-keys.md
  • docs/integration/anthropic-messages.md
  • docs/overview/core-concepts.md
  • docs/overview/what-is-aisix-ai-gateway.md
  • docs/quickstart/first-model-first-key-first-request.md
  • docs/reference/provider-compatibility.md
  • docs/tutorials/openai-client-to-anthropic-upstream.md
  • tests/e2e/src/cases/cross-provider-matrix-e2e.test.ts
  • tests/e2e/src/cases/error-envelope-normalization-e2e.test.ts
  • tests/e2e/src/cases/responses-endpoint-e2e.test.ts

Comment thread crates/aisix-admin/src/openapi.rs Outdated
Comment thread docs/tutorials/openai-client-to-anthropic-upstream.md

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR renames the Gemini provider identifier to Google across the data plane to align with models.dev’s canonical google provider ID, while keeping the upstream Gemini/OpenAI-compatible behavior unchanged.

Changes:

  • Renames the Rust provider enum/crate dependency path from Gemini/Gemini crate naming to Google.
  • Updates provider strings in tests, schemas, OpenAPI, docs, and hub registration.
  • Keeps Google Gemini traffic routed through the OpenAI-compatible bridge implementation.

Reviewed changes

Copilot reviewed 25 out of 26 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
tests/e2e/src/cases/responses-endpoint-e2e.test.ts Updates non-OpenAI provider test case from gemini to google.
tests/e2e/src/cases/error-envelope-normalization-e2e.test.ts Updates provider union and error-normalization case to google.
tests/e2e/src/cases/cross-provider-matrix-e2e.test.ts Updates matrix provider type and case to google.
docs/tutorials/openai-client-to-anthropic-upstream.md Updates tutorial provider example to google.
docs/reference/provider-compatibility.md Updates documented provider list to google.
docs/quickstart/first-model-first-key-first-request.md Updates quickstart api_base guidance to use google.
docs/overview/what-is-aisix-ai-gateway.md Updates overview provider enum list to google.
docs/overview/core-concepts.md Updates core concepts provider enum list to google.
docs/integration/anthropic-messages.md Updates non-Anthropic upstream provider list to google.
docs/configuration/provider-keys.md Updates provider-key api_base table and guidance to google.
docs/configuration/models.md Updates model configuration provider list to google.
crates/aisix-server/src/main.rs Registers the renamed Provider::Google bridge in the hub.
crates/aisix-server/Cargo.toml Switches server dependency to aisix-provider-google.
crates/aisix-proxy/src/rerank.rs Updates rerank unsupported-provider match arm to Provider::Google.
crates/aisix-proxy/src/passthrough.rs Updates passthrough default base provider prefix to google.
crates/aisix-proxy/src/messages.rs Updates message-path tests and registrations to Provider::Google.
crates/aisix-proxy/src/lib.rs Updates proxy matrix tests to use google.
crates/aisix-proxy/Cargo.toml Switches proxy dev dependency to aisix-provider-google.
crates/aisix-provider-openai/src/bridge.rs Adds Google-specific default-base handling for the OpenAI-compatible bridge.
crates/aisix-provider-google/src/lib.rs Renames crate docs/constants and relabels bridge name to google.
crates/aisix-provider-google/Cargo.toml Renames package to aisix-provider-google.
crates/aisix-core/src/models/schema.rs Updates model JSON schema provider enum to google.
crates/aisix-core/src/models/model.rs Renames Provider::Gemini to Provider::Google.
crates/aisix-admin/src/openapi.rs Updates OpenAPI model provider enum to google.
Cargo.toml Updates workspace member path to aisix-provider-google.
Cargo.lock Updates lockfile package/dependency names to aisix-provider-google.
Comments suppressed due to low confidence (2)

crates/aisix-provider-google/src/lib.rs:33

  • The public factory is still named gemini_bridge even though the crate and provider ID have been renamed to google. This leaves downstream callers importing aisix_provider_google::gemini_bridge, which exposes the old provider name in the public API and is inconsistent with the analogous deepseek_bridge factory.
    tests/e2e/src/cases/error-envelope-normalization-e2e.test.ts:100
  • This case now uses provider google, but the nearby explanatory comment still describes the “gemini bridge.” That makes the test documentation inconsistent with the renamed provider ID.
    provider: "google",
    upstreamModelId: "gemini-2.0-flash",
    displayName: "err-norm-gemini",
    // The gemini bridge talks to Google's OpenAI-compatibility
    // endpoint per <https://ai.google.dev/gemini-api/docs/openai>,

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/aisix-provider-openai/src/bridge.rs
Comment thread crates/aisix-core/src/models/schema.rs
Comment thread crates/aisix-core/src/models/model.rs
Comment thread crates/aisix-admin/src/openapi.rs Outdated
Comment thread docs/reference/provider-compatibility.md
Comment thread docs/overview/what-is-aisix-ai-gateway.md
Comment thread docs/overview/core-concepts.md
Comment thread docs/configuration/models.md Outdated
- Add cohere and jina to OpenAPI Model.provider enum
- Update docs/feature-matrix.md and provider-keys.md
- Fix test name and doc comments in provider-google crate
Copilot AI review requested due to automatic review settings May 14, 2026 14:55

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 26 out of 27 changed files in this pull request and generated 7 comments.

Comment thread crates/aisix-core/src/models/schema.rs
Comment thread crates/aisix-provider-openai/src/bridge.rs
Comment thread docs/reference/provider-compatibility.md
Comment thread docs/overview/core-concepts.md
Comment thread docs/overview/what-is-aisix-ai-gateway.md
Comment thread docs/configuration/models.md
Comment thread tests/e2e/src/cases/error-envelope-normalization-e2e.test.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants