{
  "openapi": "3.1.0",
  "info": {
    "title": "APIMaster Gemini Omni 1.2 Flash gateway API",
    "version": "2026-11-07",
    "description": "Gateway request/response contract for channel 335, not the native Google Interactions API. Examples are inert JSON using placeholder media/IDs. /v1/videos/quote is not supported for this model. Account usage logs, not task responses, are the final charge source."
  },
  "servers": [
    {
      "url": "https://apimaster.ai"
    }
  ],
  "security": [
    {
      "ApiKeyAuth": []
    }
  ],
  "paths": {
    "/v1/videos": {
      "post": {
        "operationId": "createOmni12Video",
        "summary": "Create one Omni 1.2 video with gateway replay protection",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[!-~]+$"
            },
            "description": "Gateway-only, per-account durable key. Identical requests replay a receipt; changed body/group/explicit routing returns 409. Keep the original key after timeout. No body-field equivalent."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateVideoRequest"
              },
              "examples": {
                "text_to_video": {
                  "value": {
                    "model": "gemini-omni-1.2-flash",
                    "prompt": "A blue glass sphere rolls slowly across a plain gray table.",
                    "duration": 3,
                    "resolution": "360p",
                    "aspect_ratio": "16:9"
                  }
                },
                "reference_images": {
                  "value": {
                    "model": "gemini-omni-1.2-flash",
                    "prompt": "Animate these geometric references while preserving their shapes and colors.",
                    "duration": 3,
                    "resolution": "360p",
                    "aspect_ratio": "16:9",
                    "image_urls": [
                      "https://example.com/reference-a.png",
                      "https://example.com/reference-b.png"
                    ],
                    "omni_reference_task_type": "reference"
                  }
                },
                "first_last_frames": {
                  "value": {
                    "model": "gemini-omni-1.2-flash",
                    "prompt": "Make a smooth transition from the first view to the last view.",
                    "duration": 3,
                    "resolution": "360p",
                    "aspect_ratio": "16:9",
                    "first_frame_image": "https://example.com/first.png",
                    "last_frame_image": "https://example.com/last.png"
                  }
                },
                "role_frames": {
                  "value": {
                    "model": "gemini-omni-1.2-flash",
                    "prompt": "A blue glass sphere rolls slowly across a plain gray table.",
                    "duration": 3,
                    "resolution": "360p",
                    "aspect_ratio": "16:9",
                    "image_with_roles": [
                      {
                        "url": "https://example.com/first.png",
                        "role": "first_frame"
                      },
                      {
                        "url": "https://example.com/last.png",
                        "role": "last_frame"
                      }
                    ]
                  }
                },
                "edit_video": {
                  "value": {
                    "model": "gemini-omni-1.2-flash",
                    "prompt": "Change the lighting to sunset while preserving the scene.",
                    "video_urls": [
                      "https://example.com/input.mp4"
                    ],
                    "resolution": "720p",
                    "omni_reference_task_type": "edit"
                  }
                },
                "extend_video": {
                  "value": {
                    "model": "gemini-omni-1.2-flash",
                    "prompt": "Continue the camera movement for three more seconds.",
                    "duration": 3,
                    "resolution": "360p",
                    "aspect_ratio": "16:9",
                    "video_urls": [
                      "https://example.com/input.mp4"
                    ],
                    "omni_reference_task_type": "extend"
                  }
                },
                "continue_public_task": {
                  "value": {
                    "model": "gemini-omni-1.2-flash",
                    "prompt": "Continue the previous scene with a gentle camera pan.",
                    "duration": 3,
                    "resolution": "360p",
                    "aspect_ratio": "16:9",
                    "extend_from_task_id": "task_YOUR_COMPLETED_TASK",
                    "omni_reference_task_type": "extend"
                  }
                },
                "edit_public_task": {
                  "value": {
                    "model": "gemini-omni-1.2-flash",
                    "prompt": "Keep the scene but turn the blue sphere yellow.",
                    "extend_from_task_id": "task_YOUR_COMPLETED_TASK",
                    "omni_reference_task_type": "edit",
                    "resolution": "720p"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Original submission accepted and local task persisted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VideoTask"
                }
              }
            }
          },
          "202": {
            "description": "Existing same-key receipt; no new generation or debit.",
            "headers": {
              "Idempotency-Replayed": {
                "schema": {
                  "type": "string",
                  "const": "true"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data"
                  ],
                  "properties": {
                    "code": {
                      "const": 202
                    },
                    "data": {
                      "$ref": "#/components/schemas/SubmissionReceipt"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Same account/key was used with a different request.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "description": "Authentication, validation, balance, route, storage or upstream error. A timeout/5xx does not prove non-acceptance. Recover using the original key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/v1/videos/generations": {
      "post": {
        "operationId": "createOmni12VideoAlias",
        "summary": "Create one Omni 1.2 video with gateway replay protection",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[!-~]+$"
            },
            "description": "Gateway-only, per-account durable key. Identical requests replay a receipt; changed body/group/explicit routing returns 409. Keep the original key after timeout. No body-field equivalent."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateVideoRequest"
              },
              "examples": {
                "text_to_video": {
                  "value": {
                    "model": "gemini-omni-1.2-flash",
                    "prompt": "A blue glass sphere rolls slowly across a plain gray table.",
                    "duration": 3,
                    "resolution": "360p",
                    "aspect_ratio": "16:9"
                  }
                },
                "reference_images": {
                  "value": {
                    "model": "gemini-omni-1.2-flash",
                    "prompt": "Animate these geometric references while preserving their shapes and colors.",
                    "duration": 3,
                    "resolution": "360p",
                    "aspect_ratio": "16:9",
                    "image_urls": [
                      "https://example.com/reference-a.png",
                      "https://example.com/reference-b.png"
                    ],
                    "omni_reference_task_type": "reference"
                  }
                },
                "first_last_frames": {
                  "value": {
                    "model": "gemini-omni-1.2-flash",
                    "prompt": "Make a smooth transition from the first view to the last view.",
                    "duration": 3,
                    "resolution": "360p",
                    "aspect_ratio": "16:9",
                    "first_frame_image": "https://example.com/first.png",
                    "last_frame_image": "https://example.com/last.png"
                  }
                },
                "role_frames": {
                  "value": {
                    "model": "gemini-omni-1.2-flash",
                    "prompt": "A blue glass sphere rolls slowly across a plain gray table.",
                    "duration": 3,
                    "resolution": "360p",
                    "aspect_ratio": "16:9",
                    "image_with_roles": [
                      {
                        "url": "https://example.com/first.png",
                        "role": "first_frame"
                      },
                      {
                        "url": "https://example.com/last.png",
                        "role": "last_frame"
                      }
                    ]
                  }
                },
                "edit_video": {
                  "value": {
                    "model": "gemini-omni-1.2-flash",
                    "prompt": "Change the lighting to sunset while preserving the scene.",
                    "video_urls": [
                      "https://example.com/input.mp4"
                    ],
                    "resolution": "720p",
                    "omni_reference_task_type": "edit"
                  }
                },
                "extend_video": {
                  "value": {
                    "model": "gemini-omni-1.2-flash",
                    "prompt": "Continue the camera movement for three more seconds.",
                    "duration": 3,
                    "resolution": "360p",
                    "aspect_ratio": "16:9",
                    "video_urls": [
                      "https://example.com/input.mp4"
                    ],
                    "omni_reference_task_type": "extend"
                  }
                },
                "continue_public_task": {
                  "value": {
                    "model": "gemini-omni-1.2-flash",
                    "prompt": "Continue the previous scene with a gentle camera pan.",
                    "duration": 3,
                    "resolution": "360p",
                    "aspect_ratio": "16:9",
                    "extend_from_task_id": "task_YOUR_COMPLETED_TASK",
                    "omni_reference_task_type": "extend"
                  }
                },
                "edit_public_task": {
                  "value": {
                    "model": "gemini-omni-1.2-flash",
                    "prompt": "Keep the scene but turn the blue sphere yellow.",
                    "extend_from_task_id": "task_YOUR_COMPLETED_TASK",
                    "omni_reference_task_type": "edit",
                    "resolution": "720p"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Original submission accepted and local task persisted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VideoTask"
                }
              }
            }
          },
          "202": {
            "description": "Existing same-key receipt; no new generation or debit.",
            "headers": {
              "Idempotency-Replayed": {
                "schema": {
                  "type": "string",
                  "const": "true"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data"
                  ],
                  "properties": {
                    "code": {
                      "const": 202
                    },
                    "data": {
                      "$ref": "#/components/schemas/SubmissionReceipt"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Same account/key was used with a different request.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "description": "Authentication, validation, balance, route, storage or upstream error. A timeout/5xx does not prove non-acceptance. Recover using the original key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/v1/videos/{task_id}": {
      "get": {
        "operationId": "getOmni12Video",
        "parameters": [
          {
            "name": "task_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current task state; not a billing receipt.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VideoTask"
                }
              }
            }
          },
          "default": {
            "description": "Authentication, validation, balance, route, storage or upstream error. A timeout/5xx does not prove non-acceptance. Recover using the original key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/v1/videos/{task_id}/content": {
      "get": {
        "operationId": "downloadOmni12Video",
        "parameters": [
          {
            "name": "task_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Authenticated video download.",
            "content": {
              "video/mp4": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "default": {
            "description": "Authentication, validation, balance, route, storage or upstream error. A timeout/5xx does not prove non-acceptance. Recover using the original key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/v1/video-submissions/by-key": {
      "get": {
        "operationId": "getOmni12SubmissionByKey",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[!-~]+$"
            },
            "description": "Gateway-only, per-account durable key. Identical requests replay a receipt; changed body/group/explicit routing returns 409. Keep the original key after timeout. No body-field equivalent."
          }
        ],
        "responses": {
          "200": {
            "description": "Read-only receipt lookup for this account and key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "const": 200
                    },
                    "data": {
                      "$ref": "#/components/schemas/SubmissionReceipt"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "No receipt visible; not proof that an original request was not accepted. retry_safe=false.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "description": "Authentication, validation, balance, route, storage or upstream error. A timeout/5xx does not prove non-acceptance. Recover using the original key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/log/token": {
      "get": {
        "operationId": "getRecentApiKeyUsageLogs",
        "description": "Recent, bounded usage logs for the API key. Parse the other JSON string; match other.task_id. This is not a paginated invoice/archival export.",
        "responses": {
          "200": {
            "description": "Key-scoped recent ledger rows. Final successful task charge is other.final_amount_usd after settlement, when available.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "integer"
                          },
                          "quota": {
                            "type": "integer"
                          },
                          "model_name": {
                            "type": "string"
                          },
                          "prompt_tokens": {
                            "type": "integer"
                          },
                          "completion_tokens": {
                            "type": "integer"
                          },
                          "other": {
                            "type": "string",
                            "description": "JSON-encoded metadata, including task_id and final_amount_usd when finalized. Usage component fields may be absent when the supplier supplied only a cost receipt."
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Authentication, validation, balance, route, storage or upstream error. A timeout/5xx does not prove non-acceptance. Recover using the original key.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "APIMaster API key"
      }
    },
    "schemas": {
      "CreateVideoRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "model",
          "prompt"
        ],
        "properties": {
          "model": {
            "type": "string",
            "const": "gemini-omni-1.2-flash"
          },
          "prompt": {
            "type": "string",
            "minLength": 1,
            "pattern": "\\S",
            "description": "Required for every operation, including parent-task continuation."
          },
          "duration": {
            "type": "integer",
            "minimum": 3,
            "maximum": 15,
            "default": 10,
            "description": "Output seconds; 3–10 for interpolation or extension (new segment). Ignored for editing."
          },
          "seconds": {
            "oneOf": [
              {
                "type": "integer",
                "minimum": 3,
                "maximum": 15
              },
              {
                "type": "string",
                "pattern": "^(?:[3-9]|1[0-5])$"
              }
            ],
            "description": "Compatibility alias; send duration only in new clients. If both exist duration takes precedence."
          },
          "resolution": {
            "type": "string",
            "enum": [
              "360p",
              "720p",
              "1080p",
              "4k",
              "2160p",
              "360P",
              "720P",
              "1080P",
              "4K",
              "2160P"
            ],
            "default": "720p",
            "description": "Case-insensitive. 2160p normalizes to 4k; 1080p/4k are upsampled."
          },
          "aspect_ratio": {
            "type": "string",
            "enum": [
              "16:9",
              "9:16"
            ],
            "default": "16:9",
            "description": "Other string values currently normalize to 16:9. Send only the supported values."
          },
          "ratio": {
            "type": "string",
            "description": "Legacy aspect_ratio alias. Use aspect_ratio in new clients."
          },
          "size": {
            "type": "string",
            "description": "Legacy aspect_ratio alias, not a resolution field."
          },
          "image_urls": {
            "type": "array",
            "maxItems": 10,
            "items": {
              "type": "string",
              "format": "uri",
              "pattern": "^https?://",
              "description": "Publicly reachable HTTP(S) direct media URL, not Base64 or a data URL."
            }
          },
          "first_frame_image": {
            "type": "string",
            "format": "uri",
            "pattern": "^https?://",
            "description": "Publicly reachable HTTP(S) direct media URL, not Base64 or a data URL."
          },
          "last_frame_image": {
            "type": "string",
            "format": "uri",
            "pattern": "^https?://",
            "description": "Publicly reachable HTTP(S) direct media URL, not Base64 or a data URL."
          },
          "image_with_roles": {
            "type": "array",
            "maxItems": 10,
            "items": {
              "type": "object",
              "required": [
                "url",
                "role"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "format": "uri",
                  "pattern": "^https?://",
                  "description": "Publicly reachable HTTP(S) direct media URL, not Base64 or a data URL."
                },
                "role": {
                  "type": "string",
                  "minLength": 1,
                  "description": "first_frame or last_frame; other nonempty roles are reference images."
                }
              }
            }
          },
          "video_urls": {
            "type": "array",
            "maxItems": 1,
            "items": {
              "type": "string",
              "format": "uri",
              "pattern": "^https?://",
              "description": "Publicly reachable HTTP(S) direct media URL, not Base64 or a data URL."
            },
            "description": "At most one input video, no more than 15 seconds. MP4/MOV-compatible duration probing; at most 100 MiB is downloaded for the gateway probe. Supplier decoding and media restrictions also apply."
          },
          "omni_reference_task_type": {
            "type": "string",
            "enum": [
              "auto",
              "edit",
              "extend",
              "reference",
              "text_to_video",
              "image_to_video",
              "reference_to_video"
            ],
            "default": "auto",
            "description": "A video or parent task defaults to edit. Extension requires explicit extend."
          },
          "extend_from_task_id": {
            "type": "string",
            "minLength": 1,
            "description": "Your completed APIMaster public task ID for this model, not a Google interaction ID. Owned by the current account; original route/account must remain available; excludes video_urls."
          }
        },
        "description": "Total images across all three image forms must not exceed 10. Last-frame role requires a first-frame role. Runtime media/ownership validation applies. JSON only; no audio input, metadata, Google interaction state or generation_type.",
        "allOf": [
          {
            "not": {
              "required": [
                "extend_from_task_id",
                "video_urls"
              ]
            }
          },
          {
            "not": {
              "required": [
                "image_with_roles",
                "first_frame_image"
              ]
            }
          },
          {
            "not": {
              "required": [
                "image_with_roles",
                "last_frame_image"
              ]
            }
          },
          {
            "if": {
              "required": [
                "last_frame_image"
              ]
            },
            "then": {
              "required": [
                "first_frame_image"
              ],
              "properties": {
                "duration": {
                  "maximum": 10
                }
              }
            }
          },
          {
            "if": {
              "required": [
                "omni_reference_task_type"
              ],
              "properties": {
                "omni_reference_task_type": {
                  "const": "extend"
                }
              }
            },
            "then": {
              "anyOf": [
                {
                  "required": [
                    "video_urls"
                  ],
                  "properties": {
                    "video_urls": {
                      "minItems": 1
                    }
                  }
                },
                {
                  "required": [
                    "extend_from_task_id"
                  ]
                }
              ],
              "properties": {
                "duration": {
                  "maximum": 10
                }
              }
            }
          }
        ]
      },
      "VideoTask": {
        "type": "object",
        "required": [
          "id",
          "task_id",
          "object",
          "model",
          "status"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "task_id": {
            "type": "string"
          },
          "object": {
            "const": "video"
          },
          "model": {
            "const": "gemini-omni-1.2-flash"
          },
          "status": {
            "enum": [
              "queued",
              "in_progress",
              "completed",
              "failed",
              "unknown"
            ]
          },
          "progress": {
            "type": "number",
            "minimum": 0,
            "maximum": 100
          },
          "created_at": {
            "type": "integer"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "metadata": {
            "type": "object",
            "properties": {
              "url": {
                "type": "string",
                "format": "uri"
              }
            }
          },
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "const": "generation_failed"
              },
              "message": {
                "type": "string"
              }
            }
          }
        },
        "description": "Task status and result only. No guaranteed usage, modality counts or USD billing fields. Authenticate result downloads."
      },
      "SubmissionReceipt": {
        "type": "object",
        "required": [
          "submission_id",
          "task_id",
          "model",
          "status",
          "task_ready",
          "same_key_replay_safe",
          "new_submission_safe"
        ],
        "properties": {
          "submission_id": {
            "type": "string"
          },
          "task_id": {
            "type": "string"
          },
          "model": {
            "const": "gemini-omni-1.2-flash"
          },
          "status": {
            "enum": [
              "pending",
              "submitting",
              "accepted",
              "not_accepted",
              "acceptance_unknown"
            ]
          },
          "task_ready": {
            "type": "boolean"
          },
          "request_id": {
            "type": "string"
          },
          "next_action": {
            "type": "string"
          },
          "same_key_replay_safe": {
            "type": "boolean"
          },
          "new_submission_safe": {
            "type": "boolean"
          },
          "recovery": {
            "type": "object"
          },
          "error": {
            "type": [
              "object",
              "null"
            ]
          },
          "retention": {
            "type": "string"
          }
        },
        "additionalProperties": true,
        "description": "Gateway receipt. accepted plus task_ready=true permits task polling. Unknown acceptance never authorizes automatic resubmission. No provider by-key discovery is promised."
      }
    }
  }
}
