Upload file
curl --request POST \
--url https://api.novita.ai/openai/v1/files \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"purpose": "<string>"
}
'import requests
url = "https://api.novita.ai/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.novita.ai/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.novita.ai/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.novita.ai/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.novita.ai/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.novita.ai/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
}
}Batch
Upload file
POST
/
openai
/
v1
/
files
Upload file
curl --request POST \
--url https://api.novita.ai/openai/v1/files \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"purpose": "<string>"
}
'import requests
url = "https://api.novita.ai/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.novita.ai/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.novita.ai/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.novita.ai/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.novita.ai/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.novita.ai/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
}
}Upload the batch input file so that it can be correctly referenced when creating a batch.
Request Headers
string
required
Enum:
application/jsonstring
required
Bearer authentication format, for example: Bearer {{API Key}}.
Request Body
file
required
The batch input file to be uploaded should be in Here is an example of an input file containing two requests:
.jsonl format, with each line detailing an API inference request.Each request must have a unique custom_id to identify inference results in the output file after batch processing. The parameters within the body field of each line are used as the actual inference request parameters for the endpoint.All requests within a single batch JSONL file must target the same model. Do not mix requests for different models in one batch.
{"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}}
string
required
The purpose of the uploaded file. For batch processing, this should be set to
batch.Enum: batchResponse
string
required
The unique identifier of the uploaded file.
string
required
The object type, which is always
file.integer
required
The size of the uploaded file in bytes.
integer
required
The Unix timestamp (in seconds) when the file was created.
string
required
The name of the uploaded file.
string
required
The purpose of the uploaded file.
Last modified on October 22, 2025