Skip to content

CustomModels

(llm.customModels)

Overview

Available Operations

listCustomModels

Retrieve a complete list of all registered custom models with their configurations, capabilities, and health status. Returns detailed information for each model including base URL, supported capabilities (chat, completion, embedding, image, transcription, speech), generation parameters (max tokens, context window, temperature, etc.), rate limits (RPM), availability status, and last health check results. Models are sorted by creation date (newest first). Admin authentication required.

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.customModels.listCustomModels();

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmCustomModelsListCustomModels } from "@meetkai/mka1/funcs/llmCustomModelsListCustomModels.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 llmCustomModelsListCustomModels(sdk);
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("llmCustomModelsListCustomModels 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.
  useLlmCustomModelsListCustomModels,
  useLlmCustomModelsListCustomModelsSuspense,

  // Utility for prefetching data during server-side rendering and in React
  // Server Components that will be immediately available to client components
  // using the hooks.
  prefetchLlmCustomModelsListCustomModels,
  
  // Utility to invalidate the query cache for this query in response to
  // mutations and other user actions.
  invalidateAllLlmCustomModelsListCustomModels,
} from "@meetkai/mka1/react-query/llmCustomModelsListCustomModels.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.ListCustomModelsResponseBody>

Errors

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

addCustomModel

Register a new custom language model by providing its API endpoint, capabilities, and configuration. Supports both OpenAI-compatible APIs and custom endpoints. Specify which capabilities the model supports (chat, completion, embedding, image generation, transcription, speech synthesis), set generation parameters (max tokens, context window, temperature, top-p, penalties), and configure rate limits (requests per minute). Before registration, the system automatically performs a health check for chat-capable models to verify connectivity and functionality. If the health check fails, registration is rejected with details about the error. Returns 409 conflict if a model with the same name already exists. The model is immediately available for use after successful registration. Admin authentication required.

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.customModels.addCustomModel({
    name: "<value>",
    baseUrl: "https://awesome-status.org/",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmCustomModelsAddCustomModel } from "@meetkai/mka1/funcs/llmCustomModelsAddCustomModel.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 llmCustomModelsAddCustomModel(sdk, {
    name: "<value>",
    baseUrl: "https://awesome-status.org/",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("llmCustomModelsAddCustomModel 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.
  useLlmCustomModelsAddCustomModelMutation
} from "@meetkai/mka1/react-query/llmCustomModelsAddCustomModel.js";

Parameters

ParameterTypeRequiredDescription
requestoperations.AddCustomModelRequestBody✔️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.AddCustomModelResponseBody>

Errors

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

getCustomModel

Retrieve detailed information about a specific custom model using its unique ID. Returns complete model configuration including name, base URL endpoint, supported capabilities (chat, completion, embedding, image, transcription, speech), all generation parameters (max tokens, context window, temperature, top-p, frequency and presence penalties), rate limit settings (RPM), current availability status, last health check timestamp, and any health check errors. Useful for viewing model configurations, troubleshooting connectivity issues, or auditing model settings. Returns 404 if the model ID doesn't exist. Admin authentication required.

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.customModels.getCustomModel({
    id: "<id>",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmCustomModelsGetCustomModel } from "@meetkai/mka1/funcs/llmCustomModelsGetCustomModel.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 llmCustomModelsGetCustomModel(sdk, {
    id: "<id>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("llmCustomModelsGetCustomModel 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.
  useLlmCustomModelsGetCustomModel,
  useLlmCustomModelsGetCustomModelSuspense,

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

Parameters

ParameterTypeRequiredDescription
requestoperations.GetCustomModelRequest✔️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.GetCustomModelResponseBody>

Errors

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

updateCustomModel

Update an existing custom model's configuration including endpoint URL, API key, capabilities, generation parameters, and rate limits. All fields are optional in the request body: omit a field to keep its current value, provide a new value to update it. The model name cannot be changed after registration. When updating the base URL, API key, or chat capability setting, the system automatically performs a health check to verify the new configuration works correctly before applying the changes. If the health check fails, the update is rejected with error details and the model retains its previous configuration. The provider registry is automatically updated after successful changes. Returns 404 if the model ID doesn't exist. Admin authentication required.

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.customModels.updateCustomModel({
    id: "<id>",
    requestBody: {},
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmCustomModelsUpdateCustomModel } from "@meetkai/mka1/funcs/llmCustomModelsUpdateCustomModel.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 llmCustomModelsUpdateCustomModel(sdk, {
    id: "<id>",
    requestBody: {},
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("llmCustomModelsUpdateCustomModel 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.
  useLlmCustomModelsUpdateCustomModelMutation
} from "@meetkai/mka1/react-query/llmCustomModelsUpdateCustomModel.js";

Parameters

ParameterTypeRequiredDescription
requestoperations.UpdateCustomModelRequest✔️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.UpdateCustomModelResponseBody>

Errors

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

deleteCustomModel

Permanently delete a custom model registration from the system. This removes the model from the provider registry, making it immediately unavailable for any new requests. Any in-flight requests using this model may fail. The operation cannot be undone - you'll need to re-register the model with all its configuration if you want to use it again. The provider registry is automatically updated to reflect the removal. Returns 404 if the model ID doesn't exist. Use this endpoint to clean up obsolete models, remove incorrectly configured models, or revoke access to specific model endpoints. Admin authentication required.

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.customModels.deleteCustomModel({
    id: "<id>",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmCustomModelsDeleteCustomModel } from "@meetkai/mka1/funcs/llmCustomModelsDeleteCustomModel.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 llmCustomModelsDeleteCustomModel(sdk, {
    id: "<id>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("llmCustomModelsDeleteCustomModel 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.
  useLlmCustomModelsDeleteCustomModelMutation
} from "@meetkai/mka1/react-query/llmCustomModelsDeleteCustomModel.js";

Parameters

ParameterTypeRequiredDescription
requestoperations.DeleteCustomModelRequest✔️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.DeleteCustomModelResponseBody>

Errors

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

healthCheckCustomModel

Manually trigger health checks for all registered custom models to verify their availability and functionality. The health check process runs asynchronously in the background (1 second delay after request) and tests each chat-capable model by sending a test completion request to its endpoint. Results are stored in each model's record including availability status, last check timestamp, and any error messages. This endpoint returns immediately with a success message while the actual checks run in the background. Use this to verify model connectivity after configuration changes, troubleshoot availability issues, or perform periodic health validations outside of the automatic scheduled checks. View the results by listing or retrieving individual models after the checks complete. Admin authentication required.

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.customModels.healthCheckCustomModel();

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { llmCustomModelsHealthCheckCustomModel } from "@meetkai/mka1/funcs/llmCustomModelsHealthCheckCustomModel.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 llmCustomModelsHealthCheckCustomModel(sdk);
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("llmCustomModelsHealthCheckCustomModel 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.
  useLlmCustomModelsHealthCheckCustomModelMutation
} from "@meetkai/mka1/react-query/llmCustomModelsHealthCheckCustomModel.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.HealthCheckCustomModelResponseBody>

Errors

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