获取文件列表
Returns a list of files.
Query Parameters
purposestringrequired
Filter files by their purpose
Value in
"batch"limitinteger
Maximum number of files to return (default 10)
Default
10Range
1 <= valueResponse Body
Successful response with file list
TypeScript Definitions
Use the response body type in TypeScript.
codeintegerrequired
Example
20000messagestringrequired
Example
"Ok"statusbooleanrequired
Example
truedataobjectrequired
curl --request GET \
--url https://api.siliconflow.cn/v1/files \
--header 'Authorization: Bearer <token>'
import requests
url = "https://api.siliconflow.cn/v1/files"
headers = {"Authorization": "Bearer <token>"}
response = requests.request("GET", url, headers=headers)
print(response.text)
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.siliconflow.cn/v1/files', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
{
"code": 20000,
"message": "Ok",
"status": true,
"data": {
"data": [
{
"id": "file-kkhtqklcnm",
"object": "file",
"bytes": 806,
"created_at": 1741777570,
"filename": "requests-2.jsonl",
"purpose": "batch",
"line_count": 2
}
],
"object": "file"
}
}{
"code": 20012,
"message": "string",
"data": "string"
}"Invalid token""Forbidden""404 page not found"{
"code": 50505,
"message": "Model service overloaded. Please try again later.",
"data": "string"
}"string"