List models
const res = await client.models.list();
for (const m of res.data) {
console.log(m.id, m.name);
}
Same as GET https://51kik.com/v1/models. Filters match HTTP query params:
await client.models.list({
q: "claude",
limit: 20,
offset: 0,
});
See List models.
Upload files
import { readFile } from "node:fs/promises";
const buf = await readFile("./spec.pdf");
const file = await client.files.upload({
file: buf,
filename: "spec.pdf",
purpose: "assistants",
});
console.log(file.id); // use in chat input_file.file_id
List / delete
const list = await client.files.list();
await client.files.delete("file-xxxxxxxx");
HTTP reference: Files.
Use in chat
Pass file.id in an input_file part — Files and context.
Not implemented
client.embeddings throws NotImplementedByGatewayError — use HTTP Create embedding.