Payload size limit

Hi Team,

I have a question related how big the payload can be while sending to the Gemini 2.0 0r 2.5 flash models. Documentation says we can send only 20mb as payload . but when i tried a 100mb video file through api by passing it as base 64 string it worked without any complaints or errors, so want to understand if the documentation is wrong or is there something missing ? Please clarify.

Hi bp117,

Welcome to Google Developer Program Forums!

Your successful 100MB video upload as a Base64 string likely worked because the specific API endpoint or client library you used might have some undocumented leniency or a graceful handling mechanism for larger inline payloads. More importantly, the total token count of your video, calculated based on its duration, fits within the impressive 1 million token context window of the Gemini 2.0 and 2.5 Flash model.

However, relying on this behavior is not advisable. For files smaller than 20MB (taking into account the size increase from base64 encoding), inline data can be a convenient option. The official and documented path for files exceeding the 20MB inline request limit is to use the File API. This ensures your application is robust, scalable, and aligned with Google’s recommended best practices.

Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.