MKA1 TypeScript SDK
Official TypeScript SDK for the MKA1 API.
Use @meetkai/mka1 to call MKA1 from Node.js, browsers, React apps, and agent tooling. The SDK includes typed clients for responses, agents, files, vector stores, evals, usage, model registry operations, guardrails, sandbox APIs, and more.
Full product and API documentation lives at docs.mka1.com.
Install
npm add @meetkai/mka1pnpm add @meetkai/mka1bun add @meetkai/mka1yarn add @meetkai/mka1The package ships both ESM and CommonJS builds. For supported runtimes, see RUNTIMES.md.
Quick Start
import { SDK } from "@meetkai/mka1";
const mka1 = new SDK({
bearerAuth: process.env.MKA1_API_KEY,
});
const models = await mka1.llm.models.list({});
console.log(models.data.map((model) => model.id));Most write APIs use the same client:
import { SDK } from "@meetkai/mka1";
const mka1 = new SDK({
bearerAuth: process.env.MKA1_API_KEY,
});
const response = await mka1.llm.responses.create({
responsesCreateRequest: {
model: "<MODEL_ID>",
input: "Summarize the latest MKA1 eval run.",
},
});
console.log(response);Authentication
Pass an MKA1 API key or bearer token when constructing the client:
const mka1 = new SDK({
bearerAuth: process.env.MKA1_API_KEY,
});You can also provide an async token resolver:
const mka1 = new SDK({
bearerAuth: async () => refreshMka1Token(),
});For account setup, API keys, and endpoint-specific examples, see docs.mka1.com.
Common Entry Points
mka1.llm.responses
mka1.llm.conversations
mka1.llm.files
mka1.llm.vectorStores
mka1.llm.evals
mka1.llm.models
mka1.llm.usage
mka1.agents
mka1.agentRuns
mka1.sandbox
mka1.permissionsThe generated method reference below lists every resource and operation included in this SDK.
React Query
React hooks are available from @meetkai/mka1/react-query. Install the optional peer dependencies only if you plan to use those hooks:
npm add @tanstack/react-query react react-domSee REACT_QUERY.md for provider setup, suspense hooks, invalidation helpers, and mutation examples.
MCP Server
This package also exposes the MKA1 API as an installable Model Context Protocol server.
Node.js v20 or newer is required for the MCP server.
{
"mcpServers": {
"mka1": {
"command": "npx",
"args": [
"-y",
"--package",
"@meetkai/mka1",
"--",
"mcp",
"start",
"--bearer-auth",
"..."
]
}
}
}For available server flags:
npx -y --package @meetkai/mka1 -- mcp start --helpAvailable Resources and Operations
Available methods
AgentRuns
- listAgentRuns - List runs for an agent
- createAgentRun - Start a saved agent run
- streamAgentRunEvents - Stream agent run events
- wakeAgentRun - Wake a sleeping agent run
- getAgentRun - Retrieve an agent run
AgentSchedules
- listAgentSchedules - List schedules for an agent
- createAgentSchedule - Create an agent schedule
- getAgentSchedule - Retrieve an agent schedule
- updateAgentSchedule - Update an agent schedule
- deleteAgentSchedule - Delete an agent schedule
- pauseAgentSchedule - Pause an agent schedule
- resumeAgentSchedule - Resume an agent schedule
Agents
- listAgents - List agents
- createAgent - Create an agent
- getAgent - Retrieve an agent
- updateAgent - Update an agent
- deleteAgent - Delete an agent
Auth.ApiKey
- getJwtFromKey - Exchange API key for a JWT token
Guardrails
- getGuardrails - Get guardrails settings
- updateGuardrails - Update guardrails settings
- testGuardrails - Test content against guardrails
Llm.Batches
Llm.Chat
createChat- [Deprecated] Chat completions for OpenAI SDK/client usage ⚠️ Deprecatedstream- [Deprecated] Streaming chat completions for generated SDK usage ⚠️ Deprecated
Llm.Classify
- classify - Classify text into predefined categories
Llm.Conversations
- create - Create a conversation
- list - List conversations
- get - Retrieve a conversation
- update - Update a conversation
- delete - Delete a conversation
- listItems - List conversation items
- createItems - Create conversation items
- deleteItems - Delete multiple conversation items
- getItem - Retrieve a conversation item
- deleteItem - Delete a conversation item
Llm.Embeddings
- listModels - List available embedding models
- embed - Create text embeddings
Llm.Evals
- createSuite - Create an eval suite
- listSuites - List eval suites
- getSuite - Get an eval suite
- deleteSuite - Delete an eval suite
- createSuiteVersion - Create an eval suite version
- listSuiteVersions - List eval suite versions
- getSuiteVersion - Get an eval suite version
- createRun - Create an eval run
- listRuns - List eval runs
- getRun - Get an eval run
- deleteRun - Delete an eval run
- cancelRun - Cancel an eval run
- rerunFailedSamples - Rerun failed eval samples
- retryFailedRun - Retry an eval run
- listSamples - List eval samples
- getArtifacts - Get eval run artifacts
- importHistoricalResults - Import historical eval results from Hugging Face
Llm.Extract
- extract - Extract structured data with inline JSON Schema
- createSchema - Create reusable extraction schema template
- getSchema - Get extraction schema by ID
- updateSchema - Update extraction schema by ID
- deleteSchema - Delete extraction schema by ID
- extractWithSchema - Extract data using saved schema template
Llm.Feedback
- createCompletionFeedback - Submit feedback for chat completion
- getCompletionFeedback - Retrieve feedback by completion ID
- updateCompletionFeedback - Update existing completion feedback
- batchGetCompletionFeedback - Batch retrieve feedback for multiple completions
- createResponseFeedback - Submit feedback for response
- getResponseFeedback - Retrieve feedback by response ID
- updateResponseFeedback - Update existing response feedback
- batchGetResponseFeedback - Batch retrieve feedback for multiple responses
- startExport - Start feedback export
- getExportStatus - Get feedback export status
Llm.Files
- upload - Upload file
- list - List files
- get - Retrieve file
- delete - Delete file
- content - Retrieve file content
Llm.FineTuning
- create - Create a fine-tuning job
- list - List fine-tuning jobs
- retrieve - Retrieve a fine-tuning job
- cancel - Cancel a fine-tuning job
- pause - Pause a fine-tuning job
- resume - Resume a fine-tuning job
- listEvents - List fine-tuning events
- listCheckpoints - List fine-tuning checkpoints
Llm.Images
- create - Generate images from text descriptions
Llm.McpVault
- createServer - Create MCP server
- listServers - List MCP servers
- getServer - Retrieve MCP server
- updateServer - Update MCP server
- deleteServer - Delete MCP server
- createCredential - Create MCP credential
- listCredentials - List MCP credentials
- deleteCredential - Delete MCP credential
- testServer - Test MCP server
Llm.MemoryStores
- create - Create memory store
- list - List memory stores
- get - Retrieve memory store
- update - Update memory store
- delete - Delete memory store
- createEntry - Create memory entry
- listEntries - List memory entries
- getEntry - Retrieve memory entry
- updateEntry - Update memory entry
- deleteEntry - Delete memory entry
Llm.Models
- list - List available models
- get - Retrieve a model
- addRegistryModel - Add a model to the registry
- listRegistryModels - List all registry models
- updateRegistryModel - Update a database model in the registry
- removeRegistryModel - Remove a database model from the registry
- getRegistryModel - Get a specific registry model
- checkRegistryModelHealth - Check health of a specific model
- listClusterRegistry - List the cluster registry catalog
- listClusterRegistryOrgGrants - List an org's cluster registry grants
- putClusterRegistryOrgGrants - Replace an org's cluster registry grants
- listOrgAutoModels - List this org's auto-model overrides
- putOrgAutoModel - Set this org's auto-model override for an endpoint
- deleteOrgAutoModel - Clear this org's auto-model override for an endpoint
Llm.Prompts
- create - Create a prompt
- list - List prompts
- get - Get a prompt
- update - Update a prompt
- delete - Delete a prompt
- createVersion - Create a new version
- listVersions - List versions
- getVersion - Get a specific version
- rollback - Rollback to a version
Llm.Responses
- create - Create an agent-powered response with tool support
- list - List all responses with pagination
- get - Retrieve response by ID with status and results
- update - Update a response
- delete - Permanently delete a response and its data
- cancel - Cancel an in-progress background response
- wake - Wake a sleeping background response
- listInputItems - List paginated input items for a response
- compact - Compact a conversation
Llm.Skills
- create - Create skill
- list - List skills
- get - Retrieve skill
- update - Update skill
- delete - Delete skill
- content - Download skill content
- createVersion - Create skill version
- listVersions - List skill versions
- getVersion - Retrieve skill version
- deleteVersion - Delete skill version
- versionContent - Download skill version content
- listPreconfigured - List preconfigured skills
Llm.Speech
- transcribe - Speech to text transcription
- speak - Text to speech
- speakStreaming - Streaming text to speech
- livekitToken - Generate LiveKit room token
- listTtsHistory - List text-to-speech history
- getTtsHistory - Retrieve text-to-speech history item
- deleteTtsHistory - Delete text-to-speech history item
- getTtsHistoryContent - Retrieve text-to-speech audio
- listTranscriptionHistory - List speech-to-text history
- getTranscriptionHistory - Retrieve speech-to-text history item
- deleteTranscriptionHistory - Delete speech-to-text history item
- getTranscriptionHistoryContent - Retrieve speech-to-text audio
Llm.Usage
- completions - Get completions usage
- responses - Get responses usage
- conversations - Get conversations usage
- embeddings - Get embeddings usage
- extract - Get extract usage
- classify - Get classify usage
- vectorStores - Get vector stores usage
- files - Get files usage
Llm.VectorStores
- create - Create a vector store
- list - List vector stores
- get - Retrieve a vector store
- update - Modify a vector store
- delete - Delete a vector store
- search - Search a vector store
- createFile - Add a file to a vector store
- listFiles - List files in a vector store
- getFile - Retrieve a vector store file
- updateFile - Update file attributes
- deleteFile - Remove file from vector store
- getFileContent - Retrieve parsed file content
- createFileBatch - Batch add multiple files to vector store
- getFileBatch - Retrieve file batch status
- cancelFileBatch - Cancel batch file processing
- listFilesInBatch - List files in a batch
Permissions.Llm
- grant - Grant permission to a user or make public
- revoke - Revoke permission from a user or remove public access
- check - Check user permission
Sandbox
- create - Create Session
- list - List Sessions
- get - Get Session
- getUrl - Get Session URL
- proxyBrowserPortRequest - Proxy Browser Port Request
- runCommand - Run Command
- runCode - Run Code
- terminate - Terminate Session
- getWorkspace - Get Workspace Manifest
- downloadFile - Download Workspace File
- uploadFile - Upload Workspace File
- downloadArchive - Download Workspace Archive
- uploadArchive - Upload Workspace Archive
SandboxUsage
- getUsageApiV1SandboxUsageGet - Get Usage
Search.Graphrag
- createGraphRAGStore - Create Store
- ingestGraphRAGDocuments - Ingest Documents
- queryGraphRAGStore - Query Store
- inspectGraphRAGStore - Inspect Graph
- deleteGraphRAGStore - Delete Store
Search.Tables
- createTable - Create Table
- getTableSchema - Get Table Schema
- deleteTable - Delete Table
- insertData - Insert Data
- deleteData - Delete Data
- searchData - Search
- createIndices - Create Indices
- listIndices - List Indices
- dropIndex - Drop Index
Search.TextStore
- createTextStore - Create Store
- addTexts - Add Texts
- deleteTexts - Delete Texts
- searchTexts - Search Texts
- deleteTextStore - Delete Store
Standalone functions
All the methods listed above are available as standalone functions. These functions are ideal for use in applications running in the browser, serverless runtimes or other environments where application bundle size is a primary concern. When using a bundler to build your application, all unused functionality will be either excluded from the final bundle or tree-shaken away.
To read more about standalone functions, check FUNCTIONS.md.
Available standalone functions
agentRunsCreateAgentRun- Start a saved agent runagentRunsGetAgentRun- Retrieve an agent runagentRunsListAgentRuns- List runs for an agentagentRunsStreamAgentRunEvents- Stream agent run eventsagentRunsWakeAgentRun- Wake a sleeping agent runagentSchedulesCreateAgentSchedule- Create an agent scheduleagentSchedulesDeleteAgentSchedule- Delete an agent scheduleagentSchedulesGetAgentSchedule- Retrieve an agent scheduleagentSchedulesListAgentSchedules- List schedules for an agentagentSchedulesPauseAgentSchedule- Pause an agent scheduleagentSchedulesResumeAgentSchedule- Resume an agent scheduleagentSchedulesUpdateAgentSchedule- Update an agent scheduleagentsCreateAgent- Create an agentagentsDeleteAgent- Delete an agentagentsGetAgent- Retrieve an agentagentsListAgents- List agentsagentsUpdateAgent- Update an agentauthApiKeyGetJwtFromKey- Exchange API key for a JWT tokenguardrailsGetGuardrails- Get guardrails settingsguardrailsTestGuardrails- Test content against guardrailsguardrailsUpdateGuardrails- Update guardrails settingsllmBatchesCancel- Cancel a batchllmBatchesCreate- Create a batchllmBatchesGet- Get a batchllmBatchesList- List batchesllmClassifyClassify- Classify text into predefined categoriesllmConversationsCreate- Create a conversationllmConversationsCreateItems- Create conversation itemsllmConversationsDelete- Delete a conversationllmConversationsDeleteItem- Delete a conversation itemllmConversationsDeleteItems- Delete multiple conversation itemsllmConversationsGet- Retrieve a conversationllmConversationsGetItem- Retrieve a conversation itemllmConversationsList- List conversationsllmConversationsListItems- List conversation itemsllmConversationsUpdate- Update a conversationllmEmbeddingsEmbed- Create text embeddingsllmEmbeddingsListModels- List available embedding modelsllmEvalsCancelRun- Cancel an eval runllmEvalsCreateRun- Create an eval runllmEvalsCreateSuite- Create an eval suitellmEvalsCreateSuiteVersion- Create an eval suite versionllmEvalsDeleteRun- Delete an eval runllmEvalsDeleteSuite- Delete an eval suitellmEvalsGetArtifacts- Get eval run artifactsllmEvalsGetRun- Get an eval runllmEvalsGetSuite- Get an eval suitellmEvalsGetSuiteVersion- Get an eval suite versionllmEvalsImportHistoricalResults- Import historical eval results from Hugging FacellmEvalsListRuns- List eval runsllmEvalsListSamples- List eval samplesllmEvalsListSuites- List eval suitesllmEvalsListSuiteVersions- List eval suite versionsllmEvalsRerunFailedSamples- Rerun failed eval samplesllmEvalsRetryFailedRun- Retry an eval runllmExtractCreateSchema- Create reusable extraction schema templatellmExtractDeleteSchema- Delete extraction schema by IDllmExtractExtract- Extract structured data with inline JSON SchemallmExtractExtractWithSchema- Extract data using saved schema templatellmExtractGetSchema- Get extraction schema by IDllmExtractUpdateSchema- Update extraction schema by IDllmFeedbackBatchGetCompletionFeedback- Batch retrieve feedback for multiple completionsllmFeedbackBatchGetResponseFeedback- Batch retrieve feedback for multiple responsesllmFeedbackCreateCompletionFeedback- Submit feedback for chat completionllmFeedbackCreateResponseFeedback- Submit feedback for responsellmFeedbackGetCompletionFeedback- Retrieve feedback by completion IDllmFeedbackGetExportStatus- Get feedback export statusllmFeedbackGetResponseFeedback- Retrieve feedback by response IDllmFeedbackStartExport- Start feedback exportllmFeedbackUpdateCompletionFeedback- Update existing completion feedbackllmFeedbackUpdateResponseFeedback- Update existing response feedbackllmFilesContent- Retrieve file contentllmFilesDelete- Delete filellmFilesGet- Retrieve filellmFilesList- List filesllmFilesUpload- Upload filellmFineTuningCancel- Cancel a fine-tuning jobllmFineTuningCreate- Create a fine-tuning jobllmFineTuningList- List fine-tuning jobsllmFineTuningListCheckpoints- List fine-tuning checkpointsllmFineTuningListEvents- List fine-tuning eventsllmFineTuningPause- Pause a fine-tuning jobllmFineTuningResume- Resume a fine-tuning jobllmFineTuningRetrieve- Retrieve a fine-tuning jobllmImagesCreate- Generate images from text descriptionsllmMcpVaultCreateCredential- Create MCP credentialllmMcpVaultCreateServer- Create MCP serverllmMcpVaultDeleteCredential- Delete MCP credentialllmMcpVaultDeleteServer- Delete MCP serverllmMcpVaultGetServer- Retrieve MCP serverllmMcpVaultListCredentials- List MCP credentialsllmMcpVaultListServers- List MCP serversllmMcpVaultTestServer- Test MCP serverllmMcpVaultUpdateServer- Update MCP serverllmMemoryStoresCreate- Create memory storellmMemoryStoresCreateEntry- Create memory entryllmMemoryStoresDelete- Delete memory storellmMemoryStoresDeleteEntry- Delete memory entryllmMemoryStoresGet- Retrieve memory storellmMemoryStoresGetEntry- Retrieve memory entryllmMemoryStoresList- List memory storesllmMemoryStoresListEntries- List memory entriesllmMemoryStoresUpdate- Update memory storellmMemoryStoresUpdateEntry- Update memory entryllmModelsAddRegistryModel- Add a model to the registryllmModelsCheckRegistryModelHealth- Check health of a specific modelllmModelsDeleteOrgAutoModel- Clear this org's auto-model override for an endpointllmModelsGet- Retrieve a modelllmModelsGetRegistryModel- Get a specific registry modelllmModelsList- List available modelsllmModelsListClusterRegistry- List the cluster registry catalogllmModelsListClusterRegistryOrgGrants- List an org's cluster registry grantsllmModelsListOrgAutoModels- List this org's auto-model overridesllmModelsListRegistryModels- List all registry modelsllmModelsPutClusterRegistryOrgGrants- Replace an org's cluster registry grantsllmModelsPutOrgAutoModel- Set this org's auto-model override for an endpointllmModelsRemoveRegistryModel- Remove a database model from the registryllmModelsUpdateRegistryModel- Update a database model in the registryllmPromptsCreate- Create a promptllmPromptsCreateVersion- Create a new versionllmPromptsDelete- Delete a promptllmPromptsGet- Get a promptllmPromptsGetVersion- Get a specific versionllmPromptsList- List promptsllmPromptsListVersions- List versionsllmPromptsRollback- Rollback to a versionllmPromptsUpdate- Update a promptllmResponsesCancel- Cancel an in-progress background responsellmResponsesCompact- Compact a conversationllmResponsesCreate- Create an agent-powered response with tool supportllmResponsesDelete- Permanently delete a response and its datallmResponsesGet- Retrieve response by ID with status and resultsllmResponsesList- List all responses with paginationllmResponsesListInputItems- List paginated input items for a responsellmResponsesUpdate- Update a responsellmResponsesWake- Wake a sleeping background responsellmSkillsContent- Download skill contentllmSkillsCreate- Create skillllmSkillsCreateVersion- Create skill versionllmSkillsDelete- Delete skillllmSkillsDeleteVersion- Delete skill versionllmSkillsGet- Retrieve skillllmSkillsGetVersion- Retrieve skill versionllmSkillsList- List skillsllmSkillsListPreconfigured- List preconfigured skillsllmSkillsListVersions- List skill versionsllmSkillsUpdate- Update skillllmSkillsVersionContent- Download skill version contentllmSpeechDeleteTranscriptionHistory- Delete speech-to-text history itemllmSpeechDeleteTtsHistory- Delete text-to-speech history itemllmSpeechGetTranscriptionHistory- Retrieve speech-to-text history itemllmSpeechGetTranscriptionHistoryContent- Retrieve speech-to-text audiollmSpeechGetTtsHistory- Retrieve text-to-speech history itemllmSpeechGetTtsHistoryContent- Retrieve text-to-speech audiollmSpeechListTranscriptionHistory- List speech-to-text historyllmSpeechListTtsHistory- List text-to-speech historyllmSpeechLivekitToken- Generate LiveKit room tokenllmSpeechSpeak- Text to speechllmSpeechSpeakStreaming- Streaming text to speechllmSpeechTranscribe- Speech to text transcriptionllmUsageClassify- Get classify usagellmUsageCompletions- Get completions usagellmUsageConversations- Get conversations usagellmUsageEmbeddings- Get embeddings usagellmUsageExtract- Get extract usagellmUsageFiles- Get files usagellmUsageResponses- Get responses usagellmUsageVectorStores- Get vector stores usagellmVectorStoresCancelFileBatch- Cancel batch file processingllmVectorStoresCreate- Create a vector storellmVectorStoresCreateFile- Add a file to a vector storellmVectorStoresCreateFileBatch- Batch add multiple files to vector storellmVectorStoresDelete- Delete a vector storellmVectorStoresDeleteFile- Remove file from vector storellmVectorStoresGet- Retrieve a vector storellmVectorStoresGetFile- Retrieve a vector store filellmVectorStoresGetFileBatch- Retrieve file batch statusllmVectorStoresGetFileContent- Retrieve parsed file contentllmVectorStoresList- List vector storesllmVectorStoresListFiles- List files in a vector storellmVectorStoresListFilesInBatch- List files in a batchllmVectorStoresSearch- Search a vector storellmVectorStoresUpdate- Modify a vector storellmVectorStoresUpdateFile- Update file attributespermissionsLlmCheck- Check user permissionpermissionsLlmGrant- Grant permission to a user or make publicpermissionsLlmRevoke- Revoke permission from a user or remove public accesssandboxCreate- Create SessionsandboxDownloadArchive- Download Workspace ArchivesandboxDownloadFile- Download Workspace FilesandboxGet- Get SessionsandboxGetUrl- Get Session URLsandboxGetWorkspace- Get Workspace ManifestsandboxList- List SessionssandboxProxyBrowserPortRequest- Proxy Browser Port RequestsandboxRunCode- Run CodesandboxRunCommand- Run CommandsandboxTerminate- Terminate SessionsandboxUploadArchive- Upload Workspace ArchivesandboxUploadFile- Upload Workspace FilesandboxUsageGetUsageApiV1SandboxUsageGet- Get UsagesearchGraphragCreateGraphRAGStore- Create StoresearchGraphragDeleteGraphRAGStore- Delete StoresearchGraphragIngestGraphRAGDocuments- Ingest DocumentssearchGraphragInspectGraphRAGStore- Inspect GraphsearchGraphragQueryGraphRAGStore- Query StoresearchTablesCreateIndices- Create IndicessearchTablesCreateTable- Create TablesearchTablesDeleteData- Delete DatasearchTablesDeleteTable- Delete TablesearchTablesDropIndex- Drop IndexsearchTablesGetTableSchema- Get Table SchemasearchTablesInsertData- Insert DatasearchTablesListIndices- List IndicessearchTablesSearchData- SearchsearchTextStoreAddTexts- Add TextssearchTextStoreCreateTextStore- Create StoresearchTextStoreDeleteTexts- Delete TextssearchTextStoreDeleteTextStore- Delete StoresearchTextStoreSearchTexts- Search Texts- [Deprecated] Chat completions for OpenAI SDK/client usage ⚠️ DeprecatedllmChatCreateChat- [Deprecated] Streaming chat completions for generated SDK usage ⚠️ DeprecatedllmChatStream
React hooks with TanStack Query
React hooks built on TanStack Query are included in this SDK. These hooks and the utility functions provided alongside them can be used to build rich applications that pull data from the API using one of the most popular asynchronous state management library.
To learn about this feature and how to get started, check REACT_QUERY.md.
WARNING
This feature is currently in preview and is subject to breaking changes within the current major version of the SDK as we gather user feedback on it.
Available React hooks
useAgentRunsCreateAgentRunMutation- Start a saved agent runuseAgentRunsGetAgentRun- Retrieve an agent runuseAgentRunsListAgentRuns- List runs for an agentuseAgentRunsStreamAgentRunEvents- Stream agent run eventsuseAgentRunsWakeAgentRunMutation- Wake a sleeping agent runuseAgentSchedulesCreateAgentScheduleMutation- Create an agent scheduleuseAgentSchedulesDeleteAgentScheduleMutation- Delete an agent scheduleuseAgentSchedulesGetAgentSchedule- Retrieve an agent scheduleuseAgentSchedulesListAgentSchedules- List schedules for an agentuseAgentSchedulesPauseAgentScheduleMutation- Pause an agent scheduleuseAgentSchedulesResumeAgentScheduleMutation- Resume an agent scheduleuseAgentSchedulesUpdateAgentScheduleMutation- Update an agent scheduleuseAgentsCreateAgentMutation- Create an agentuseAgentsDeleteAgentMutation- Delete an agentuseAgentsGetAgent- Retrieve an agentuseAgentsListAgents- List agentsuseAgentsUpdateAgentMutation- Update an agentuseAuthApiKeyGetJwtFromKeyMutation- Exchange API key for a JWT tokenuseGuardrailsGetGuardrails- Get guardrails settingsuseGuardrailsTestGuardrailsMutation- Test content against guardrailsuseGuardrailsUpdateGuardrailsMutation- Update guardrails settingsuseLlmBatchesCancelMutation- Cancel a batchuseLlmBatchesCreateMutation- Create a batchuseLlmBatchesGet- Get a batchuseLlmBatchesList- List batchesuseLlmClassifyClassifyMutation- Classify text into predefined categoriesuseLlmConversationsCreateItemsMutation- Create conversation itemsuseLlmConversationsCreateMutation- Create a conversationuseLlmConversationsDeleteItemMutation- Delete a conversation itemuseLlmConversationsDeleteItemsMutation- Delete multiple conversation itemsuseLlmConversationsDeleteMutation- Delete a conversationuseLlmConversationsGet- Retrieve a conversationuseLlmConversationsGetItem- Retrieve a conversation itemuseLlmConversationsList- List conversationsuseLlmConversationsListItems- List conversation itemsuseLlmConversationsUpdateMutation- Update a conversationuseLlmEmbeddingsEmbedMutation- Create text embeddingsuseLlmEmbeddingsListModels- List available embedding modelsuseLlmEvalsCancelRunMutation- Cancel an eval runuseLlmEvalsCreateRunMutation- Create an eval runuseLlmEvalsCreateSuiteMutation- Create an eval suiteuseLlmEvalsCreateSuiteVersionMutation- Create an eval suite versionuseLlmEvalsDeleteRunMutation- Delete an eval runuseLlmEvalsDeleteSuiteMutation- Delete an eval suiteuseLlmEvalsGetArtifacts- Get eval run artifactsuseLlmEvalsGetRun- Get an eval runuseLlmEvalsGetSuite- Get an eval suiteuseLlmEvalsGetSuiteVersion- Get an eval suite versionuseLlmEvalsImportHistoricalResultsMutation- Import historical eval results from Hugging FaceuseLlmEvalsListRuns- List eval runsuseLlmEvalsListSamples- List eval samplesuseLlmEvalsListSuites- List eval suitesuseLlmEvalsListSuiteVersions- List eval suite versionsuseLlmEvalsRerunFailedSamplesMutation- Rerun failed eval samplesuseLlmEvalsRetryFailedRunMutation- Retry an eval runuseLlmExtractCreateSchemaMutation- Create reusable extraction schema templateuseLlmExtractDeleteSchemaMutation- Delete extraction schema by IDuseLlmExtractExtractMutation- Extract structured data with inline JSON SchemauseLlmExtractExtractWithSchemaMutation- Extract data using saved schema templateuseLlmExtractGetSchema- Get extraction schema by IDuseLlmExtractUpdateSchemaMutation- Update extraction schema by IDuseLlmFeedbackBatchGetCompletionFeedbackMutation- Batch retrieve feedback for multiple completionsuseLlmFeedbackBatchGetResponseFeedbackMutation- Batch retrieve feedback for multiple responsesuseLlmFeedbackCreateCompletionFeedbackMutation- Submit feedback for chat completionuseLlmFeedbackCreateResponseFeedbackMutation- Submit feedback for responseuseLlmFeedbackGetCompletionFeedback- Retrieve feedback by completion IDuseLlmFeedbackGetExportStatus- Get feedback export statususeLlmFeedbackGetResponseFeedback- Retrieve feedback by response IDuseLlmFeedbackStartExportMutation- Start feedback exportuseLlmFeedbackUpdateCompletionFeedbackMutation- Update existing completion feedbackuseLlmFeedbackUpdateResponseFeedbackMutation- Update existing response feedbackuseLlmFilesContent- Retrieve file contentuseLlmFilesDeleteMutation- Delete fileuseLlmFilesGet- Retrieve fileuseLlmFilesList- List filesuseLlmFilesUploadMutation- Upload fileuseLlmFineTuningCancelMutation- Cancel a fine-tuning jobuseLlmFineTuningCreateMutation- Create a fine-tuning jobuseLlmFineTuningList- List fine-tuning jobsuseLlmFineTuningListCheckpoints- List fine-tuning checkpointsuseLlmFineTuningListEvents- List fine-tuning eventsuseLlmFineTuningPauseMutation- Pause a fine-tuning jobuseLlmFineTuningResumeMutation- Resume a fine-tuning jobuseLlmFineTuningRetrieve- Retrieve a fine-tuning jobuseLlmImagesCreateMutation- Generate images from text descriptionsuseLlmMcpVaultCreateCredentialMutation- Create MCP credentialuseLlmMcpVaultCreateServerMutation- Create MCP serveruseLlmMcpVaultDeleteCredentialMutation- Delete MCP credentialuseLlmMcpVaultDeleteServerMutation- Delete MCP serveruseLlmMcpVaultGetServer- Retrieve MCP serveruseLlmMcpVaultListCredentials- List MCP credentialsuseLlmMcpVaultListServers- List MCP serversuseLlmMcpVaultTestServerMutation- Test MCP serveruseLlmMcpVaultUpdateServerMutation- Update MCP serveruseLlmMemoryStoresCreateEntryMutation- Create memory entryuseLlmMemoryStoresCreateMutation- Create memory storeuseLlmMemoryStoresDeleteEntryMutation- Delete memory entryuseLlmMemoryStoresDeleteMutation- Delete memory storeuseLlmMemoryStoresGet- Retrieve memory storeuseLlmMemoryStoresGetEntry- Retrieve memory entryuseLlmMemoryStoresList- List memory storesuseLlmMemoryStoresListEntries- List memory entriesuseLlmMemoryStoresUpdateEntryMutation- Update memory entryuseLlmMemoryStoresUpdateMutation- Update memory storeuseLlmModelsAddRegistryModelMutation- Add a model to the registryuseLlmModelsCheckRegistryModelHealthMutation- Check health of a specific modeluseLlmModelsDeleteOrgAutoModelMutation- Clear this org's auto-model override for an endpointuseLlmModelsGet- Retrieve a modeluseLlmModelsGetRegistryModel- Get a specific registry modeluseLlmModelsList- List available modelsuseLlmModelsListClusterRegistry- List the cluster registry cataloguseLlmModelsListClusterRegistryOrgGrants- List an org's cluster registry grantsuseLlmModelsListOrgAutoModels- List this org's auto-model overridesuseLlmModelsListRegistryModels- List all registry modelsuseLlmModelsPutClusterRegistryOrgGrantsMutation- Replace an org's cluster registry grantsuseLlmModelsPutOrgAutoModelMutation- Set this org's auto-model override for an endpointuseLlmModelsRemoveRegistryModelMutation- Remove a database model from the registryuseLlmModelsUpdateRegistryModelMutation- Update a database model in the registryuseLlmPromptsCreateMutation- Create a promptuseLlmPromptsCreateVersionMutation- Create a new versionuseLlmPromptsDeleteMutation- Delete a promptuseLlmPromptsGet- Get a promptuseLlmPromptsGetVersion- Get a specific versionuseLlmPromptsList- List promptsuseLlmPromptsListVersions- List versionsuseLlmPromptsRollbackMutation- Rollback to a versionuseLlmPromptsUpdateMutation- Update a promptuseLlmResponsesCancelMutation- Cancel an in-progress background responseuseLlmResponsesCompactMutation- Compact a conversationuseLlmResponsesCreateMutation- Create an agent-powered response with tool supportuseLlmResponsesDeleteMutation- Permanently delete a response and its datauseLlmResponsesGet- Retrieve response by ID with status and resultsuseLlmResponsesList- List all responses with paginationuseLlmResponsesListInputItems- List paginated input items for a responseuseLlmResponsesUpdateMutation- Update a responseuseLlmResponsesWakeMutation- Wake a sleeping background responseuseLlmSkillsContent- Download skill contentuseLlmSkillsCreateMutation- Create skilluseLlmSkillsCreateVersionMutation- Create skill versionuseLlmSkillsDeleteMutation- Delete skilluseLlmSkillsDeleteVersionMutation- Delete skill versionuseLlmSkillsGet- Retrieve skilluseLlmSkillsGetVersion- Retrieve skill versionuseLlmSkillsList- List skillsuseLlmSkillsListPreconfigured- List preconfigured skillsuseLlmSkillsListVersions- List skill versionsuseLlmSkillsUpdateMutation- Update skilluseLlmSkillsVersionContent- Download skill version contentuseLlmSpeechDeleteTranscriptionHistoryMutation- Delete speech-to-text history itemuseLlmSpeechDeleteTtsHistoryMutation- Delete text-to-speech history itemuseLlmSpeechGetTranscriptionHistory- Retrieve speech-to-text history itemuseLlmSpeechGetTranscriptionHistoryContent- Retrieve speech-to-text audiouseLlmSpeechGetTtsHistory- Retrieve text-to-speech history itemuseLlmSpeechGetTtsHistoryContent- Retrieve text-to-speech audiouseLlmSpeechListTranscriptionHistory- List speech-to-text historyuseLlmSpeechListTtsHistory- List text-to-speech historyuseLlmSpeechLivekitTokenMutation- Generate LiveKit room tokenuseLlmSpeechSpeakMutation- Text to speechuseLlmSpeechSpeakStreamingMutation- Streaming text to speechuseLlmSpeechTranscribeMutation- Speech to text transcriptionuseLlmUsageClassify- Get classify usageuseLlmUsageCompletions- Get completions usageuseLlmUsageConversations- Get conversations usageuseLlmUsageEmbeddings- Get embeddings usageuseLlmUsageExtract- Get extract usageuseLlmUsageFiles- Get files usageuseLlmUsageResponses- Get responses usageuseLlmUsageVectorStores- Get vector stores usageuseLlmVectorStoresCancelFileBatchMutation- Cancel batch file processinguseLlmVectorStoresCreateFileBatchMutation- Batch add multiple files to vector storeuseLlmVectorStoresCreateFileMutation- Add a file to a vector storeuseLlmVectorStoresCreateMutation- Create a vector storeuseLlmVectorStoresDeleteFileMutation- Remove file from vector storeuseLlmVectorStoresDeleteMutation- Delete a vector storeuseLlmVectorStoresGet- Retrieve a vector storeuseLlmVectorStoresGetFile- Retrieve a vector store fileuseLlmVectorStoresGetFileBatch- Retrieve file batch statususeLlmVectorStoresGetFileContent- Retrieve parsed file contentuseLlmVectorStoresList- List vector storesuseLlmVectorStoresListFiles- List files in a vector storeuseLlmVectorStoresListFilesInBatch- List files in a batchuseLlmVectorStoresSearchMutation- Search a vector storeuseLlmVectorStoresUpdateFileMutation- Update file attributesuseLlmVectorStoresUpdateMutation- Modify a vector storeusePermissionsLlmCheck- Check user permissionusePermissionsLlmGrantMutation- Grant permission to a user or make publicusePermissionsLlmRevokeMutation- Revoke permission from a user or remove public accessuseSandboxCreateMutation- Create SessionuseSandboxDownloadArchiveMutation- Download Workspace ArchiveuseSandboxDownloadFile- Download Workspace FileuseSandboxGet- Get SessionuseSandboxGetUrl- Get Session URLuseSandboxGetWorkspace- Get Workspace ManifestuseSandboxList- List SessionsuseSandboxProxyBrowserPortRequest- Proxy Browser Port RequestuseSandboxRunCodeMutation- Run CodeuseSandboxRunCommandMutation- Run CommanduseSandboxTerminateMutation- Terminate SessionuseSandboxUploadArchiveMutation- Upload Workspace ArchiveuseSandboxUploadFileMutation- Upload Workspace FileuseSandboxUsageGetUsageApiV1SandboxUsageGet- Get UsageuseSearchGraphragCreateGraphRAGStoreMutation- Create StoreuseSearchGraphragDeleteGraphRAGStoreMutation- Delete StoreuseSearchGraphragIngestGraphRAGDocumentsMutation- Ingest DocumentsuseSearchGraphragInspectGraphRAGStore- Inspect GraphuseSearchGraphragQueryGraphRAGStoreMutation- Query StoreuseSearchTablesCreateIndicesMutation- Create IndicesuseSearchTablesCreateTableMutation- Create TableuseSearchTablesDeleteDataMutation- Delete DatauseSearchTablesDeleteTableMutation- Delete TableuseSearchTablesDropIndexMutation- Drop IndexuseSearchTablesGetTableSchema- Get Table SchemauseSearchTablesInsertDataMutation- Insert DatauseSearchTablesListIndices- List IndicesuseSearchTablesSearchDataMutation- SearchuseSearchTextStoreAddTextsMutation- Add TextsuseSearchTextStoreCreateTextStoreMutation- Create StoreuseSearchTextStoreDeleteTextsMutation- Delete TextsuseSearchTextStoreDeleteTextStoreMutation- Delete StoreuseSearchTextStoreSearchTextsMutation- Search Texts- [Deprecated] Chat completions for OpenAI SDK/client usage ⚠️ DeprecateduseLlmChatCreateChatMutation- [Deprecated] Streaming chat completions for generated SDK usage ⚠️ DeprecateduseLlmChatStreamMutation
Server-sent event streaming
Server-sent events are used to stream content from certain operations. These operations will expose the stream as an async iterable that can be consumed using a for await...of loop. The loop will terminate when the server no longer has any events to send and closes the underlying connection.
import { SDK } from "@meetkai/mka1";
const sdk = new SDK({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await sdk.llm.responses.create({
responsesCreateRequest: {
model: "meetkai:functionary-urdu-mini-pak",
input: "What is the capital of France?",
},
});
console.log(result);
}
run();File uploads
Certain SDK methods accept files as part of a multi-part request. It is possible and typically recommended to upload files as a stream rather than reading the entire contents into memory. This avoids excessive memory consumption and potentially crashing with out-of-memory errors when working with very large files. The following example demonstrates how to attach a file stream to a request.
TIP
Depending on your JavaScript runtime, there are convenient utilities that return a handle to a file without reading the entire contents into memory:
- Node.js v20+: Since v20, Node.js comes with a native
openAsBlobfunction innode:fs. - Bun: The native
Bun.filefunction produces a file handle that can be used for streaming file uploads. - Browsers: All supported browsers return an instance to a
Filewhen reading the value from an<input type="file">element. - Node.js v18: A file stream can be created using the
fileFromhelper fromfetch-blob/from.js.
import { SDK } from "@meetkai/mka1";
import { openAsBlob } from "node:fs";
const sdk = new SDK({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await sdk.llm.files.upload({
requestBody: {
file: await openAsBlob("example.file"),
purpose: "assistants",
},
});
console.log(result);
}
run();Retries
Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.
To change the default retry strategy for a single API call, simply provide a retryConfig object to the call:
import { SDK } from "@meetkai/mka1";
const sdk = new SDK({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
await sdk.permissions.llm.grant({
grantPermissionRequest: {
resourceType: "completion",
resourceId: "my-completion-123",
userId: "user-abc456",
role: "writer",
},
}, {
retries: {
strategy: "backoff",
backoff: {
initialInterval: 1,
maxInterval: 50,
exponent: 1.1,
maxElapsedTime: 100,
},
retryConnectionErrors: false,
},
});
}
run();If you'd like to override the default retry strategy for all operations that support retries, you can provide a retryConfig at SDK initialization:
import { SDK } from "@meetkai/mka1";
const sdk = new SDK({
retryConfig: {
strategy: "backoff",
backoff: {
initialInterval: 1,
maxInterval: 50,
exponent: 1.1,
maxElapsedTime: 100,
},
retryConnectionErrors: false,
},
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
await sdk.permissions.llm.grant({
grantPermissionRequest: {
resourceType: "completion",
resourceId: "my-completion-123",
userId: "user-abc456",
role: "writer",
},
});
}
run();Error Handling
SDKError is the base class for all HTTP error responses. It has the following properties:
| Property | Type | Description |
|---|---|---|
error.message | string | Error message |
error.statusCode | number | HTTP response status code eg 404 |
error.headers | Headers | HTTP response headers |
error.body | string | HTTP body. Can be empty string if no body is returned. |
error.rawResponse | Response | Raw HTTP response |
error.data$ | Optional. Some errors may contain structured data. See Error Classes. |
Example
import { SDK } from "@meetkai/mka1";
import * as errors from "@meetkai/mka1/models/errors";
const sdk = new SDK({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
try {
const result = await sdk.llm.files.content({
fileId: "file-abc123",
});
console.log(result);
} catch (error) {
// The base class for HTTP error responses
if (error instanceof errors.SDKError) {
console.log(error.message);
console.log(error.statusCode);
console.log(error.body);
console.log(error.headers);
// Depending on the method different errors may be thrown
if (error instanceof errors.GetFileContentResponseBody) {
console.log(error.data$.error); // errors.GetFileContentLlmFilesResponse400Error
}
}
}
}
run();Error Classes
Primary error:
SDKError: The base class for HTTP error responses.
Less common errors (20)
Network errors:
ConnectionError: HTTP client was unable to make a request to a server.RequestTimeoutError: HTTP request timed out due to an AbortSignal signal.RequestAbortedError: HTTP request was aborted by the client.InvalidRequestError: Any input used to create a request is invalid.UnexpectedClientError: Unrecognised or unexpected error.
Inherit from SDKError:
HTTPValidationError: Validation Error. Status code422. Applicable to 33 of 222 methods.*ErrorEnvelope: Error response. Applicable to 17 of 222 methods.*TableErrorResponse: Applicable to 9 of 222 methods.*TextStoreErrorResponse: Error response for text store operations. Applicable to 5 of 222 methods.*GraphRAGErrorResponse: Applicable to 5 of 222 methods.*ValidationErrorResponse: Status code400. Applicable to 3 of 222 methods.*ErrorResponse: Status code400. Applicable to 2 of 222 methods.*GetFileContentResponseBody: Invalid request - File ID is required. Status code400. Applicable to 1 of 222 methods.*GetJwtFromKeyResponseBody: Invalid request body. Status code400. Applicable to 1 of 222 methods.*GetFileContentLlmFilesResponseBody: Unauthorized - Invalid or missing authentication. Status code401. Applicable to 1 of 222 methods.*GetJwtFromKeyAuthApiKeyResponseBody: Unauthorized. Status code401. Applicable to 1 of 222 methods.*GetFileContentLlmFilesResponseResponseBody: File not found. Status code404. Applicable to 1 of 222 methods.*GetFileContentLlmFilesResponse500ResponseBody: Internal server error. Status code500. Applicable to 1 of 222 methods.*GetJwtFromKeyAuthApiKeyResponseResponseBody: Internal server error. Status code500. Applicable to 1 of 222 methods.*ResponseValidationError: Type mismatch between the data returned from the server and the structure expected by the SDK. Seeerror.rawValuefor the raw value anderror.pretty()for a nicely formatted multi-line string.
* Check the method documentation to see if the error is applicable.
Server Selection
Select Server by Index
You can override the default server globally by passing a server index to the serverIdx: number optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:
| # | Server | Description |
|---|---|---|
| 0 | https://apigw.mka1.com | MKA1 API Gateway |
| 1 | / | Relative server URL (configurable via SDK constructor) |
Example
import { SDK } from "@meetkai/mka1";
const sdk = new SDK({
serverIdx: 0,
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
await sdk.permissions.llm.grant({
grantPermissionRequest: {
resourceType: "completion",
resourceId: "my-completion-123",
userId: "user-abc456",
role: "writer",
},
});
}
run();Override Server URL Per-Client
The default server can also be overridden globally by passing a URL to the serverURL: string optional parameter when initializing the SDK client instance. For example:
import { SDK } from "@meetkai/mka1";
const sdk = new SDK({
serverURL: "https://apigw.mka1.com",
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
await sdk.permissions.llm.grant({
grantPermissionRequest: {
resourceType: "completion",
resourceId: "my-completion-123",
userId: "user-abc456",
role: "writer",
},
});
}
run();Custom HTTP Client
The TypeScript SDK makes API calls using an HTTPClient that wraps the native Fetch API. This client is a thin wrapper around fetch and provides the ability to attach hooks around the request lifecycle that can be used to modify the request or handle errors and response.
The HTTPClient constructor takes an optional fetcher argument that can be used to integrate a third-party HTTP client or when writing tests to mock out the HTTP client and feed in fixtures.
The following example shows how to:
- route requests through a proxy server using undici's ProxyAgent
- use the
"beforeRequest"hook to add a custom header and a timeout to requests - use the
"requestError"hook to log errors
import { SDK } from "@meetkai/mka1";
import { ProxyAgent } from "undici";
import { HTTPClient } from "@meetkai/mka1/lib/http";
const dispatcher = new ProxyAgent("http://proxy.example.com:8080");
const httpClient = new HTTPClient({
// 'fetcher' takes a function that has the same signature as native 'fetch'.
fetcher: (input, init) =>
// 'dispatcher' is specific to undici and not part of the standard Fetch API.
fetch(input, { ...init, dispatcher } as RequestInit),
});
httpClient.addHook("beforeRequest", (request) => {
const nextRequest = new Request(request, {
signal: request.signal || AbortSignal.timeout(5000)
});
nextRequest.headers.set("x-custom-header", "custom value");
return nextRequest;
});
httpClient.addHook("requestError", (error, request) => {
console.group("Request Error");
console.log("Reason:", `${error}`);
console.log("Endpoint:", `${request.method} ${request.url}`);
console.groupEnd();
});
const sdk = new SDK({ httpClient: httpClient });Debugging
You can setup your SDK to emit debug logs for SDK requests and responses.
You can pass a logger that matches console's interface as an SDK option.
WARNING
Beware that debug logging will reveal secrets, like API tokens in headers, in log messages printed to a console or files. It's recommended to use this feature only during local development and not in production.
import { SDK } from "@meetkai/mka1";
const sdk = new SDK({ debugLogger: console });Versioning
The SDK is generated from the MKA1 OpenAPI schema and may gain new endpoints frequently. Pin an exact package version when deploying production applications, then upgrade intentionally after reviewing the generated type changes.
Generated Code
Most files under src/, docs/, and the generated reference sections in this README are produced from the API schema. Changes to generated implementation files are likely to be overwritten by the next SDK generation. For API behavior questions, integration support, or documentation issues, use the support channels listed at docs.mka1.com.
Generated with Speakeasy.