> ## Documentation Index
> Fetch the complete documentation index at: https://docs.opper.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate Content

> Google Gemini-compatible generateContent endpoint — the drop-in surface for SDKs calling `models.generate_content()`. The request body is the Gemini `GenerateContentRequest` shape (camelCase `contents` / `systemInstruction` / `generationConfig`); the response is `candidates[].content.parts[]` + `usageMetadata`. The `{model}` path segment accepts a bare Gemini id (e.g. `gemini-2.5-flash`, defaults to the Gemini-direct provider) or an Opper-canonical id (e.g. `vertexai/gemini-2.5-flash`).



## OpenAPI

````yaml post /v3/compat/v1beta/models/{model}:generateContent
openapi: 3.1.0
info:
  description: Schema-driven generative API that orchestrates LLM-powered workflows.
  title: Task API
  version: 3.0.0
servers:
  - description: Production
    url: https://api.opper.ai
  - description: Local development
    url: http://localhost:8080
security:
  - BearerAuth: []
tags:
  - description: Schema-driven function management and execution
    name: Functions
  - description: OpenAI-compatible chat completions
    name: Chat
  - description: OpenAI Responses API compatible endpoint
    name: Responses
  - description: Google-compatible interactions endpoint
    name: Interactions
  - description: Model registry and capabilities
    name: Models
  - description: Synchronous image generation
    name: Images
  - description: Text-to-speech and speech-to-text
    name: Audio
  - description: Asynchronous video generation
    name: Videos
  - description: Reusable file storage for media inputs and generated outputs
    name: Files
  - description: Async generation status and downloads
    name: Artifacts
  - description: OpenAI-compatible embeddings
    name: Embeddings
  - description: Recorded HTTP request/response generations
    name: Generations
  - description: System health and status
    name: System
  - description: Roundtable endpoint — fan out a query to multiple LLMs and combine results
    name: Roundtable
  - description: Web search, fetch, and other utility tools
    name: Tools
paths:
  /v3/compat/v1beta/models/{model}:generateContent:
    post:
      tags:
        - Compatibility
      summary: Generate Content API
      description: >-
        Google Gemini-compatible generateContent endpoint — the drop-in surface
        for SDKs calling `models.generate_content()`. The request body is the
        Gemini `GenerateContentRequest` shape (camelCase `contents` /
        `systemInstruction` / `generationConfig`); the response is
        `candidates[].content.parts[]` + `usageMetadata`. The `{model}` path
        segment accepts a bare Gemini id (e.g. `gemini-2.5-flash`, defaults to
        the Gemini-direct provider) or an Opper-canonical id (e.g.
        `vertexai/gemini-2.5-flash`).
      operationId: generateContent
      parameters:
        - description: >-
            Model id — a bare Gemini name (e.g. `gemini-2.5-flash`, resolved
            against the Gemini-direct provider) or an Opper-canonical id (e.g.
            `vertexai/gemini-2.5-flash`).
          in: path
          name: model
          required: true
          schema:
            type: string
        - description: >-
            Function name for tracing and project-level guardrail function-scope
            filtering.
          in: header
          name: X-Opper-Name
          schema:
            type: string
        - description: Parent span ID for distributed tracing context.
          in: header
          name: X-Opper-Parent-Span-Id
          schema:
            format: uuid
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InteractionsRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenerateContentResponse'
          description: Successful response
          headers:
            X-Opper-Cost:
              description: Execution cost of the request as a floating-point number.
              schema:
                format: double
                type: number
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Bad request
        '401':
          description: Unauthorized - missing or invalid API key
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal server error
components:
  schemas:
    InteractionsRequest:
      properties:
        agent:
          type: string
        background:
          type: boolean
        contents:
          description: Any value
        custom_model_credentials:
          properties:
            api_key:
              type: string
            base_url:
              type: string
            extra:
              type: object
            identifier:
              type: string
            url:
              type: string
          required:
            - identifier
            - api_key
          type: object
        generation_config:
          properties:
            max_output_tokens:
              type: integer
            response_mime_type:
              type: string
            response_schema:
              type: object
            seed:
              type: integer
            stop_sequences:
              items:
                type: string
              type: array
            temperature:
              type: number
            thinking_config:
              properties:
                include_thoughts:
                  type: boolean
                thinking_budget:
                  type: integer
                thinking_level:
                  type: string
              type: object
            thinking_level:
              type: string
            thinking_summaries:
              type: string
            tool_choice:
              description: Any value
            top_k:
              type: integer
            top_p:
              type: number
          type: object
        input:
          description: Any value
        model:
          type: string
        previous_interaction_id:
          type: string
        response_format:
          type: object
        response_mime_type:
          type: string
        safety_settings:
          items:
            properties:
              category:
                type: string
              threshold:
                type: string
            type: object
          type: array
        store:
          type: boolean
        stream:
          type: boolean
        system_instruction:
          properties:
            Text:
              type: string
          required:
            - Text
          type: object
        tool_config:
          properties:
            function_calling_config:
              properties:
                allowed_function_names:
                  items:
                    type: string
                  type: array
                mode:
                  type: string
              type: object
          type: object
        tools:
          items:
            properties:
              codeExecution:
                description: Any value
              code_execution:
                description: Any value
              description:
                type: string
              function_declarations:
                items:
                  properties:
                    description:
                      type: string
                    name:
                      type: string
                    parameters:
                      type: object
                  required:
                    - name
                  type: object
                type: array
              googleSearch:
                description: Any value
              googleSearchRetrieval:
                description: Any value
              google_search:
                description: Any value
              google_search_retrieval:
                description: Any value
              name:
                type: string
              parameters:
                type: object
              type:
                type: string
              urlContext:
                description: Any value
              url_context:
                description: Any value
            type: object
          type: array
      required:
        - input
        - contents
      type: object
    GenerateContentResponse:
      properties:
        candidates:
          items:
            properties:
              content:
                properties:
                  parts:
                    items:
                      properties:
                        codeExecutionResult:
                          type: object
                        executableCode:
                          type: object
                        functionCall:
                          type: object
                        inlineData:
                          type: object
                        text:
                          type: string
                        thought:
                          type: boolean
                        thoughtSignature:
                          type: string
                      type: object
                    type: array
                  role:
                    type: string
                required:
                  - parts
                type: object
              finishReason:
                type: string
              groundingMetadata:
                type: object
              index:
                type: integer
              urlContextMetadata:
                type: object
            required:
              - content
              - index
            type: object
          type: array
        modelVersion:
          type: string
        responseId:
          type: string
        usageMetadata:
          properties:
            cachedContentTokenCount:
              type: integer
            candidatesTokenCount:
              type: integer
            opper:
              type: object
            promptTokenCount:
              type: integer
            thoughtsTokenCount:
              type: integer
            totalTokenCount:
              type: integer
          type: object
      required:
        - candidates
      type: object
    ErrorResponse:
      properties:
        error:
          properties:
            code:
              type: string
            details:
              description: Any value
            message:
              type: string
          required:
            - code
            - message
          type: object
        meta:
          type: object
      required:
        - error
      type: object
  securitySchemes:
    BearerAuth:
      bearerFormat: API Key
      description: API key authentication. Pass your API key as a Bearer token.
      scheme: bearer
      type: http

````