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

# Gemini SDK — generateContent (image) or predictLongRunning (video)



## OpenAPI

````yaml mountsea-api.mint.json POST /ms/v1beta/models/{splat}
openapi: 3.0.0
info:
  title: mountsea-api
  description: >-
    mountsea unified AI API — video, image, and audio generation.


    ### Async task flow

    1. `POST /ms/v1/run/{endpoint_slug}` — submit a job (returns Task with
    `status: queued`).

    2. `GET /ms/v1/tasks/{task_id}` — poll until `succeeded` (`output.images` /
    `output.videos` / `output.audio`) or `failed`/`timeout` (`error`).
       Or pass `webhook_url` in the submit body for a signed terminal callback (`x-ms-signature`).
    3. `GET /ms/v1/endpoints[/{slug}]` — marketplace listing with
    `input_schema`, `output_schema`, and `examples`.


    ### Request body

    - `{ "input": { ... } }` — all parameters and media URLs per endpoint
    `input_schema`.

    - Optional `webhook_url` for callbacks.


    ### SDK compatibility (optional)

    Prefer the native async API above? Skip this section.


    - **OpenAI SDK** — `baseURL = https://{gateway}/ms/v1`
      - Image (sync): `POST /ms/v1/images/generations|edits` — gpt-image-2 family
      - Video (async): `POST /ms/v1/videos` + `GET /ms/v1/videos/{id}` — sora-2 → Veo lite/pro slugs
    - **Gemini SDK** — `httpOptions.baseUrl = https://{gateway}/ms`
      - Image (sync): `POST /ms/v1beta/models/{model}:generateContent` — nano-banana family
      - Video (async): `POST /ms/v1beta/models/{model}:predictLongRunning` + poll `GET /ms/v1beta/operations/{task_id}`

    Unsupported `model` → **HTTP 400** before any task is created (no charge).

    Successful calls bill the **same endpoint slug** as the equivalent
    `/ms/v1/run/...` API.
  version: 1.0.0
  contact: {}
servers:
  - url: https://api.mountsea.ai
    description: API Gateway
security: []
tags:
  - name: Run
    description: Submit async tasks by endpoint slug
  - name: Tasks
    description: Poll or cancel tasks
  - name: Endpoints (marketplace)
    description: Endpoint catalog and schemas
  - name: SDK Compatibility
    description: >-
      OpenAI / Gemini official SDK — sync image APIs (same billing as native
      run)
  - name: Admin - Catalog (internal)
    description: Internal admin (swagger only, not public gateway)
paths:
  /ms/v1beta/models/{splat}:
    post:
      tags:
        - SDK Compatibility
      summary: Gemini SDK — generateContent (image) or predictLongRunning (video)
      description: >-
        Use the official **`@google/genai`** SDK with our API key and gateway
        base URL.


        ```ts

        import { GoogleGenAI } from '@google/genai';

        const ai = new GoogleGenAI({
          apiKey: 'ms-...',
          httpOptions: { baseUrl: 'https://{gateway}/ms' },
        });

        await ai.models.generateContent({
          model: 'gemini-2.5-flash-image',
          contents: [{ role: 'user', parts: [{ text: '...' }] }],
          config: { candidateCount: 1, imageConfig: { aspectRatio: '1:1' } },
        });

        ```


        **Supported model name patterns** (others → `400 Unsupported Gemini
        image model`):

        - `nano-banana`

        - `nano-banana-2`

        - `gemini-2.5-flash-image`

        - `gemini-3-*-image`

        - `nano-banana-pro`

        - `*-pro-image`


        Operation inferred from `contents`: text-only → text-to-image; with
        inline image → edit.


        **Billing**: same as native
        `/ms/v1/run/google/{nano-banana|nano-banana-2|nano-banana-pro}/{text-to-image|edit}`.


        ### Video (async operation)


        ```ts

        let op = await ai.models.generateVideos({
          model: 'veo-3.1-lite-generate-preview',
          prompt: 'A cat walking in the rain',
          config: { durationSeconds: 8, aspectRatio: '16:9' },
        });

        while (!op.done) {
          await new Promise((r) => setTimeout(r, 5000));
          op = await ai.operations.get({ operation: op });
        }

        const uri = op.response?.generatedVideos?.[0]?.video?.uri;

        ```


        **Supported Veo models**:

        - `veo-3.1-generate-preview`

        - `veo-3.1-fast-generate-preview`

        - `veo-3.1-lite-generate-preview`

        - `veo-3.0-generate-001`


        Maps to native `/ms/v1/run/google/veo-3.1/...` endpoints. Poll via `GET
        /ms/v1beta/operations/{task_id}`.
      operationId: geminiModelsPost
      parameters:
        - name: splat
          in: path
          required: true
          description: >-
            e.g. `gemini-2.5-flash-image:generateContent` or
            `veo-3.1-generate-preview:predictLongRunning`
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GeminiModelsPostRequest'
      responses:
        '200':
          $ref: '#/components/responses/MsGenericResponse'
        '400':
          $ref: '#/components/responses/BadRequestResponse'
        '501':
          $ref: '#/components/responses/NotImplementedResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    GeminiModelsPostRequest:
      type: object
      description: Gemini generateContent or predictLongRunning request body
      additionalProperties: true
    JsonObject:
      type: object
      additionalProperties: true
    ErrorBody:
      type: object
      properties:
        statusCode:
          type: integer
          example: 400
        message:
          type: string
        error:
          type: string
  responses:
    MsGenericResponse:
      description: Success
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/JsonObject'
    BadRequestResponse:
      description: Validation failed or unsupported model
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBody'
    NotImplementedResponse:
      description: Not implemented
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBody'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````