Table of Contents

Class OpenAIFile

The File object represents a document that has been uploaded to OpenAI.

public class OpenAIFile : IUploadedFile, IProviderData, IData
Inheritance
object
OpenAIFile
Implements
IData
Extension Methods

Properties

Api

public Api Api { get; }

Property Value

Api

ByteSize

The size of the file, in bytes

public int ByteSize { get; set; }

Property Value

int

CreatedAt

The Unix timestamp (in seconds) of when this object was created.

public UnixTime CreatedAt { get; set; }

Property Value

UnixTime

ExpiresAt

The Unix timestamp (in seconds) of when this object will expire.

public UnixTime ExpiresAt { get; set; }

Property Value

UnixTime

Id

The file identifier, which can be referenced in the API endpoints.

public string Id { get; set; }

Property Value

string

MimeType

Gets the MIME type of the file as detected or declared during upload.

  • Examples: application/json, image/png, audio/wav.
  • Can be used to determine how to process or preview the file.
public MimeType MimeType { get; }

Property Value

MimeType

Name

The name of the file

public string Name { get; set; }

Property Value

string

Object

The object type, which is always file.

public string Object { get; set; }

Property Value

string

Purpose

The intended purpose of the file. Supported values are fine-tune, fine-tune-results, Assistants, and Assistants_Output

public OpenAITypes.UploadPurpose? Purpose { get; set; }

Property Value

OpenAITypes.UploadPurpose?

Methods

GetMetadata()

Builds a serializable metadata object for this file.

  • Encapsulates file properties for persistence or logging.
  • Useful for caching file data locally or transmitting through APIs.
public SerializableMetadata GetMetadata()

Returns

SerializableMetadata