Skip to content

Llm.Models

Overview

Available Operations

list

Lists the currently available models. Provides basic information about each model including its ID and owner.

Example Usage

typescript
import { SDK } from "@meetkai/mka1";

const sdk = new SDK({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await sdk.llm.models.list();

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmModelsList } from "@meetkai/mka1/funcs/llmModelsList.js";

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await llmModelsList(sdk);
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("llmModelsList failed:", res.error);
  }
}

run();

React hooks and utilities

This method can be used in React components through the following hooks and associated utilities.

Check out this guide for information about each of the utilities below and how to get started using React hooks.

tsx
import {
  // Query hooks for fetching data.
  useLlmModelsList,
  useLlmModelsListSuspense,

  // Utility for prefetching data during server-side rendering and in React
  // Server Components that will be immediately available to client components
  // using the hooks.
  prefetchLlmModelsList,
  
  // Utility to invalidate the query cache for this query in response to
  // mutations and other user actions.
  invalidateAllLlmModelsList,
} from "@meetkai/mka1/react-query/llmModelsList.js";

Parameters

ParameterTypeRequiredDescription
optionsRequestOptionsUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitOptions that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfigEnables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.ListModelsResponseBody>

Errors

Error TypeStatus CodeContent Type
errors.APIError4XX, 5XX*/*

get

Retrieves a model instance, providing basic information about the model such as the owner and supported capabilities.

Example Usage

typescript
import { SDK } from "@meetkai/mka1";

const sdk = new SDK({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await sdk.llm.models.get({
    modelId: "meetkai:functionary-urdu-mini-pak",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmModelsGet } from "@meetkai/mka1/funcs/llmModelsGet.js";

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await llmModelsGet(sdk, {
    modelId: "meetkai:functionary-urdu-mini-pak",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("llmModelsGet failed:", res.error);
  }
}

run();

React hooks and utilities

This method can be used in React components through the following hooks and associated utilities.

Check out this guide for information about each of the utilities below and how to get started using React hooks.

tsx
import {
  // Query hooks for fetching data.
  useLlmModelsGet,
  useLlmModelsGetSuspense,

  // Utility for prefetching data during server-side rendering and in React
  // Server Components that will be immediately available to client components
  // using the hooks.
  prefetchLlmModelsGet,
  
  // Utilities to invalidate the query cache for this query in response to
  // mutations and other user actions.
  invalidateLlmModelsGet,
  invalidateAllLlmModelsGet,
} from "@meetkai/mka1/react-query/llmModelsGet.js";

Parameters

ParameterTypeRequiredDescription
requestoperations.GetModelRequest✔️The request object to use for the request.
optionsRequestOptionsUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitOptions that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfigEnables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.GetModelResponseBody>

Errors

Error TypeStatus CodeContent Type
errors.APIError4XX, 5XX*/*

addRegistryModel

Adds a new database-sourced model to the registry. YAML models cannot be overridden.

Example Usage

typescript
import { SDK } from "@meetkai/mka1";

const sdk = new SDK({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await sdk.llm.models.addRegistryModel({
    id: "meetkai:my-custom-chat-v1",
    provider: "openai-compatible",
    modelId: "my-custom-chat-v1",
    displayName: "My Custom Chat v1",
    baseUrl: "https://models.example.com/v1",
    apiFormat: "responses",
    created: 1704067200,
    auth: {
      type: "api-key",
      envVar: "CUSTOM_MODEL_API_KEY",
    },
    capabilities: {
      modalities: {
        input: [
          "text",
        ],
        output: [
          "text",
        ],
      },
      reasoning: true,
      supportsTemperature: true,
      supportsTopP: true,
    },
    contextWindow: 131072,
    rpm: 120,
    defaultParams: {
      temperature: 0.2,
      topP: 0.95,
    },
    hidden: false,
    healthCheck: {
      url: "https://models.example.com/health",
      method: "GET",
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmModelsAddRegistryModel } from "@meetkai/mka1/funcs/llmModelsAddRegistryModel.js";

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await llmModelsAddRegistryModel(sdk, {
    id: "meetkai:my-custom-chat-v1",
    provider: "openai-compatible",
    modelId: "my-custom-chat-v1",
    displayName: "My Custom Chat v1",
    baseUrl: "https://models.example.com/v1",
    apiFormat: "responses",
    created: 1704067200,
    auth: {
      type: "api-key",
      envVar: "CUSTOM_MODEL_API_KEY",
    },
    capabilities: {
      modalities: {
        input: [
          "text",
        ],
        output: [
          "text",
        ],
      },
      reasoning: true,
      supportsTemperature: true,
      supportsTopP: true,
    },
    contextWindow: 131072,
    rpm: 120,
    defaultParams: {
      temperature: 0.2,
      topP: 0.95,
    },
    hidden: false,
    healthCheck: {
      url: "https://models.example.com/health",
      method: "GET",
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("llmModelsAddRegistryModel failed:", res.error);
  }
}

run();

React hooks and utilities

This method can be used in React components through the following hooks and associated utilities.

Check out this guide for information about each of the utilities below and how to get started using React hooks.

tsx
import {
  // Mutation hook for triggering the API call.
  useLlmModelsAddRegistryModelMutation
} from "@meetkai/mka1/react-query/llmModelsAddRegistryModel.js";

Parameters

ParameterTypeRequiredDescription
requestcomponents.AddRegistryModelRequest✔️The request object to use for the request.
optionsRequestOptionsUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitOptions that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfigEnables retrying HTTP requests under certain failure conditions.

Response

Promise<components.RegistryModelResponse>

Errors

Error TypeStatus CodeContent Type
errors.APIError4XX, 5XX*/*

listRegistryModels

Lists all models in the registry with full details including source and health status.

Example Usage

typescript
import { SDK } from "@meetkai/mka1";

const sdk = new SDK({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await sdk.llm.models.listRegistryModels();

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmModelsListRegistryModels } from "@meetkai/mka1/funcs/llmModelsListRegistryModels.js";

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await llmModelsListRegistryModels(sdk);
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("llmModelsListRegistryModels failed:", res.error);
  }
}

run();

React hooks and utilities

This method can be used in React components through the following hooks and associated utilities.

Check out this guide for information about each of the utilities below and how to get started using React hooks.

tsx
import {
  // Query hooks for fetching data.
  useLlmModelsListRegistryModels,
  useLlmModelsListRegistryModelsSuspense,

  // Utility for prefetching data during server-side rendering and in React
  // Server Components that will be immediately available to client components
  // using the hooks.
  prefetchLlmModelsListRegistryModels,
  
  // Utility to invalidate the query cache for this query in response to
  // mutations and other user actions.
  invalidateAllLlmModelsListRegistryModels,
} from "@meetkai/mka1/react-query/llmModelsListRegistryModels.js";

Parameters

ParameterTypeRequiredDescription
optionsRequestOptionsUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitOptions that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfigEnables retrying HTTP requests under certain failure conditions.

Response

Promise<components.RegistryModelListResponse>

Errors

Error TypeStatus CodeContent Type
errors.APIError4XX, 5XX*/*

updateRegistryModel

Partially updates a database-sourced model. Only provided fields are changed; omitted fields are preserved. YAML models cannot be updated.

Example Usage

typescript
import { SDK } from "@meetkai/mka1";

const sdk = new SDK({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await sdk.llm.models.updateRegistryModel({
    id: "meetkai:my-custom-chat-v1",
    updateRegistryModelRequest: {
      displayName: "My Custom Chat v2",
      rpm: 240,
      defaultParams: {
        temperature: 0.1,
        topP: 0.9,
      },
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmModelsUpdateRegistryModel } from "@meetkai/mka1/funcs/llmModelsUpdateRegistryModel.js";

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await llmModelsUpdateRegistryModel(sdk, {
    id: "meetkai:my-custom-chat-v1",
    updateRegistryModelRequest: {
      displayName: "My Custom Chat v2",
      rpm: 240,
      defaultParams: {
        temperature: 0.1,
        topP: 0.9,
      },
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("llmModelsUpdateRegistryModel failed:", res.error);
  }
}

run();

React hooks and utilities

This method can be used in React components through the following hooks and associated utilities.

Check out this guide for information about each of the utilities below and how to get started using React hooks.

tsx
import {
  // Mutation hook for triggering the API call.
  useLlmModelsUpdateRegistryModelMutation
} from "@meetkai/mka1/react-query/llmModelsUpdateRegistryModel.js";

Parameters

ParameterTypeRequiredDescription
requestoperations.UpdateRegistryModelRequest✔️The request object to use for the request.
optionsRequestOptionsUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitOptions that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfigEnables retrying HTTP requests under certain failure conditions.

Response

Promise<components.RegistryModelResponse>

Errors

Error TypeStatus CodeContent Type
errors.APIError4XX, 5XX*/*

removeRegistryModel

Removes a database-sourced model. YAML models cannot be removed.

Example Usage

typescript
import { SDK } from "@meetkai/mka1";

const sdk = new SDK({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await sdk.llm.models.removeRegistryModel({
    id: "meetkai:my-custom-chat-v1",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmModelsRemoveRegistryModel } from "@meetkai/mka1/funcs/llmModelsRemoveRegistryModel.js";

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await llmModelsRemoveRegistryModel(sdk, {
    id: "meetkai:my-custom-chat-v1",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("llmModelsRemoveRegistryModel failed:", res.error);
  }
}

run();

React hooks and utilities

This method can be used in React components through the following hooks and associated utilities.

Check out this guide for information about each of the utilities below and how to get started using React hooks.

tsx
import {
  // Mutation hook for triggering the API call.
  useLlmModelsRemoveRegistryModelMutation
} from "@meetkai/mka1/react-query/llmModelsRemoveRegistryModel.js";

Parameters

ParameterTypeRequiredDescription
requestoperations.RemoveRegistryModelRequest✔️The request object to use for the request.
optionsRequestOptionsUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitOptions that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfigEnables retrying HTTP requests under certain failure conditions.

Response

Promise<components.DeleteRegistryModelResponse>

Errors

Error TypeStatus CodeContent Type
errors.APIError4XX, 5XX*/*

getRegistryModel

Returns full model definition and health status for a specific model.

Example Usage

typescript
import { SDK } from "@meetkai/mka1";

const sdk = new SDK({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await sdk.llm.models.getRegistryModel({
    id: "meetkai:my-custom-chat-v1",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmModelsGetRegistryModel } from "@meetkai/mka1/funcs/llmModelsGetRegistryModel.js";

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await llmModelsGetRegistryModel(sdk, {
    id: "meetkai:my-custom-chat-v1",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("llmModelsGetRegistryModel failed:", res.error);
  }
}

run();

React hooks and utilities

This method can be used in React components through the following hooks and associated utilities.

Check out this guide for information about each of the utilities below and how to get started using React hooks.

tsx
import {
  // Query hooks for fetching data.
  useLlmModelsGetRegistryModel,
  useLlmModelsGetRegistryModelSuspense,

  // Utility for prefetching data during server-side rendering and in React
  // Server Components that will be immediately available to client components
  // using the hooks.
  prefetchLlmModelsGetRegistryModel,
  
  // Utilities to invalidate the query cache for this query in response to
  // mutations and other user actions.
  invalidateLlmModelsGetRegistryModel,
  invalidateAllLlmModelsGetRegistryModel,
} from "@meetkai/mka1/react-query/llmModelsGetRegistryModel.js";

Parameters

ParameterTypeRequiredDescription
requestoperations.GetRegistryModelRequest✔️The request object to use for the request.
optionsRequestOptionsUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitOptions that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfigEnables retrying HTTP requests under certain failure conditions.

Response

Promise<components.RegistryModelResponse>

Errors

Error TypeStatus CodeContent Type
errors.APIError4XX, 5XX*/*

checkRegistryModelHealth

Probes the model's provider endpoint and updates health status.

Example Usage

typescript
import { SDK } from "@meetkai/mka1";

const sdk = new SDK({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await sdk.llm.models.checkRegistryModelHealth({
    id: "meetkai:my-custom-chat-v1",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmModelsCheckRegistryModelHealth } from "@meetkai/mka1/funcs/llmModelsCheckRegistryModelHealth.js";

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await llmModelsCheckRegistryModelHealth(sdk, {
    id: "meetkai:my-custom-chat-v1",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("llmModelsCheckRegistryModelHealth failed:", res.error);
  }
}

run();

React hooks and utilities

This method can be used in React components through the following hooks and associated utilities.

Check out this guide for information about each of the utilities below and how to get started using React hooks.

tsx
import {
  // Mutation hook for triggering the API call.
  useLlmModelsCheckRegistryModelHealthMutation
} from "@meetkai/mka1/react-query/llmModelsCheckRegistryModelHealth.js";

Parameters

ParameterTypeRequiredDescription
requestoperations.CheckRegistryModelHealthRequest✔️The request object to use for the request.
optionsRequestOptionsUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitOptions that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfigEnables retrying HTTP requests under certain failure conditions.

Response

Promise<components.HealthCheckResponse>

Errors

Error TypeStatus CodeContent Type
errors.APIError4XX, 5XX*/*