Upload File
Uploads a document once, to use in any number of requests by its id. The file is converted to text ahead of
time: its status is processing until then, processed when it can be used, or error with the reason in
status_details. Poll GET /files/{id} for the status. Reference a processed file as {"type": "file", "file": {"file_id": "file-..."}} in chat, {"type": "input_file", "file_id": "file-..."} in Responses, or a document
block with {"type": "file", "file_id": "file-..."} as its source in Messages: the stored text is used, with no
conversion in the request. Documents only (the types listed under chat-content-part), up to 100 MB; at most
1,000 files per account; a file expires 30 days after upload. The file's text counts as prompt tokens in the
requests that use it.
Body
multipart/form-data-
file string (binary) required
The document. Its type is read from its name, then its content.
-
purpose string
Stored and reported as given (OpenAI's
user_data,assistantsand so on).default user_dataat most 32 characters
Responses
OK
application/json · file-object
Bad Request, including a file that is not a document and an account at its file limit. The body is the error envelope.
application/json · error-payload
The API key is missing, unknown or not active. Send it as Authorization: Bearer <key>.
application/json · error-payload
The file is larger than 100 MB.
application/json · error-payload
curl https://api.vultrinference.com/v1/files \
-H "Authorization: Bearer $VULTR_INFERENCE_API_KEY" \
-F "file=@file.pdf"import os
import requests
response = requests.post(
"https://api.vultrinference.com/v1/files",
headers={"Authorization": f"Bearer {os.environ['VULTR_INFERENCE_API_KEY']}"},
files={"file": open("file.pdf", "rb")},
)
print(response.json())import { openAsBlob } from "node:fs";
const form = new FormData();
form.append("file", await openAsBlob("file.pdf"), "file.pdf");
const response = await fetch("https://api.vultrinference.com/v1/files", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.VULTR_INFERENCE_API_KEY}`,
},
body: form,
});
console.log(await response.json());{
"id": "file-6f1d2c9a4b7e8f0a1c2d3e4f",
"object": "file",
"bytes": 0,
"created_at": 1790000000,
"expires_at": 1790000000,
"filename": "string",
"purpose": "string",
"status": "processing",
"status_details": "string"
}