Thursday, November 20, 2025

Google Gemini AI - OpenAPI Specification File

Make sure that you copy paste below code in a file with extension as .yaml. 
#google #gemini #openapi


   


openapi: 3.0.3
info:
  title: Gemini AI API
  description: |
    The Gemini API allows developers to build generative AI applications using Gemini models.
    Gemini is multimodal and can understand text, images, audio, video, and code.
  version: v1beta
  contact:
    name: Google AI
    url: https://ai.google.dev
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0

servers:
  - url: https://generativelanguage.googleapis.com/v1beta
    description: Gemini API Production Server

security:
  - ApiKeyQuery: []
  - ApiKeyHeader: []

tags:
  - name: Models
    description: Operations for listing and retrieving model information
  - name: Content Generation
    description: Generate content using Gemini models
  - name: Embeddings
    description: Generate text embeddings
  - name: Token Counting
    description: Count tokens in prompts

paths:
  /models:
    get:
      tags: [Models]
      operationId: listModels
      summary: List available models
      description: Lists the Gemini models available through the API
      parameters:
        - $ref: '#/components/parameters/PageSize'
        - $ref: '#/components/parameters/PageToken'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListModelsResponse'

  /models/{model}:
    get:
      tags: [Models]
      operationId: getModel
      summary: Get model information
      description: Gets information about a specific model
      parameters:
        - name: model
          in: path
          required: true
          schema:
            type: string
          example: gemini-1.5-pro
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Model'

  /models/{model}:generateContent:
    post:
      tags: [Content Generation]
      operationId: generateContent
      summary: Generate content
      description: Generates a model response given an input GenerateContentRequest
      parameters:
        - name: model
          in: path
          required: true
          schema:
            type: string
          description: 'Model name (e.g., models/gemini-1.5-pro)'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GenerateContentRequest'
            examples:
              simpleText:
                summary: Simple text generation
                value:
                  contents:
                    - role: user
                      parts:
                        - text: "Explain quantum computing in simple terms"
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenerateContentResponse'

  /models/{model}:streamGenerateContent:
    post:
      tags: [Content Generation]
      operationId: streamGenerateContent
      summary: Stream generate content
      description: Generates a streamed response from the model
      parameters:
        - name: model
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GenerateContentRequest'
      responses:
        '200':
          description: Successful response (server-sent events)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenerateContentResponse'

  /models/{model}:countTokens:
    post:
      tags: [Token Counting]
      operationId: countTokens
      summary: Count tokens
      description: Counts the number of tokens in a prompt
      parameters:
        - name: model
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CountTokensRequest'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CountTokensResponse'

  /models/{model}:embedContent:
    post:
      tags: [Embeddings]
      operationId: embedContent
      summary: Generate embedding
      description: Generates a text embedding vector from the input content
      parameters:
        - name: model
          in: path
          required: true
          schema:
            type: string
          description: 'Model name (e.g., models/text-embedding-004)'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EmbedContentRequest'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EmbedContentResponse'

  /models/{model}:batchEmbedContents:
    post:
      tags: [Embeddings]
      operationId: batchEmbedContents
      summary: Batch generate embeddings
      description: Generates multiple embedding vectors from a batch of inputs
      parameters:
        - name: model
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BatchEmbedContentsRequest'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BatchEmbedContentsResponse'

components:
  securitySchemes:
    ApiKeyQuery:
      type: apiKey
      in: query
      name: key
      description: API key for authentication
    ApiKeyHeader:
      type: apiKey
      in: header
      name: x-goog-api-key
      description: API key for authentication (preferred)

  parameters:
    PageSize:
      name: pageSize
      in: query
      schema:
        type: integer
        maximum: 1000
      description: Maximum number of results to return
    
    PageToken:
      name: pageToken
      in: query
      schema:
        type: string
      description: Token for pagination

  schemas:
    Model:
      type: object
      properties:
        name:
          type: string
          description: 'Model resource name (e.g., models/gemini-1.5-pro)'
        displayName:
          type: string
        description:
          type: string
        inputTokenLimit:
          type: integer
          format: int32
        outputTokenLimit:
          type: integer
          format: int32
        supportedGenerationMethods:
          type: array
          items:
            type: string
          example: ["generateContent", "countTokens"]

    ListModelsResponse:
      type: object
      properties:
        models:
          type: array
          items:
            $ref: '#/components/schemas/Model'
        nextPageToken:
          type: string

    GenerateContentRequest:
      type: object
      required:
        - contents
      properties:
        contents:
          type: array
          items:
            $ref: '#/components/schemas/Content'
          description: The content of the conversation with the model
        systemInstruction:
          $ref: '#/components/schemas/Content'
          description: Developer set system instructions
        generationConfig:
          $ref: '#/components/schemas/GenerationConfig'
        safetySettings:
          type: array
          items:
            $ref: '#/components/schemas/SafetySetting'

    GenerateContentResponse:
      type: object
      properties:
        candidates:
          type: array
          items:
            $ref: '#/components/schemas/Candidate'
        usageMetadata:
          $ref: '#/components/schemas/UsageMetadata'

    Content:
      type: object
      properties:
        role:
          type: string
          enum: [user, model]
          description: The producer of the content
        parts:
          type: array
          items:
            $ref: '#/components/schemas/Part'

    Part:
      type: object
      description: A part of multi-part content
      properties:
        text:
          type: string
          description: Inline text content
        inlineData:
          $ref: '#/components/schemas/Blob'
        fileData:
          $ref: '#/components/schemas/FileData'

    Blob:
      type: object
      required:
        - mimeType
        - data
      properties:
        mimeType:
          type: string
          example: "image/jpeg"
        data:
          type: string
          format: byte
          description: Base64 encoded data

    FileData:
      type: object
      required:
        - fileUri
      properties:
        mimeType:
          type: string
        fileUri:
          type: string
          description: URI of the file

    Candidate:
      type: object
      properties:
        content:
          $ref: '#/components/schemas/Content'
        finishReason:
          type: string
          enum: [STOP, MAX_TOKENS, SAFETY, RECITATION, OTHER]
        safetyRatings:
          type: array
          items:
            $ref: '#/components/schemas/SafetyRating'

    GenerationConfig:
      type: object
      properties:
        temperature:
          type: number
          format: float
          minimum: 0
          maximum: 2
          description: Controls randomness
        topP:
          type: number
          format: float
        topK:
          type: integer
          format: int32
        maxOutputTokens:
          type: integer
          format: int32
        stopSequences:
          type: array
          items:
            type: string

    SafetySetting:
      type: object
      required:
        - category
        - threshold
      properties:
        category:
          type: string
          enum:
            - HARM_CATEGORY_HARASSMENT
            - HARM_CATEGORY_HATE_SPEECH
            - HARM_CATEGORY_SEXUALLY_EXPLICIT
            - HARM_CATEGORY_DANGEROUS_CONTENT
        threshold:
          type: string
          enum:
            - BLOCK_NONE
            - BLOCK_ONLY_HIGH
            - BLOCK_MEDIUM_AND_ABOVE
            - BLOCK_LOW_AND_ABOVE

    SafetyRating:
      type: object
      properties:
        category:
          type: string
        probability:
          type: string
          enum: [NEGLIGIBLE, LOW, MEDIUM, HIGH]

    UsageMetadata:
      type: object
      properties:
        promptTokenCount:
          type: integer
        candidatesTokenCount:
          type: integer
        totalTokenCount:
          type: integer

    CountTokensRequest:
      type: object
      properties:
        contents:
          type: array
          items:
            $ref: '#/components/schemas/Content'

    CountTokensResponse:
      type: object
      properties:
        totalTokens:
          type: integer

    EmbedContentRequest:
      type: object
      required:
        - content
      properties:
        content:
          $ref: '#/components/schemas/Content'
        taskType:
          type: string
          enum:
            - RETRIEVAL_QUERY
            - RETRIEVAL_DOCUMENT
            - SEMANTIC_SIMILARITY
            - CLASSIFICATION
            - CLUSTERING

    EmbedContentResponse:
      type: object
      properties:
        embedding:
          $ref: '#/components/schemas/ContentEmbedding'

    ContentEmbedding:
      type: object
      properties:
        values:
          type: array
          items:
            type: number
            format: float

    BatchEmbedContentsRequest:
      type: object
      required:
        - requests
      properties:
        requests:
          type: array
          items:
            $ref: '#/components/schemas/EmbedContentRequest'

    BatchEmbedContentsResponse:
      type: object
      properties:
        embeddings:
          type: array
          items:
            $ref: '#/components/schemas/ContentEmbedding'


Wednesday, October 22, 2025

Azure App Service vs Azure Kubernetes (AKS) | The Practical Comparison

App service vs AKS. I will give you few advantages of using App service over AKS. I specifically got inputs on my linkedin asking for choices which makes it easy for adoption of app service against AKS. So will be covering imp points related to app services which makes them easy to adopt. 

Comparison done  on - 

1. Scale

2. Networking

3. Ease of operations

4. Ease of deployment and configurations

5. Multi cloud portability

5.and Real world queries 




#AzureBeyondDemos #Azure #AzureAppService #AzureAKS #AzureKubernetesService

#MicrosoftAzure #CloudComputing #Kubernetes #AppService #AzureContainers

#AKSvsAppService #AzureComparison #Microsoft #MicrosoftAzure #Msftadvocate 

Saturday, August 9, 2025

Azure Container Apps Networking Deep Dive | VNET, Ingress & Private Access Scenarios

 In this video I have addressed - Azure Container Apps “Real World” Networking Scenarios - 


  1. Content-web UI Application accessible over internet, content-api accessible only inside container app environment.
  2. Content-web UI Application accessible over private network only (from other VNETs), content-api accessible only inside container app environment.
  3. Content-web UI Application accessible over private network only (from other VNETs), content-api accessible outside of container app environment, and over private network (from other VNETs).
  4. Content-web UI Application accessible over internet, content-api accessible outside of container app environment, and over private network (from other VNETs).
  5. Content-web UI and Content-api both accessible over internet.

#AzureBeyondDemos #AzureContainerApps #AzureNetworking #AzureVNET #AzureIngress
#AzurePaaS #AzureCloud #AzureDeepDive







If you receive below error - 

Failed to provision IP address: Subscription is not registered for feature Microsoft.Network/AllowBringYourOwnPublicIpAddress required to carry out the requested operation

Solution run below command  in azure cli on portal - 
az feature register --name AllowBringYourOwnPublicIpAddress --namespace Microsoft.Network



Monday, July 14, 2025

How to Make Azure API Management Inbound Public IP Static (No More IP Surprises!)

Recently one of my customer had to go through painful journey of API Management inbound public IP change. This public IP was whitelisted to all client apps, external WAF services, xternal partner application and so on. This overall change of whitelisting of public IP was required at 350+ locations. While the best way is to use domain whitelisting not all firewalls or devices support domain based whitelisting. Or some org still work on public ip whitelisting only. In this scenarios, keeping api management public IP static becomes extremely important. 

I am going to show you the way of azure api management provisioning by which you can always get the static public IP address for inbound traffic. 


In this video I will talk about – 

- Which network option should be used for API Management provisioning

- How you can attach public IP of your choice to Azure api management. 

#AzureBeyondDemos #AzureAPIManagement #StaticIP #AzureAPIM #AzureTips #APISecurity #AzureNetworking #PublicIP #CloudSecurity #AzureBestPractices #AzureVNET #VirtualNetwork





Monday, June 23, 2025

Export Azure Resources to Excel or CSV in Seconds | Azure Portal (No Code)

 In this vide we will talk about below features – 

  1. Export to CSV azure resources
  2. Customize default Virtual Machines view and then export to CSV
  3. Customize default IP address, NSF, UDR view and then export to CSV
  4. Create your own view with app services and export to CSV






Sunday, June 8, 2025

Never Miss a Secret or key Expiry! Azure Key Vault Secret and Key Expiration Alerts Demo (No Code)

Manually tracking Key Vault secret or key expiration dates? That’s outdated.

In my latest YouTube video, I walk you through a No-Code solution using Azure Logic Apps to set up automated email alerts for Azure Key Vault secret and key expiration — all powered by Event Grid.

📌 Use this in real-world production to improve your cloud security posture and automate compliance and governance.

✅ What you'll learn:

  • How Azure Key Vault emits expiration events

  • How to handle SubscriptionValidationEvent correctly

  • Setting up Logic Apps to send email alerts — with zero code

  • Limitations of near-expiry events and custom alert workarounds

🔍 Perfect for:
Cloud engineers | Azure architects | DevOps teams | Security admins

Let’s simplify cloud automation — the secure way! 💡
👇 Let me know how you handle secret expiry today.





Sunday, May 4, 2025

Azure CAF vs Azure Well-Architected Framework (WAF) | Which One Do You Need First?

In this video I spoke about #Azure Cloud Adoption Framework (CAF) and Well Architected Framework (WAF) differences. 

I have answered few real world questions about CAF and WAF like - 

  1. Which one should be use in what context?
  2. Is CAF designed only for large enterprises?
  3. Is CAF provide high level guidance and it is not technical guidance?
  4. Is CAF mainly about documentation and should be done in linear way?
  5. Is CAF useful only for “green field” or new projects?
  6. CAF enterprise scale guidance is too much complex for me. What should I do?
  7. Is WAF intended only for certain workloads?
  8. Is WAF to be used only after deployment of application on azure?
  9. From CAF ESLZ blueprints/ templates/ arm scripts/ bicep scripts I want to use only firewall deployment, can I do that?
  10. From CAF ESLZ deployment I don’t want to create so many subscriptions for identity, networking and so on. Is it ok?
  11. Can I evaluate my application architecture for WAF pillars even before deployment of my azure resources and application? 

Please let me know if you have any feedback. Thanks. 









Sunday, April 13, 2025

Azure API Management Logger Setup for Event Hub | REST API Walkthrough

In this video I will talk about – 

  1. Why to log api management traffic to event hub? Benefits of it.
  2. I will explain it with the help of real world Use cases
  3. Setup logger in api management using rest api.

#azure #apimanagement #apigateway #AzureBeyondDemos

Request Body Sample - 

{

  "properties": {

"loggerType": "azureEventHub",

        "description": "adding a new logger",

         "credentials": {

             "endpointAddress":"YourEHNamespace.servicebus.windows.net",

             "identityClientId":"SystemAssigned",

             "name":"YourEventHub"   

          }

   }

}

For below error solution is discussed in the video - 

{

  "error": {

    "code": "NoRegisteredProviderFound",

    "message": "No registered resource provider found for location 'southindia' and API version 'SupportedVersion' for type 'service'. The supported api-versions are '2014-02-14, 2015-09-15, 2016-07-07, 2016-10-10, 2017-03-01, 2018-01-01, 2018-06-01-preview, 2019-01-01, 2019-12-01-preview, 2019-12-01, 2020-06-01-preview, 2020-12-01, 2021-01-01-preview, 2021-04-01-preview, 2021-08-01, 2021-12-01-preview, 2022-04-01-preview, 2022-08-01, 2022-09-01-preview, 2023-03-01-preview, 2023-05-01-preview, 2023-09-01-preview, 2024-05-01, 2024-06-01-preview'. The supported locations are 'centralindia, uaenorth, australiacentral, germanywestcentral, westcentralus, norwayeast, switzerlandnorth, koreasouth, westindia, koreacentral, southafricanorth, ukwest, brazilsouth, eastasia, southindia, canadacentral, canadaeast, australiasoutheast, japaneast, northcentralus, southeastasia, westus2, centralus, uksouth, australiaeast, japanwest, westus, francecentral, southcentralus, eastus2, eastus, northeurope, westeurope, westus3, jioindiacentral, jioindiawest, swedencentral, qatarcentral, polandcentral, italynorth, spaincentral, mexicocentral, israelcentral, newzealandnorth'."

  }

}


Sunday, April 6, 2025

Upgrading Azure Basic Public IP address to Standard sku - part 2

 In this video I will try to answer few important and crucial queries I received on LinkedIn, youTube video comments and so on.


  1. Can I upgrade the ip addresses attached to a VM NIC one by one?
  2. Can I create new NIC, disassociate all existing basic public ips from old nic, perform the upgrade to standard and then attach to new NIC?
  3. Can I disassociate all existing basic public ips from current nic, perform the upgrade to standard and then attach to same existing NIC?
  4. What if I have my public IP basic, static and not attached to anything, can I upgrade?
  5. Does this upgrade involve downtime? If yes, how much? Or how can I calculate?
  6. Is there a way to rollback upgrade in case of failure?
  7. Whom I should involve during the activity?
#azure #azurevm #publicIP





Thursday, March 27, 2025

Upgrading a basic public IP address to standard sku - part 1

 Azure Basic SKU Public IP is retiring on Sep 2025. 

In this video I will talk about – 

1. Why to upgrade basic public Ips to standard, what is the need?

2. Important information about basic IP retirement

3. Understand scenarios in which you will need an upgrade from basic to standard

4. I will demo about Azure VM having NIC with multiple basic public IP upgrade

5. I will also demo about VMs in Av set and are having basic sku public IP then how do you upgrade them.

6. Then we will close. Rest of the upgrade scenarios I will cover in next part of this. 


Feel free to reach out in case of any questions.