Light Logo
JavaScript SDK (v0.39.1)Guides

Models

A guide on how to work with models using the WriftAI JavaScript client

This section demonstrates common model operations you can perform with the WriftAI JavaScript client. These examples are not exhaustive — check the client reference for all options.

Get a model

const model = await wriftai.models.get('deepseek-ai/deepseek-r1');

Create a model

const model = await wriftai.models.create({
  name: 'your-model',
  hardware_identifier: 'cpu',
});

Delete a model

await wriftai.models.delete('your-username/your-model');

Search models

// returns models matching the query
const results = await wriftai.models.search('llama');

List models

All public models

const models = await wriftai.models.list();

Public models of a specific owner

const models = await wriftai.models.list(
  {}, // default pagination
  'deepseek-ai',
);

Public models sorted by their prediction count in descending order

import { ModelsSortBy, SortDirection } from 'wriftai';

const popularModels = await wriftai.models.list({
  sort_by: ModelsSortBy.predictions_count,
  sort_direction: SortDirection.desc,
});

Update a model

const updatedModel = await wriftai.models.update('your-username/your-model', {
  name: 'your-new-model-name',
});

Get a version of a model

const modelVersion = await wriftai.modelVersions.get(
  'deepseek-ai/deepseek-r1:2',
);

List versions of a model

const modelVersions = await wriftai.modelVersions.list(
  'deepseek-ai/deepseek-r1',
);