Skip to content

Uploads

Create upload
client.Uploads.New(ctx, body) (*Upload, error)
POST/uploads
Complete upload
client.Uploads.Complete(ctx, uploadID, body) (*Upload, error)
POST/uploads/{upload_id}/complete
Cancel upload
client.Uploads.Cancel(ctx, uploadID) (*Upload, error)
POST/uploads/{upload_id}/cancel
ModelsExpand Collapse
type Upload struct{…}

The Upload object can accept byte chunks in the form of Parts.

ID string

The Upload unique identifier, which can be referenced in API endpoints.

Bytes int64

The intended number of bytes to be uploaded.

CreatedAt int64

The Unix timestamp (in seconds) for when the Upload was created.

ExpiresAt int64

The Unix timestamp (in seconds) for when the Upload will expire.

Filename string

The name of the file to be uploaded.

Object Upload

The object type, which is always "upload".

Purpose string

The intended purpose of the file. Please refer here for acceptable values.

Status UploadStatus

The status of the Upload.

Accepts one of the following:
const UploadStatusPending UploadStatus = "pending"
const UploadStatusCompleted UploadStatus = "completed"
const UploadStatusCancelled UploadStatus = "cancelled"
const UploadStatusExpired UploadStatus = "expired"
File FileObjectoptional

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

UploadsParts

Add upload part
client.Uploads.Parts.New(ctx, uploadID, body) (*UploadPart, error)
POST/uploads/{upload_id}/parts
ModelsExpand Collapse
type UploadPart struct{…}

The upload Part represents a chunk of bytes we can add to an Upload object.

ID string

The upload Part unique identifier, which can be referenced in API endpoints.

CreatedAt int64

The Unix timestamp (in seconds) for when the Part was created.

Object UploadPart

The object type, which is always upload.part.

UploadID string

The ID of the Upload object that this Part was added to.