Gemini Generation API

Generate content from prompts

Operations 2

POST /v1beta/models/{model}:generateContent Generate content #
POST /v1beta/models/{model}:streamGenerateContent Stream generated content #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/gemini-generation-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

gemini-generation-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Google Gemini Embeddings Generation API
  description: 'REST API for Google Gemini generative AI models. Supports text generation,

    chat, multimodal input, embeddings, file management, token counting,

    and batch operations. Authenticated with an API key from Google AI Studio.

    '
  version: v1beta
  contact:
    name: Gemini API Documentation
    url: https://ai.google.dev/api
servers:
- url: https://generativelanguage.googleapis.com
  description: Production
security:
- apiKeyQuery: []
- apiKeyHeader: []
tags:
- name: Generation
  description: Generate content from prompts
paths:
  /v1beta/models/{model}:generateContent:
    post:
      tags:
      - Generation
      summary: Generate content
      operationId: generateContent
      parameters:
      - $ref: '#/components/parameters/Model'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GenerateContentRequest'
      responses:
        '200':
          description: Generated content
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenerateContentResponse'
  /v1beta/models/{model}:streamGenerateContent:
    post:
      tags:
      - Generation
      summary: Stream generated content
      operationId: streamGenerateContent
      parameters:
      - $ref: '#/components/parameters/Model'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GenerateContentRequest'
      responses:
        '200':
          description: Streamed generated content
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenerateContentResponse'
components:
  schemas:
    SafetySetting:
      type: object
      properties:
        category:
          type: string
        threshold:
          type: string
    GenerationConfig:
      type: object
      properties:
        temperature:
          type: number
        topP:
          type: number
        topK:
          type: integer
        candidateCount:
          type: integer
        maxOutputTokens:
          type: integer
        stopSequences:
          type: array
          items:
            type: string
        responseMimeType:
          type: string
    Part:
      type: object
      properties:
        text:
          type: string
        inlineData:
          type: object
          properties:
            mimeType:
              type: string
            data:
              type: string
              format: byte
        fileData:
          type: object
          properties:
            mimeType:
              type: string
            fileUri:
              type: string
    GenerateContentRequest:
      type: object
      required:
      - contents
      properties:
        contents:
          type: array
          items:
            $ref: '#/components/schemas/Content'
        systemInstruction:
          $ref: '#/components/schemas/Content'
        generationConfig:
          $ref: '#/components/schemas/GenerationConfig'
        safetySettings:
          type: array
          items:
            $ref: '#/components/schemas/SafetySetting'
        tools:
          type: array
          items:
            type: object
    GenerateContentResponse:
      type: object
      properties:
        candidates:
          type: array
          items:
            $ref: '#/components/schemas/Candidate'
        usageMetadata:
          $ref: '#/components/schemas/UsageMetadata'
    Candidate:
      type: object
      properties:
        content:
          $ref: '#/components/schemas/Content'
        finishReason:
          type: string
        index:
          type: integer
        safetyRatings:
          type: array
          items:
            type: object
    UsageMetadata:
      type: object
      properties:
        promptTokenCount:
          type: integer
        candidatesTokenCount:
          type: integer
        totalTokenCount:
          type: integer
    Content:
      type: object
      properties:
        role:
          type: string
          enum:
          - user
          - model
          - system
        parts:
          type: array
          items:
            $ref: '#/components/schemas/Part'
  parameters:
    Model:
      name: model
      in: path
      required: true
      description: Model identifier (e.g. "gemini-1.5-pro")
      schema:
        type: string
  securitySchemes:
    apiKeyQuery:
      type: apiKey
      in: query
      name: key
      description: Gemini API key from Google AI Studio
    apiKeyHeader:
      type: apiKey
      in: header
      name: x-goog-api-key
      description: Gemini API key passed via header