Skip to main content

Interface: MediaFile

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

Generic file data with MIME type Used for PDFs, documents, and other file types that AI models can process

Properties

cacheControl?

optional cacheControl?: boolean

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

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:38

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:40

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