AI for developers
Files API Limits and Retention: OpenAI vs Claude vs Gemini
In short
OpenAI's Files API takes 512 MB per file (8 GB through its Uploads API) and 2.5 TB per project, and keeps files until deleted, except batch files at 30 days. Claude takes 500 MB per file and 1 TB per organization, kept until deletion or an optional expiry of up to 90 days. Gemini allows 2 GB per file and 20 GB per project, and deletes uploads after 48 hours.
How large can a file be, and how much can you keep?
These are API limits, not chat-app limits. The storage pool sits at a different level on each: a project on OpenAI and Gemini, the whole organization on Claude.
A stored file can still be too big for one request. OpenAI's file-inputs guide wants each input file under 50 MB, and 50 MB combined per request. Claude returns a 400 when a file is larger than the context window, and a 413 for a file over 500 MB. Gemini works the other way round: once a whole request passes 100 MB, or 50 MB for a PDF, its guide says to switch to the Files API.
| Limit | OpenAI | Claude | Gemini API |
|---|---|---|---|
| Largest file | 512 MB; up to 8 GB through the Uploads API, which creates a regular File object | 500 MB | 2 GB |
| Total storage | 2.5 TB per project; no organization-wide limit | 1 TB per organization | 20 GB per project |
| Request rate for file calls | 1,000 uploads per minute per authenticated user | About 500 file-related requests per minute | Not stated on the pages I read |
Checked against: source 1, source 3, source 4, source 5, source 9
How long does an uploaded file stay available?
OpenAI keeps a file until you delete it, with one default exception: files uploaded with purpose batch expire after 30 days. Any upload can carry an expires_after policy anchored at created_at, from 3,600 seconds (1 hour) to 2,592,000 seconds (30 days). The file object then reports expires_at as a Unix time, which a Unix timestamp converter turns into a date.
Claude also keeps files until deletion unless you set expires_in_seconds at upload, between 3,600 and 7,776,000 seconds (90 days). That value cannot be changed later. Once it passes, a content download returns 404, a Messages request naming the file fails before inference, and the metadata stays readable, and listed, for up to 30 days.
Gemini offers no keep-until-deleted option on the pages I read. Every upload is deleted automatically after 48 hours, and the file's expirationTime field shows when; a file reused over several days has to be uploaded again unless it is registered from Cloud Storage, as the last section shows.
Checked against: source 1, source 4, source 5, source 6, source 7
Which requests can reference an uploaded file?
On OpenAI, the purpose chosen at upload says where a file is meant to go: assistants, batch, fine-tune, vision, user_data or evals, with user_data advised for model inputs. The Responses API accepts a file_id for every supported type as an input_file item; Chat Completions accepts one only for PDFs. Batch input files have their own rules, compared in the Batch API post.
Claude's Messages API takes a file_id in three blocks: document for PDF and plain text, image for JPEG, PNG, GIF and WebP, and container_upload for files the code execution tool should open. Managed Agents can instead mount uploads read-only inside a session's sandbox.
Gemini hands back a file URI, which its Files guide passes into an Interactions request, and URIs from v1 and v1beta are interchangeable. A file still in the PROCESSING state cannot be used for inference, so wait until it reports ACTIVE.
How many input tokens a referenced file adds before you pay for the call is a separate question, answered in counting tokens before you send.
Checked against: source 1, source 3, source 4, source 5, source 7
Which file types does each accept?
OpenAI's Responses API lists PDF, text and code, Word and other rich documents, presentations and spreadsheets. A PDF yields text and page images, other documents yield text only, and spreadsheets go through a separate augmentation flow.
Claude's document block accepts only PDF and text/plain. For .docx or .xlsx the guide says to convert to plain text; datasets can go to the code execution tool instead. A file in the wrong block, such as an image inside a document block, returns a 400.
Gemini's Files guide covers audio, images, video and documents. The only MIME list I found sits in the URL-input part of its input-methods guide and is labelled initial guidance, not a complete list, so test your exact formats.
Can you delete a file early, or download it back?
All three delete on request. OpenAI's DELETE /files/{file_id} also takes the file out of every vector store. A Claude deletion cannot be undone, though the file may linger in Messages calls already running, and deleting an expired file clears its metadata at once instead of after 30 days. Gemini lets you delete before the 48 hours run out.
Downloads are where they split. OpenAI's reference documents GET /files/{file_id}/content, which returns the file's contents; the reference does not say whether that holds for every purpose, so test the purpose you use. Claude marks every upload as not downloadable; only files made by skills or the code execution tool can be fetched. Gemini also refuses user uploads and allows downloads of model-generated files such as videos.
Is Claude's Files API still in beta, and who can read a file?
It is stable and needs no beta header. Requests still sending files-api-2025-04-14 keep working with the beta response shapes; without the header, lists page with a next_page cursor and every file carries expires_at, null when no expiry was set. For the Messages API, the availability table names the Claude API, Claude Platform on AWS, Claude Models on Google Cloud (Anthropic managed) and Microsoft Foundry hosted on Anthropic. Amazon Bedrock and the Google-managed offering are not in that list.
Access needs design on all three. Claude files belong to a workspace, not a user, and Anthropic warns never to accept a file_id from end users; it suggests one workspace per tenant, up to 100 per organization. OpenAI counts storage per project and Gemini lists files by project, so I would keep the same server-side map from user to file there too.
How does Gemini on Google Cloud handle files instead?
Google Cloud's Gemini document guide points at files by Cloud Storage URI (gs://) in its examples and describes no upload store like the Gemini API's. It caps a file read from Cloud Storage at 2 GiB minus 500 KiB and one from a public HTTP or HTTPS URL at 15 MiB, and the Interactions API takes up to 100 distinct gs:// URIs per request. The guide describes no expiry for these inputs; the object stays in Cloud Storage, under the bucket's own lifecycle rules.
The Gemini API can reach a bucket without copying it. You grant its service agent the Storage Object Viewer role and register the objects with the Files API: 2 GB per file, no overall storage limit, and access for up to 30 days per registration.
What else do people ask?
Is the Claude Files API eligible for zero data retention?
No. Its data-handling table marks it not eligible for zero data retention or HIPAA, with the note that files are retained until deleted or until their configured expiry. The OpenAI and Gemini file pages I read give no equivalent status.
Sources
- OpenAI API reference, Upload file (sizes, storage, purposes, expires_after), fetched 2026-11-21
- OpenAI API reference, Files (retrieve content, delete, list), fetched 2026-11-21
- OpenAI API docs, File inputs, fetched 2026-11-21
- Claude Platform docs, Files API, fetched 2026-11-21
- Gemini API docs, Files API, fetched 2026-11-21
- Gemini API docs, File input methods, fetched 2026-11-21
- Gemini API reference, Using files (File resource fields), fetched 2026-11-21
- Google Cloud, Document understanding (Gemini Enterprise Agent Platform), fetched 2026-11-21
- OpenAI API reference, Create upload (Uploads API, up to 8 GB), fetched 2026-11-21
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. This page compares the Files API documentation of OpenAI, Anthropic and Google (the Gemini API and Google Cloud's document guide), fetched on 21 Nov 2026. I did not upload files to any of the APIs for it, so limits and expiry behaviour are as documented, not observed. It does not cover the chat apps, vector store and file search limits, batch input rules beyond a link, or prices. Found a mistake? Tell me.