Upload Files
curl --request POST \
--url https://api.siliconflow.cn/v1/files \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form purpose=batch \
--form file='@example-file'import requests
url = "https://api.siliconflow.cn/v1/files"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = { "purpose": "batch" }
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('purpose', 'batch');
form.append('file', '/path/to/abc.jsonl');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.siliconflow.cn/v1/files', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"code": 20000,
"message": "Ok",
"status": true,
"data": {
"id": "file-jkvytbjtow",
"object": "file",
"bytes": 8509,
"createdAt": 1741685396,
"filename": "requests.jsonl",
"purpose": "batch"
}
}{
"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>"Batch
Upload file
Upload files
POST
/
files
Upload Files
curl --request POST \
--url https://api.siliconflow.cn/v1/files \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form purpose=batch \
--form file='@example-file'import requests
url = "https://api.siliconflow.cn/v1/files"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = { "purpose": "batch" }
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('purpose', 'batch');
form.append('file', '/path/to/abc.jsonl');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.siliconflow.cn/v1/files', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"code": 20000,
"message": "Ok",
"status": true,
"data": {
"id": "file-jkvytbjtow",
"object": "file",
"bytes": 8509,
"createdAt": 1741685396,
"filename": "requests.jsonl",
"purpose": "batch"
}
}{
"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>"Authorizations
Body
multipart/form-data
⌘I