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
files.content(file_id) -> StringIO
GET/files/{file_id}/content
Upload file
files.create(**kwargs) -> FileObject { id, bytes, created_at, 6 more }
POST/files
Delete file
files.delete(file_id) -> FileDeleted { id, deleted, object }
DELETE/files/{file_id}
List files
files.list(**kwargs) -> CursorPage<FileObject { id, bytes, created_at, 6 more } >
GET/files
Retrieve file
files.retrieve(file_id) -> FileObject { id, bytes, created_at, 6 more }
GET/files/{file_id}
ModelsExpand Collapse
FileContent = String
class FileDeleted { id, deleted, object }
class FileObject { id, bytes, created_at, 6 more }

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

FilePurpose = :assistants | :batch | :"fine-tune" | 3 more

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