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); // stored file id for listing / deletion

List / delete

const list = await client.files.list();
await client.files.delete("file-xxxxxxxx");

HTTP reference: Files.

Use in chat

The SDK's client.chat.messages has built-in file handling — local paths are automatically converted to input_file + file_data (inline base64):

const { content, plugins } = await client.chat.messages({
  prompt: "Summarize this PDF",
  pdfPath: "/path/to/doc.pdf",
});

See Files and context · SDK overview.

Not implemented

client.embeddings throws NotImplementedByGatewayError — use HTTP Create embedding.