import { SDK } from "@meetkai/mka1";
import { openAsBlob } from "node:fs";
const sdk = new SDK({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await sdk.llm.files.upload({
requestBody: {
file: await openAsBlob("example.file"),
purpose: "assistants",
},
});
console.log(result);
}
run();{
"id": "file-abc123",
"object": "file",
"bytes": 125000,
"created_at": 1704067200,
"filename": "product-manual.pdf",
"purpose": "assistants",
"status": "processed"
}Upload a file that can be used with Assistants, Vector Stores, and other features. Files are uploaded to S3 for durable storage.
import { SDK } from "@meetkai/mka1";
import { openAsBlob } from "node:fs";
const sdk = new SDK({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await sdk.llm.files.upload({
requestBody: {
file: await openAsBlob("example.file"),
purpose: "assistants",
},
});
console.log(result);
}
run();{
"id": "file-abc123",
"object": "file",
"bytes": 125000,
"created_at": 1704067200,
"filename": "product-manual.pdf",
"purpose": "assistants",
"status": "processed"
}Authenticate with your MKA1 API key at the API gateway: Authorization: Bearer <mka1-api-key>. For multi-user server-side integrations, also send X-On-Behalf-Of to identify the end user making the request.
Optional external user identifier for multi-user server-side integrations. Use this when acting on behalf of one of your end users.
OK
The file identifier
The size of the file in bytes
-9007199254740991 <= x <= 9007199254740991Unix timestamp when the file was created
-9007199254740991 <= x <= 9007199254740991The name of the file
The intended purpose of the file
assistants, batch, fine-tune, vision, user_data, evals Unix timestamp when the file expires
-9007199254740991 <= x <= 9007199254740991DEPRECATED: File processing status
uploaded, processed, error DEPRECATED: Details about file status
Was this page helpful?