2026-10-20
(待译)
File stores uploads for conversations and knowledge bases, with metadata, downloads and deletion. Concepts and behavior follow OpenAI Files (multipart uploads, purposes and file IDs), so OpenAI Files experience applies. Differences: uploads are limited to 104857600 bytes; only user_data, assistants and vision purposes are accepted, and conversation images require user_data; praxis[expires_in_seconds] allows expiry up to 90 days, while expires_after allows up to 30 days. Start with praxis.file.files.create to upload bytes and obtain a reusable file ID.
加载中…单文件上限 100 MB(104857600 字节),上传与下载全程流式。不提供 Uploads 分片。文件按内容识别类型;支持格式见上传端点。组织之间的文件互不可见。
| 方法 | 路径 | 说明 | 支持 |
|---|---|---|---|
| POST | /v1/files | 上传文件 | ◐ 部分支持 |
| GET | /v1/files | 列出文件 | ● 支持 |
| GET | /v1/files/{file_id} | 查看文件 | ● 支持 |
| GET | /v1/files/{file_id}/content | 下载文件 | ● 支持 |
| DELETE | /v1/files/{file_id} | 删除文件 | ● 支持 |
参数与字段的权威定义以 OpenAI 官方文档为准。
/file/v1/files◐ 部分支持filestring必填File bytes in one multipart file part, not a filename or file ID. The file must be nonempty and at most 104857600 bytes; its content determines the MIME type.
purposestring必填Purpose label stored with the file: user_data, assistants or vision. The vision purpose accepts only PNG, JPEG, GIF and WebP images. Conversation image references require user_data.
expires_afterobject可选Optional expiry relative to created_at. Files without an expiry persist until deleted.
anchorstring必填Creation timestamp from which expiry is measured. Send created_at as the multipart field expires_after[anchor].
secondsinteger必填Lifetime in seconds after creation, from 3600 through 2592000. Send as expires_after[seconds]; do not combine with praxis[expires_in_seconds].
praxisobject可选Own-face extensions. Use at most one expiry setting.
expires_in_secondsinteger可选Lifetime in seconds after creation, from 3600 through 7776000. Send as the multipart field praxis[expires_in_seconds]; mutually exclusive with expires_after.
200 file
支持 PDF、DOCX / XLSX / PPTX、PNG / JPEG / GIF / WebP、MP3 / WAV / FLAC / OGG / M4A、MP4 / WebM,以及 UTF-8 JSON / NDJSON / CSV / Markdown / 纯文本。purpose 支持 user_data / assistants / vision。上限 104857600 字节;空文件、类型不支持、用途不支持、超限均返回 400。不提供 Uploads 分片。可用 expires_after[anchor] 与 expires_after[seconds] 或 praxis[expires_in_seconds] 设置有效期,两组互斥。
错误按 OpenAI 格式返回,参见 错误码
OK
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | File identifier: file_dp_ followed by a 26-character uppercase Crockford ULID. Use the ID returned by upload or list. |
| bytes | integer | The size of the file, in bytes. |
| created_at | integer | The Unix timestamp (in seconds) for when the file was created. |
| expires_at | integer | The Unix timestamp (in seconds) for when the file will expire. |
| filename | string | The name of the file. |
| object | string | The object type, which is always `file`. |
| purpose | string | Upload purpose. Image references in conversations require user_data. |
| status | string | Deprecated. The current status of the file, which can be either `uploaded`, `processed`, or `error`. |
| status_details | string | null | Deprecated; always null or absent. |
| mime_type | string | Content-detected MIME type. |
| downloadable | boolean | Tenant-owned live files can be downloaded through this face. |
| scope | object | Present for session output files. |
| scope.type | string | Kind of scope; always `session`. |
| scope.id | string | Id of the session the file belongs to. |
| relative_path | string | Path within the session output directory; present for session outputs. |
| revision | integer | Session output revision; present for session outputs. |
/file/v1/files● 支持purposestring可选query: Only return files with the given purpose.
limitinteger可选query: A limit on the number of objects to be returned. Limit can range between 1 and 10,000, and the default is 10,000.
orderstring可选query: Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.
afterstring可选query: File ID cursor for the next page; mutually exclusive with before. Use an ID from the current listing.
scope_idstring可选query: Session whose output files to list. Accepts sesn_ or ags_ followed by 1 to 251 letters, digits, underscores or hyphens. An existing session with no outputs returns an empty list; a nonexistent or inaccessible session returns 404.
beforestring可选query: File ID cursor for the preceding page; mutually exclusive with after. Use an ID from the current listing.
200 list
错误按 OpenAI 格式返回,参见 错误码
OK
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| object | string | Object type; always `list`. |
| data | array<object> | Files of the page, in the requested order. |
| data[].id | string | File identifier: file_dp_ followed by a 26-character uppercase Crockford ULID. Use the ID returned by upload or list. |
| data[].bytes | integer | The size of the file, in bytes. |
| data[].created_at | integer | The Unix timestamp (in seconds) for when the file was created. |
| data[].expires_at | integer | The Unix timestamp (in seconds) for when the file will expire. |
| data[].filename | string | The name of the file. |
| data[].object | string | The object type, which is always `file`. |
| data[].purpose | string | Upload purpose. Image references in conversations require user_data. |
| data[].status | string | Deprecated. The current status of the file, which can be either `uploaded`, `processed`, or `error`. |
| data[].status_details | string | null | Deprecated; always null or absent. |
| data[].mime_type | string | Content-detected MIME type. |
| data[].downloadable | boolean | Tenant-owned live files can be downloaded through this face. |
| data[].scope | object | Present for session output files. |
| data[].relative_path | string | Path within the session output directory; present for session outputs. |
| data[].revision | integer | Session output revision; present for session outputs. |
| first_id | string | Id of the first file of the page; usable as `before` to read the preceding page. |
| last_id | string | Id of the last file of the page; usable as `after` to read the next page. |
| has_more | boolean | Whether more files exist beyond this page. |
先调用「上传文件」,用返回的文件 ID 替换示例文件 ID。
/file/v1/files/{file_id}● 支持file_idstring必填path: ID of a tenant-owned live file, as returned by upload or list; starts with file_dp_.
200 file
错误按 OpenAI 格式返回,参见 错误码
OK
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | File identifier: file_dp_ followed by a 26-character uppercase Crockford ULID. Use the ID returned by upload or list. |
| bytes | integer | The size of the file, in bytes. |
| created_at | integer | The Unix timestamp (in seconds) for when the file was created. |
| expires_at | integer | The Unix timestamp (in seconds) for when the file will expire. |
| filename | string | The name of the file. |
| object | string | The object type, which is always `file`. |
| purpose | string | Upload purpose. Image references in conversations require user_data. |
| status | string | Deprecated. The current status of the file, which can be either `uploaded`, `processed`, or `error`. |
| status_details | string | null | Deprecated; always null or absent. |
| mime_type | string | Content-detected MIME type. |
| downloadable | boolean | Tenant-owned live files can be downloaded through this face. |
| scope | object | Present for session output files. |
| scope.type | string | Kind of scope; always `session`. |
| scope.id | string | Id of the session the file belongs to. |
| relative_path | string | Path within the session output directory; present for session outputs. |
| revision | integer | Session output revision; present for session outputs. |
先调用「上传文件」,用返回的文件 ID 替换示例文件 ID。
/file/v1/files/{file_id}● 支持file_idstring必填path: ID of a tenant-owned live file, as returned by upload or list; starts with file_dp_.
200 file
错误按 OpenAI 格式返回,参见 错误码
OK
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | File identifier: file_dp_ followed by a 26-character uppercase Crockford ULID. Use the ID returned by upload or list. |
| object | string | Object type; always `file`. |
| deleted | boolean | Always true; the file can no longer be read, though downloads already authorized may finish. |