Skip to main content

Interface: MediaFile

Defined in: packages/core/src/types/media.ts:19

A PDF, document or other file the model can read.

Properties​

cacheControl?​

optional cacheControl?: boolean

Defined in: packages/core/src/types/media.ts:28

Enable provider-side caching (e.g., Anthropic ephemeral cache). Reduces input token costs ~90% on repeated use within the cache TTL.


data​

data: string | ArrayBuffer | Uint8Array<ArrayBufferLike> | Blob

Defined in: packages/core/src/types/media.ts:24

File data as Blob, Uint8Array, ArrayBuffer, base64 string, or HTTPS URL string. When an HTTPS URL is provided, the AI SDK passes it to the provider for server-side fetching — the file bytes never transit through your application. HTTP (non-TLS) URLs are rejected for security. Works across all providers.


mimeType​

mimeType: string

Defined in: packages/core/src/types/media.ts:26

MIME type of the file (e.g., 'application/pdf', 'text/csv')