LocalModels API
Local Models API
import { CodeBoltClient } from '@codebolt/clientsdk';
const client = new CodeBoltClient();
Quick Reference
| Method | Description |
|---|---|
delete | Deletes a downloaded model from local storage. |
download | Initiates the download of a model for local execution. |
get | Retrieves detailed information about a specific local model. |
getAvailable | Retrieves the catalog of models available for local download and execution. |
list | Lists all models that have been downloaded to the local machine. |
load | Loads a downloaded model into system memory for inference. |
unload | Unloads a model from system memory. |
Methods
delete
client.localModels.delete(modelId: string): Promise<unknown>
Deletes a downloaded model from local storage.
Permanently removes the model files from disk, freeing storage space. The model must be unloaded from memory before deletion. It can be re-downloaded later if needed.
| Parameter | Type | Required | Description |
|---|---|---|---|
modelId | string | Yes | The unique identifier of the model to delete |
Returns: Promise<unknown> — A promise that resolves when the model has been removed from disk
download
client.localModels.download(data: DownloadLocalModelRequest): Promise<unknown>
Initiates the download of a model for local execution.
Starts an asynchronous download of the specified model. Large models may take significant time and disk space. Monitor download progress through status endpoints.
| Parameter | Type | Required | Description |
|---|---|---|---|
data | DownloadLocalModelRequest | Yes | The download request configuration |
Returns: Promise<unknown> — A promise that resolves when the download has been initiated
get
client.localModels.get(modelId: string): Promise<LocalModel>
Retrieves detailed information about a specific local model.
Returns comprehensive metadata for a model including its size, quantization level, architecture, and current status (downloaded, loaded, etc.).
| Parameter | Type | Required | Description |
|---|---|---|---|
modelId | string | Yes | The unique identifier of the model to retrieve |
Returns: Promise<LocalModel> — A promise that resolves to the model's detailed information
getAvailable
client.localModels.getAvailable(): Promise<LocalModel[]>
Retrieves the catalog of models available for local download and execution.
Returns all models that can be downloaded from supported registries (e.g., Ollama, GGUF) for local inference. Use this to browse what models are available before downloading.
No parameters.
Returns: Promise<LocalModel[]> — A promise that resolves to an array of available local models
list
client.localModels.list(): Promise<LocalModel[]>
Lists all models that have been downloaded to the local machine.
Returns metadata for models currently stored on disk, regardless of whether they are currently loaded into memory for inference.
No parameters.
Returns: Promise<LocalModel[]> — A promise that resolves to an array of downloaded local models
load
client.localModels.load(data: LoadLocalModelRequest): Promise<unknown>
Loads a downloaded model into system memory for inference.
Prepares a local model for use by loading its weights into RAM or VRAM. The model must be downloaded first. Once loaded, it can serve inference requests without additional startup latency.
| Parameter | Type | Required | Description |
|---|---|---|---|
data | LoadLocalModelRequest | Yes | The load request configuration |
Returns: Promise<unknown> — A promise that resolves when the model has been loaded into memory
unload
client.localModels.unload(data: UnloadLocalModelRequest): Promise<unknown>
Unloads a model from system memory.
Releases the memory (RAM/VRAM) occupied by a loaded model. The model remains on disk and can be loaded again later. Use this to free resources when a model is no longer needed.
| Parameter | Type | Required | Description |
|---|---|---|---|
data | UnloadLocalModelRequest | Yes | The unload request configuration |
Returns: Promise<unknown> — A promise that resolves when the model has been unloaded from memory