AISIX 1.12.0: Bring Gemini Clients to Gateway-Managed Models
November 26, 2026
An application that speaks Gemini's generation protocol should not need a second client implementation just to reach a different model backend. AISIX 1.12.0, released November 26, 2026, adds a gateway entry point for that decision: Gemini clients address an AISIX model alias, and the gateway uses either a native Gemini target or a supported Chat Completions bridge.
Consider an engineering team whose application summarizes deployment checklists. The team wants to evaluate Google AI Studio alongside an existing Chat Completions backend while keeping its Gemini request format. The new route separates the application's protocol from the administrator's upstream choice. It does not make those backends equivalent in model behavior or supported options.
We verified both paths with the official AISIX 1.12.0 gateway and simulated upstreams:
| Caller operation | AISIX alias | Recorded upstream path | Observed result |
|---|---|---|---|
generateContent | native-assistant | /v1beta/models/gemini-demo:generateContent | 200, Gemini JSON |
streamGenerateContent?alt=sse | native-assistant | /v1beta/models/gemini-demo:streamGenerateContent?alt=sse | 200, SSE |
generateContent | bridge-assistant | /v1/chat/completions | 200, Gemini JSON |
streamGenerateContent?alt=sse | bridge-assistant | /v1/chat/completions | 200, Gemini SSE |
These are real gateway responses and recorded fixture requests. The providers, answers and token counts were simulated. This protocol workflow is demonstrated through configuration, requests and results rather than a dashboard screenshot; it does not establish real-provider compatibility, model quality, costs or budget enforcement.
Keep the Client Protocol, Choose the Upstream Deliberately
A client sends POST /v1beta/models/{alias}:generateContent for JSON or POST /v1beta/models/{alias}:streamGenerateContent?alt=sse for streaming. AISIX also accepts the enterprise-shaped prefix /v1beta1/projects/{project}/locations/{location}/publishers/google/models/{alias} with those actions. The name in the path resolves to an AISIX alias, and the caller key must have access to it.
For the checklist application, native-assistant points to the simulated Gemini model gemini-demo; bridge-assistant points to chat-demo. Production aliases should point to model IDs actually available through the selected provider credential.
The two paths have different contracts:
- Native Gemini: a qualifying provider key declares
apis.gemini. AISIX uses the native generation endpoint, retaining native candidate, tool-history, thought-signature and usage fields. Policy processing can modify readable content; this is not a promise of byte-for-byte passthrough. - Chat Completions bridge: AISIX translates Gemini contents into a Chat Completions request and converts the response back. The target must use a supported
openaiorazure-openaiwire adapter. A provider label or generic tool capability alone does not establish compatibility with the client's requested fields.
The Gemini provider guide explains Google AI Studio setup. For Antigravity CLI, use the version-specific integration guide, including its client settings and tool-round-trip checks. Our local capture used HTTP requests, not an Antigravity session.
Make the Native Declaration and Alias Visible
In AISIX OSS, the provider key's native declaration and the model's provider-key reference are explicit. This excerpt from the verified demo shows the native half; the full resources file also needs caller-key and other model entries:
_format_version: '2' provider_keys: - id: 00000000-0000-4000-8000-000000001121 display_name: native-provider provider: google adapter: openai api_key: simulated-provider-key api_base: http://host.docker.internal:19812/v1beta/openai apis: gemini: base: http://host.docker.internal:19812/v1beta models: - id: 00000000-0000-4000-8000-000000001123 display_name: native-assistant provider: google model_name: gemini-demo provider_key_id: 00000000-0000-4000-8000-000000001121
The HTTP address is an isolated fixture, not a production Google endpoint. Use the official provider guide for production credentials and roots. The demo's separate OpenAI provider key omitted apis.gemini and used /v1 as its Chat Completions base. Validate the complete format-2 file before starting the gateway; our five-resource file passed aisix validate.
AISIX Enterprise and AISIX Cloud share this gateway runtime and add their control plane. At the official Google endpoint, the 1.12 control plane supplies the native declaration when apis is omitted. An explicit value, including {}, takes precedence. Custom endpoints require an explicit versioned native root. After upgrading all control-plane replicas, inspect an official Google key that still lacks apis; PATCH it with only its current display_name to restore the catalog settings. OSS file configuration needs its own explicit declaration.
Verify the Boundary from Request to Result
After provisioning the two aliases and granting the caller key access, the checklist application can send the same body to either alias. Set AISIX_PROXY to your gateway origin and AISIX_API_KEY to its caller key:
curl -sS "$AISIX_PROXY/v1beta/models/native-assistant:generateContent" \ -H "x-aisix-api-key: $AISIX_API_KEY" \ -H "Content-Type: application/json" \ -d '{"contents":[{"role":"user","parts":[{"text":"Summarize the deployment checklist."}]}]}'
Our native request returned the following shortened response:
{ "candidates": [{ "content": {"role": "model", "parts": [{"text": "Demo answer from native Gemini fixture."}]}, "finishReason": "STOP", "index": 0 }], "usageMetadata": {"promptTokenCount": 12, "candidatesTokenCount": 6, "totalTokenCount": 18} }
The fixture supplied these counts; they are not measured model consumption. Changing the alias to bridge-assistant produced Gemini-shaped output while the fixture recorded a Chat Completions request with model: chat-demo. For streaming, use curl -N and the suffix :streamGenerateContent?alt=sse. Both streams completed with Gemini SSE frames. Omitting alt=sse returned 400 INVALID_ARGUMENT before the upstream, and an invalid gateway key returned 401 UNAUTHENTICATED; neither added an upstream request in this capture.
Check the actual upstream log during acceptance testing. An existing explicitly matching Gemini passthrough route takes precedence over this generation route. Its behavior must be evaluated as passthrough. In a routing plan, AISIX filters incompatible targets. A native target in the plan, or removal of an incompatible target, bypasses the chat response cache; a purely compatible Chat bridge plan can still use it where otherwise eligible.
A successful stream is also different from an interrupted one. After response headers, an upstream error can arrive in-band; a 200 header does not establish completed delivery. Gateway accounting can retain reported counts or estimate missing ones after partial delivery, and even a polled stream delivering no SSE events can retain or estimate prompt tokens. Inspect terminal logs and usage records rather than assuming a failed stream costs zero. Gateway records do not establish the provider's charge, budget-rollup timing or dashboard freshness.
Plan the Upgrade Beyond This Client Workflow
The release contains separate operational changes. They are not consequences of enabling Gemini generation:
- Cache and usage: changed Redis fingerprints cause warmup and temporarily higher upstream traffic. Mixed gateway versions treat missing and explicit-zero counts differently. Consumers of estimated usage events must accept
total_tokens: nullin JSON or an empty CSV cell; avoid counting reasoning twice when completion already includes it. - Routing and calendars: upgrade affected gateways to 1.12.0 before Gemini Decision routing. Upgrade control-plane replicas and affected gateways before enabling non-UTC budget calendars; incompatible supported gateways can make saves return
422 DP_INCOMPATIBLE. A rolled-back gateway without the classifier skips that router. Clients deserializing classifier types into a closed enum must acceptgemini_decision. - Historical reporting: semantic-routing attribution backfill is bounded by retained evidence and the applicable window; records outside it retain their attribution. Consumers must handle
backfill_in_progress, selected-target attribution, new CSV columns before the finalcurrencycolumn, and previously absent fields. Update queries and parse by headers. - Recovery: back up PostgreSQL before the control-plane upgrade; rollback requires restoring that backup. Older logical backups without the budget-history identifier can leave some restored usage uncounted. Import organization bundles only into a matching version and schema fingerprint.
- Path matching: Fun-ASR now takes precedence over path-only passthrough rules at
/api-ws/v1/inference; move an ordinary-HTTP rule or matchHostexplicitly. Upstreams matching raw paths must accept literal^forwarded as%5E. - Admin API writes: new or renamed rate-limit policies share an environment-wide, case-sensitive namespace. Keep an existing duplicate name unchanged or omit it on update; names are limited to 100 Unicode characters, including trailing spaces. Use a Chat Completions-capable model for chat targets rather than
gemini-decision-1, and disable its background check in the same update when required. Review the exact grandfathering and error contracts in the release notes.
Start with one alias and verify regular output, streaming termination and the selected upstream before expanding access. Use the AISIX OSS quickstart to prepare the gateway, then follow the 1.12.0 release notes for deployment-specific upgrade actions. AISIX can provide the gateway boundary; the chosen adapter, model and client still determine the application's supported behavior.


