Skip to content

🚀 [firebase_ai] Support Files API as an alternative to InlineDataPart #17615

Closed

Description

@ReplayAppTeam

Hello,

I've experienced a very strange issue:

When I ask Gemini to extract some information from a video file it takes way too long 20 - 25 seconds for videos which are 30 seconds max and take around 1-5 mb.

I was supplying the video file as bytes using InlineDataPart as described in the docs
https://firebase.google.com/docs/ai-logic/analyze-video?api=dev

It was unusual to me that it takes that long especially because the Gemini Android app gives way faster response.

Then I decided to try the REST API and what I noticed there is an alternative way of supplying files to Gemini and thats via Files API.

It is described here
https://ai.google.dev/gemini-api/docs/video-understanding#rest_1

Usage of the REST API resulted in 2x faster Gemini response.

I can't tell why exactly but the only noticeable difference I see is the way video file is supplied in the library and when working with REST so my guess is that's what made it faster.

Activity

  1. added
    platform: allIssues / PRs which are for all platforms.
    plugin: ailabel issues for firebase_ai plugin
    on Aug 11, 2025
  2. self-assigned this
    on Jun 8, 2026
  3. Lyokone commented on Jun 8, 2026

    @Lyokone
    Contributor

    Hi @ReplayAppTeam, thanks for the detailed comparison.

    The Gemini Developer API Files API is not currently exposed through Firebase AI Logic SDKs, so this is not something firebase_ai can just route through without backend/API support. In Firebase AI Logic, the supported alternative to InlineDataPart for larger or reusable media is to upload the file to Cloud Storage for Firebase and pass it as FileData.

    For Flutter, that looks like:

    final videoPart = FileData('video/mp4', 'gs://your-bucket/path/video.mp4');
    final response = await model.generateContent([
      Content.multi([
        videoPart,
        const TextPart('Extract the relevant information from this video.'),
      ]),
    ]);

    The Firebase docs cover this flow here: https://firebase.google.com/docs/ai-logic/solutions/cloud-storage

    I’m going to close this as an upstream Firebase AI Logic feature request rather than a FlutterFire bug. If Firebase AI Logic adds a Files API surface in the future, we can expose it in firebase_ai.

  4. locked and limited conversation to collaborators on Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Needs AttentionThis issue needs maintainer attention.platform: allIssues / PRs which are for all platforms.plugin: ailabel issues for firebase_ai plugintype: enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions