SPB Git

Repository Public

create.md 3.9 KB 149 lines markdown

1> For the complete documentation index, see [llms.txt](/llms.txt). Markdown versions of documentation pages are available by appending `.md` to the page URL.23## Upload file45**post** `/files`67Upload a file that can be used across various endpoints. Individual files8can be up to 512 MB, and each project can store up to 2.5 TB of files in9total. There is no organization-wide storage limit. Uploads to this10endpoint are rate-limited to 1,000 requests per minute per authenticated11user.1213- The Assistants API supports files up to 2 million tokens and of specific14  file types. See the [Assistants Tools guide](/api/docs/guides/tools) for15  details.16- The Fine-tuning API only supports `.jsonl` files. The input also has17  certain required formats for fine-tuning18  [chat](/api/docs/guides/supervised-fine-tuning#formatting-your-data) or19  [completions](/api/docs/guides/supervised-fine-tuning#formatting-your-data) models.20- The Batch API only supports `.jsonl` files up to 200 MB in size. The input21  also has a specific required22  [format](/api/docs/guides/batch#1-prepare-your-batch-file).23- For Retrieval or `file_search` ingestion, upload files here first. If24  you need to attach multiple uploaded files to the same vector store, use25  [`/vector_stores/{vector_store_id}/file_batches`](/api/reference/resources/vector_stores/subresources/file_batches/methods/create)26  instead of attaching them one by one. Vector store attachment has separate27  limits from file upload, including 2,000 attached files per minute per28  organization.2930Please [contact us](https://help.openai.com/) if you need to increase these31storage limits.3233### Returns3435- `FileObject object { id, bytes, created_at, 6 more }`3637  The `File` object represents a document that has been uploaded to OpenAI.3839  - `id: string`4041    The file identifier, which can be referenced in the API endpoints.4243  - `bytes: number`4445    The size of the file, in bytes.4647  - `created_at: number`4849    The Unix timestamp (in seconds) for when the file was created.5051  - `filename: string`5253    The name of the file.5455  - `object: "file"`5657    The object type, which is always `file`.5859    - `"file"`6061  - `purpose: "assistants" or "assistants_output" or "batch" or 5 more`6263    The intended purpose of the file. Supported values are `assistants`, `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results`, `vision`, and `user_data`.6465    - `"assistants"`6667    - `"assistants_output"`6869    - `"batch"`7071    - `"batch_output"`7273    - `"fine-tune"`7475    - `"fine-tune-results"`7677    - `"vision"`7879    - `"user_data"`8081  - `status: "uploaded" or "processed" or "error"`8283    Deprecated. The current status of the file, which can be either `uploaded`, `processed`, or `error`.8485    - `"uploaded"`8687    - `"processed"`8889    - `"error"`9091  - `expires_at: optional number`9293    The Unix timestamp (in seconds) for when the file will expire.9495  - `status_details: optional string`9697    Deprecated. For details on why a fine-tuning training file failed validation, see the `error` field on `fine_tuning.job`.9899### Example100101```http102curl https://api.openai.com/v1/files \103    -H 'Content-Type: multipart/form-data' \104    -H "Authorization: Bearer $OPENAI_API_KEY" \105    -F 'file=@/path/to/file' \106    -F purpose=assistants107```108109#### Response110111```json112{113  "id": "id",114  "bytes": 0,115  "created_at": 0,116  "filename": "filename",117  "object": "file",118  "purpose": "assistants",119  "status": "uploaded",120  "expires_at": 0,121  "status_details": "status_details"122}123```124125### Example126127```http128curl https://api.openai.com/v1/files \129  -H "Authorization: Bearer $OPENAI_API_KEY" \130  -F purpose="fine-tune" \131  -F file="@mydata.jsonl"132  -F expires_after[anchor]="created_at"133  -F expires_after[seconds]=2592000134```135136#### Response137138```json139{140  "id": "file-abc123",141  "object": "file",142  "bytes": 120000,143  "created_at": 1677610602,144  "expires_at": 1677614202,145  "filename": "mydata.jsonl",146  "purpose": "fine-tune",147}148```149
Files main
Menu

Theme