Skip to content
For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to the page URL.
Primary navigation

Files

Files are used to upload documents that can be used with features like Assistants and Fine-tuning.

Retrieve file content
client.Files.Content(ctx, fileID) (*Response, error)
GET/files/{file_id}/content
Upload file
client.Files.New(ctx, body) (*FileObject, error)
POST/files
Delete file
client.Files.Delete(ctx, fileID) (*FileDeleted, error)
DELETE/files/{file_id}
List files
client.Files.List(ctx, query) (*CursorPage[FileObject], error)
GET/files
Retrieve file
client.Files.Get(ctx, fileID) (*FileObject, error)
GET/files/{file_id}
ModelsExpand Collapse
type FileContent string
type FileDeleted struct{…}
type FileObject struct{…}

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

type FilePurpose string

The intended purpose of the uploaded file. One of:

  • assistants: Used in the Assistants API
  • batch: Used in the Batch API
  • fine-tune: Used for fine-tuning
  • vision: Images used for vision fine-tuning
  • user_data: Flexible file type for any purpose
  • evals: Used for eval data sets