上传文件
curl --request POST \
--url https://api.ppio.com/openai/v1/files \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"purpose": "<string>"
}
'import requests
url = "https://api.ppio.com/openai/v1/files"
payload = { "purpose": "<string>" }
headers = {
"Content-Type": "<content-type>",
"Authorization": "<authorization>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': '<content-type>', Authorization: '<authorization>'},
body: JSON.stringify({purpose: '<string>'})
};
fetch('https://api.ppio.com/openai/v1/files', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ppio.com/openai/v1/files",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'purpose' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.ppio.com/openai/v1/files"
payload := strings.NewReader("{\n \"purpose\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.ppio.com/openai/v1/files")
.header("Content-Type", "<content-type>")
.header("Authorization", "<authorization>")
.body("{\n \"purpose\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ppio.com/openai/v1/files")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = '<content-type>'
request["Authorization"] = '<authorization>'
request.body = "{\n \"purpose\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "<string>",
"bytes": 123,
"created_at": 123,
"filename": "<string>",
"purpose": "<string>",
"metadata": {
"total_requests": 123
}
}批量推理
上传文件
POST
/
openai
/
v1
/
files
上传文件
curl --request POST \
--url https://api.ppio.com/openai/v1/files \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"purpose": "<string>"
}
'import requests
url = "https://api.ppio.com/openai/v1/files"
payload = { "purpose": "<string>" }
headers = {
"Content-Type": "<content-type>",
"Authorization": "<authorization>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': '<content-type>', Authorization: '<authorization>'},
body: JSON.stringify({purpose: '<string>'})
};
fetch('https://api.ppio.com/openai/v1/files', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ppio.com/openai/v1/files",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'purpose' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.ppio.com/openai/v1/files"
payload := strings.NewReader("{\n \"purpose\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.ppio.com/openai/v1/files")
.header("Content-Type", "<content-type>")
.header("Authorization", "<authorization>")
.body("{\n \"purpose\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ppio.com/openai/v1/files")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = '<content-type>'
request["Authorization"] = '<authorization>'
request.body = "{\n \"purpose\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "<string>",
"bytes": 123,
"created_at": 123,
"filename": "<string>",
"purpose": "<string>",
"metadata": {
"total_requests": 123
}
}上传批处理输入文件,以便在创建批处理时能够被正确引用。
请求头
枚举值:
application/jsonBearer 身份验证格式,例如:Bearer {{API 密钥}}。
请求体
上传的文件应为批处理输入文件,格式为 以下是包含两个请求的示例输入文件:
.jsonl,其中每行描述一个 API 推理请求的详细信息。每个请求必须包含一个唯一的 custom_id,以便在批处理完成后在输出文件中查找相应的推理结果。每行的 body 字段中的参数将作为实际推理请求参数发送到指定的 endpoint。单个 JSONL 文件中的所有请求必须使用同一个模型,请不要在一个批次中混合不同模型的请求。
{"custom_id": "request-1", "body": {"model": "deepseek/deepseek-v3-0324", "messages": [{"role": "user", "content": "Hello, world!"}], "max_tokens": 400}}
{"custom_id": "request-2", "body": {"model": "deepseek/deepseek-v3-0324", "messages": [{"role": "system", "content": "You are a helpful assistant."},{"role": "user", "content": "Hello world!"}],"max_tokens": 1000}}
上传文件的用途。用于批处理时,应设置为
batch。枚举值: batch响应
上传文件的唯一标识符。
对象类型,恒为
file。上传文件的字节大小。
文件创建时的 Unix 时间戳(秒)。
上传文件的名称。
上传文件的用途。
最后修改于 2026年1月12日
⌘I