Light Logo
Go SDK (v0.41.1)Guides

Models

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

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

Get a model

model, err := client.Models.Get(
    context.TODO(),
    "deepseek-ai/deepseek-r1",
)

Create a model

model, err := client.Models.Create(
    context.TODO(),
    wriftai.CreateModelParams{
        Name:               "your-model",
        HardwareIdentifier: "cpu",
    },
)

Delete a model

err := client.Models.Delete(
    context.TODO(),
    "your-username/your-model",
)

Search models

models, err := client.Models.Search(
    context.TODO(),
    "llama", // search query
    nil, // default pagination options
)

List models

All public models

models, err := client.Models.List(
    context.TODO(),
    nil, // default pagination options
    nil, // no owner filter
)

Public models of a specific owner

owner := "deepseek-ai"
models, err := client.Models.List(
    context.TODO(),
    nil, // default pagination options
    &owner,
)

Public models sorted by their prediction count in descending order

sortBy := wriftai.PredictionsCount
sortDirection := wriftai.SortDirectionDesc
models, err := client.Models.List(
    context.TODO(),
    &wriftai.ModelPaginationOptions{
        SortBy: &sortBy,
        SortDirection: &sortDirection,
    },
    nil, // no owner filter
)

Update a model

newName := "your-new-model-name"
model, err := client.Models.Update(
    context.TODO(),
    "your-username/your-model",
    wriftai.UpdateModelParams{
        Name: &newName,
    },
)

Get a version of a model

modelVersion, err := client.ModelVersions.Get(
    context.TODO(),
    "deepseek-ai/deepseek-r1:2",
)

List versions of a model

modelVersions, err := client.ModelVersions.List(
    context.TODO(),
    "deepseek-ai/deepseek-r1",
    nil, // default pagination options
)