listFiles

suspend fun DeepSeekClientBase.listFiles(after: String? = null, limit: Int? = null, order: SortOrder? = null, purpose: FilePurpose? = null): FileList

Lists stored files, oldest first, one page at a time.

Example — walk every page:

var page = client.listFiles(limit = 100)
while (true) {
page.data.forEach { println("${it.id} ${it.filename}") }
if (!page.hasMore) break
page = client.listFiles(after = page.lastId, limit = 100)
}

Return

One FileList page

Parameters

after

Identifier of the file to resume after, typically FileList.lastId of the previous page; null starts from the beginning

limit

How many files to return, between 1 and 1000; the API defaults to 1000

order

Whether to sort by creation time ascending or descending; the API defaults to SortOrder.ASC

purpose

Restricts the listing to files with this purpose

Throws

if limit falls outside 1..1000

if the API returns a non-2xx status