You can proxy requests to Gemini AI models through AI Gateway by creating AI Model Provider and AI Model entities. This reference documents all supported AI capabilities, configuration requirements, and provider-specific details needed for proper integration.
AI Gateway supports both Gemini Standard and Gemini Enterprise. The following sections cover both variants together and note where their capabilities differ.
AI Gateway automatically routes requests to the appropriate Gemini API endpoints. The following table shows the upstream paths used for each capability.
The following tables show the AI capabilities supported by the Gemini provider when configuring AI Models.
By default, AI Gateway uses the path templates shown in the tables below (e.g., /chat/completions, /embeddings, etc.). To customize these paths, configure the config.paths field in your AI Model entity. Custom paths take the form {configured_path}/{template_path} — for example, if you set a custom path of /v2, requests to /embeddings would be routed to /v2/embeddings.
For requests with large payloads (video generation), consider increasing config.max_request_body_size on your AI Model entity to three times the raw binary size.
Support for Gemini’s bidirectional streaming for realtime applications:
Realtime processing uses WebSocket protocol (ws/wss). This protocol is automatically enabled when you configure your AI Model with the realtime capability.
Capability
Variant
Model example
Path template
Min version
realtime1
Gemini Standard only
gemini-2.5-flash-preview-native-audio
/realtime
2.0
1Gemini Standard: Realtime processing for Gemini is supported in the native format from SDK only
2Gemini Standard: Batches processing for Gemini is supported in the native format from SDK only
Batches are configured on a separate AI Model with type: "api", distinct from regular models that handle synchronous capabilities like generate and embeddings.
Create a dedicated AI Model exclusively for batches and files, as each model must be either a regular model or an API model, not both.
3Gemini Standard: Files processing for Gemini is supported in the native format from SDK only
4Gemini Enterprise: Gemini Enterprise does not have a dedicated Files API. File storage uses Google Cloud Storage, similar to AWS S3.
Batches are configured on a separate AI Model with type: "api", distinct from regular models that handle synchronous capabilities like generate and embeddings.
Create a dedicated AI Model exclusively for batches and files, as each model must be either a regular model or an API model, not both.## Gemini base URL
By default, AI Gateway routes Gemini requests to Gemini Standard at https://generativelanguage.googleapis.com.
Setting config.gcp_environment (with api_endpoint, location_id, and project_id) on the AI Model’s target. This switches routing to Gemini Enterprise at https://aiplatform.googleapis.com/.
AI Gateway uses the correct URL automatically based on this configuration. You only need to set upstream_url in your AI Model configuration if you’re using a self-hosted or Gemini-compatible endpoint instead.
Gemini Enterprise requires GCP credentials instead of an API key. The Provider only handles authentication; auth.type: gcp by itself doesn’t select Gemini Enterprise, since Gemini Standard can use the same GCP auth. What actually routes to Gemini Enterprise is config.gcp_environment on the AI Model’s target that attaches to this Provider (see Gemini base URL).
Create the Provider to store your GCP credentials:
targets[].config.gcp_environment requires api_endpoint, location_id, and project_id together. Without it, this same Provider would route to Gemini Standard instead.
Gemini Enterprise requires credentials from Google Cloud Platform (GCP). Gemini Standard can also use GCP credentials instead of an API key by setting auth to gcp.
The authentication chain follows the same order of precedence as the gcloud tool:
Service account JSON defined directly in the Provider: auth.service_account_json.
Service account JSON defined in environment variable GCP_SERVICE_ACCOUNT.
Workload IAM Role (for example, a GKE or Deployment Service Account).
VM Instance defined IAM Role.
For restricted networks, override the default endpoints with auth.metadata_url or auth.oauth_token_url.