Files API Retention and Size Limits: Claude, OpenAI, and Gemini Compared

A technician with a laptop inspecting a server rack in a data center, representing where API file storage and uploads physically live

Claude’s Files API keeps an uploaded file until you delete it or an optional timer you set yourself runs out. OpenAI’s Assistants file search does effectively the same thing — files sit in a vector store indefinitely. Gemini’s Files API works the opposite way: every file is deleted automatically 48 hours after upload, with no way to extend that window. If you’re building anything that re-uses an uploaded document across multiple API calls, that one difference in default behavior matters more than the size limits below it.

This comparison pulls the retention windows, size caps and storage ceilings directly from each provider’s current developer documentation, linked at the bottom of each section. None of the numbers below are estimates.

Why retention policy matters more than the size limit

Most comparisons of these three file-upload systems lead with size caps, because that’s the number developers ask about first. In practice, the harder bug to catch is the one where a file silently disappears between two API calls that were supposed to reuse it. A Gemini-based workflow that uploads a PDF on Monday and references it again on Thursday will fail with a 404 — not because of a quota, but because the file’s 48-hour clock ran out two days earlier. The same workflow built on Claude or OpenAI’s Assistants API would still work, because neither deletes a file unless you tell it to (or, for Claude, unless you set an expiration at upload time).

That asymmetry is the first thing to design around, before storage limits or pricing even enter the decision.

The numbers, side by side

Claude Files APIOpenAI Assistants file searchGemini Files API
Default retentionUntil manually deleted (no default expiry)Indefinite, until manually deletedAutomatic deletion after exactly 48 hours
Optional expirationYes — set expires_in_seconds at upload, 1 hour to 90 days, cannot be changed afterwardNot applicableNot applicable — 48 hours is fixed
Max file size500 MB per file512 MB per file, 5,000,000 tokens per file2 GB per file
Max total storage1 TB per organization100 GB per project20 GB per project
Files per containerNot capped by file count10,000 files per vector storeNot capped by file count
Manual delete callDELETE /v1/files/{file_id}Vector store / file delete endpointclient.files.delete(name=...) or REST DELETE

Sources: Claude’s Files API documentation, OpenAI’s Assistants API v2 FAQ, and Google’s Gemini Files API documentation.

Claude’s Files API: persistent by default, deletable on demand

Claude’s documentation states plainly that files “persist until you delete them or they reach their expires_at.” If you upload a file without setting an expiration, it has none — expires_at comes back null, and the file stays available until you explicitly call the delete endpoint. If you do set an expiration, it has to be an integer between 3,600 seconds (one hour) and 7,776,000 seconds (90 days), and once set it can’t be changed. After a file expires, downloading its content returns a 404 and any Messages request that references it fails, though the file’s metadata stays readable for up to 30 days afterward.

One detail worth flagging for anyone building a retention-sensitive workflow: Anthropic’s docs note that expiration “is not guaranteed deletion” in the sense that matters for compliance — the underlying content may be retained briefly for safety review even after it’s no longer accessible through the API. If you need a file gone for audit or privacy reasons, the documented way to do that is the explicit DELETE /v1/files/{file_id} call, not waiting out an expiration timer.

The size ceiling here is 500 MB per file, with 1 TB of total storage per organization — generous enough that most teams will hit the per-file cap (a video or a dataset export) long before they hit the account-wide one. For context on how this fits into a broader prompt-and-file workflow, see our walkthrough on using Claude’s Files API to stop re-uploading the same PDF on every call.

OpenAI’s Assistants file search: indefinite storage, token-based limits

OpenAI’s own FAQ for the Assistants API v2 is direct about retention: data you upload is “stored indefinitely until a user manually deletes it.” There’s no automatic cleanup process documented for ordinary use — the one historical exception on the page is a one-time migration note, where vector stores created before April 17, 2024 were removed if they went unused through the rest of that year. That’s a legacy cutoff, not a standing policy, so current uploads don’t inherit any expiration behavior from it.

Where OpenAI’s limits diverge from the other two providers is that they’re partly token-based rather than purely size-based: a single file is capped at 512 MB and 5,000,000 tokens, whichever comes first, and a vector store can hold up to 10,000 files. The project-wide ceiling is 100 GB. For a team chunking long technical manuals or transcript archives into a vector store, the token cap is usually the binding constraint well before the byte cap is — a dense, text-heavy 500 MB file can exceed 5 million tokens before it comes close to the size limit.

Gemini’s Files API: a hard 48-hour clock

Google’s documentation for the Gemini Files API is the shortest and the strictest of the three on this point: “Files are automatically deleted after 48 hours.” There’s no parameter to extend that, and no tier of the API changes it — it applies uniformly. The per-file size ceiling is the largest of the three providers at 2 GB, and total project storage is capped at 20 GB, which is the smallest of the three totals but still comfortably larger than what the 48-hour window will let most workflows accumulate anyway.

In practice, the Gemini Files API is best treated as upload-and-use-now storage: send the file, run the prompts that need it within the window, and plan to re-upload if a user comes back after a weekend. Teams that try to use it as a long-term document store for a RAG-style assistant run into the exact failure mode described above — the 404 that shows up two or three days into testing, after the demo worked fine the first day. If your architecture depends on documents surviving longer than that, pairing Gemini’s generation calls with your own storage layer (not the Files API) is the documented path, not a workaround.

A worked example: a support bot that reuses the same product manual

Say you’re building a support assistant that answers questions against a 40-page PDF product manual, and you expect to field questions against that same file for months. Here’s how the three providers’ retention rules change the implementation:

  • On Claude: upload the PDF once with no expiration set, store the returned file_id in your own database, and reference that same ID in every Messages call. No re-upload logic is needed unless you choose to delete and rotate it yourself.
  • On OpenAI: upload the PDF into a vector store once, attach that vector store to your Assistant, and leave it — the “indefinite” retention means the same setup from day one still works a year later, unless your total project storage approaches the 100 GB ceiling across many such files.
  • On Gemini: you can’t upload once and forget it. The realistic pattern is to check whether the file reference is still valid before each use (or just always re-upload on session start), and treat 48 hours as the outer bound of any caching you build on top of the Files API.

The Claude and OpenAI paths need a one-time upload and a stored ID. The Gemini path needs a small amount of extra engineering — either a re-upload-on-demand function or your own tracking of upload timestamps — to avoid the expired-file 404 showing up in production instead of in testing.

Choosing based on retention, not just price or model quality

File retention rarely makes it into the first round of an API comparison, which tends to focus on rate limits and pricing tiers or on raw model quality, as in our broader look at how GPT, Gemini, and Claude compare on cost and capability. But for any system that attaches a document to a conversation and expects to come back to it later, the retention column in the table above is the one that decides whether your architecture needs a re-upload path at all. It’s worth deciding this before writing the integration, not after a weekend-old file reference starts returning errors.

It’s also worth separating file storage from context storage. A file sitting in any of these three systems isn’t the same as content sitting inside a model’s active context window — retrieving a file still costs you the tokens to process it when referenced, a cost shaped by each provider’s own token accounting. Our explainer on how context windows work covers that distinction in more depth if you’re budgeting token usage around repeated file references.

None of the three retention models is objectively “better” — they’re suited to different workloads. Gemini’s hard 48-hour window is a reasonable fit for single-session tasks like analyzing one uploaded report during a live chat. Claude’s opt-in expiration and OpenAI’s indefinite storage both suit long-lived knowledge bases, with the choice between them coming down to whether your files are better described by raw size (Claude’s 500 MB cap, 1 TB total) or by token density (OpenAI’s 5M-token-per-file ceiling, 100 GB total). Matching the retention model to how long you actually need the file around will save a debugging session later.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top