FILES
Upload a File
Upload a file to your organization's storage. The returned file ID can be used wherever a file reference is accepted — for example as input_reference on video generation, or as a Batch API input.
Authorization
AuthorizationstringheaderrequiredBearer token — your API key. Example: Bearer sk-...
Limits
Files can be up to 200 MB. Uploads count against your organization's
file-count and storage-bytes quotas; requests beyond either quota are
rejected. Endpoints that consume files may apply their own stricter limits —
video input_reference images, for example, are capped at 30 MB.
Request body
multipart/form-datafileanyrequiredThe file to upload (multipart file part), up to 200 MB.
purpose"general" | "batch" | "batch_output"What the file is for. "general" (the default) covers ad-hoc uploads such as video reference images; "batch" marks Batch API input files. "connector" files are created by connector syncs and cannot be uploaded directly.
generalbatchbatch_outputResponse
idstringrequiredThe file ID (e.g. "file-abc123").
object"file"requiredObject type — always "file".
bytesintegerrequiredSize of the file in bytes.
created_atintegerrequiredUnix timestamp of when the file was uploaded.
filenamestringrequiredThe original filename.
purpose"general" | "batch" | "batch_output" | "connector"requiredThe purpose the file was uploaded for.
generalbatchbatch_outputconnectorRequest
import fs from "node:fs";
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "your-scx-api-key",
baseURL: "https://api.scx.ai/v1",
});
const file = await client.files.create({
file: fs.createReadStream("first-frame.png"),
purpose: "general",
});
console.log(file.id); // file-…import fs from "node:fs";
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "your-scx-api-key",
baseURL: "https://api.scx.ai/v1",
});
const file = await client.files.create({
file: fs.createReadStream("first-frame.png"),
purpose: "general",
});
console.log(file.id); // file-…Response
{
"id": "file-3f1a9c2e-5b7d-4e08-9a2b-6c1d8e4f7a90",
"object": "file",
"bytes": 48213,
"created_at": 1783652619,
"filename": "first-frame.png",
"purpose": "general"
}{
"id": "file-3f1a9c2e-5b7d-4e08-9a2b-6c1d8e4f7a90",
"object": "file",
"bytes": 48213,
"created_at": 1783652619,
"filename": "first-frame.png",
"purpose": "general"
}