feat(gemini): add service_tier support for Flex Inference#1002
Open
smittie2000 wants to merge 1 commit intoprism-php:mainfrom
Open
feat(gemini): add service_tier support for Flex Inference#1002smittie2000 wants to merge 1 commit intoprism-php:mainfrom
smittie2000 wants to merge 1 commit intoprism-php:mainfrom
Conversation
Add serviceTier provider option to Gemini Text, Stream, and Structured handlers, enabling Google's Flex Inference API. This provides 50% cost reduction for latency-tolerant workloads. Follows the same pattern as the existing OpenAI service_tier implementation. Passes service_tier at the top level of the Gemini REST request body. Ref: https://ai.google.dev/gemini-api/docs/flex-inference
eaae6b9 to
026bf90
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add
serviceTierprovider option to the Gemini provider's Text, Stream, and Structured handlers, enabling Google's Flex Inference API.Flex Inference provides 50% cost reduction for latency-tolerant workloads (batch processing, background summarization, etc.) by opting into Google's
flexservice tier.Usage
Implementation
service_tierimplementationservice_tierat the top level of the Gemini REST request body (not insidegenerationConfig)Arr::whereNotNull— whenserviceTieris not set, the key is omitted entirely (zero impact on existing requests)Gemini.phphandles 429 (PrismRateLimitedException) and 503 (PrismProviderOverloadedException)Provider option key naming
Uses
serviceTier(camelCase) to follow the Gemini provider's existing convention (thinkingConfig,thinkingBudget,cachedContentName,safetySettings).Related
service_tiersupport)Breaking Changes
None