Skip to content

Recommendation for implementing quota checks during login and API calls for Gemini Image Generation and Veo in Google Cloud #864

@pwc-rm

Description

@pwc-rm

Hello,

I want to implement quota validation to ensure users or their groups/departments have sufficient quota before they can log in to use Gemini Image Generation or Veo.

The main requirements are:

  • Check quota at login and prevent login if there is insufficient quota, with an appropriate error message.
  • For logged-in users, check the remaining quota on every request to Gemini Image Generation or Veo APIs.
  • Route all such API calls through an API Gateway to centralize quota validation.
  • Store and check quota information in a database keyed by user or group/department.
  • Update quota usage atomically to avoid race conditions.

Given these requirements and the Google Cloud environment, what would be the recommended best practice for implementing such quota checks? Specifically:

  • Is it advisable to implement quota validation as a middleware/service behind the API Gateway?
  • Should quota checks be integrated within the API Gateway policies or handled separately?
  • Are there any recommended Google Cloud services or architectures to facilitate quota management and validation?

Any references to existing implementations or patterns would be greatly appreciated.
Thank you very much for your advice and guidance!

Best regards,
Raj

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is neededquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions