GoodMemGoodMem

LLMs

LLM management.

Methods on this page are called through client.llms.

client.llms.create

client.llms.create(request: LlmsCreateRequest, requestOptions?: ProviderApiKeyOptions): Promise<CreateLLMResponseShape>

Creates a new LLM configuration for text generation services. LLMs represent connections to different language model API services (like OpenAI, vLLM, etc.) and include all the necessary configuration to use them for text generation. DUPLICATE DETECTION: Returns HTTP 409 Conflict (ALREADY_EXISTS) if another LLM exists with the same effective provider connection and model configuration for this owner after endpoint canonicalization and provider-default resolution. Equivalent credentials participate in the comparison. The apiPath field defaults to '/chat/completions' if omitted. OWNER DEFAULTS: Owner defaults to the authenticated principal unless ownerId is provided; CREATE_LLM is evaluated against the proposed LLM and owner.

HTTP: POST /v1/llms

Parameters

ParameterTypeDescription
requestLlmsCreateRequestCreation request. Known modelIdentifier values fill provider, endpoint, dimensionality, and modality defaults.
requestOptionsProviderApiKeyOptions optionalProvider API key plus per-call signal, timeout, or headers.

Returns: Promise&lt;CreateLLMResponseShape&gt;

Example

const llmResponse = await client.llms.create(
  {
    displayName: "Doc LLM",
    modelIdentifier: "gpt-4o-mini",
    labels: { env: "docs" },
  },
  { apiKey: "sk-..." },
);
const llm = llmResponse.llm;

client.llms.delete

client.llms.delete(id: string, requestOptions?: RequestOptions): Promise<void>

Permanently deletes an LLM configuration. This operation cannot be undone and removes the LLM record and securely deletes stored credentials. IMPORTANT: This does NOT invalidate or delete any previously generated content using this LLM - existing generations remain accessible. Requires DELETE_LLM on the requested LLM.

HTTP: DELETE /v1/llms/&#123;id&#125;

Parameters

ParameterTypeDescription
idstringThe unique identifier of the LLM to delete
requestOptionsRequestOptions optionalPer-call signal, timeout, or headers.

Returns: Promise&lt;void&gt;

Example

await client.llms.delete("your-llm-id");

client.llms.get

client.llms.get(id: string, options?: LlmsGetOptions, requestOptions?: RequestOptions): Promise<LLMResponseShape>

Retrieves the details of a specific LLM configuration by its unique identifier. Requires READ_LLM on the requested LLM. The service distinguishes a missing LLM from an existing LLM the caller cannot read. This is a read-only operation with no side effects.

HTTP: GET /v1/llms/&#123;id&#125;

Parameters

ParameterTypeDescription
idstringThe unique identifier of the LLM to retrieve
optionsLlmsGetOptions optionalOptional query parameters.
requestOptionsRequestOptions optionalPer-call signal, timeout, or headers.

Returns: Promise&lt;LLMResponseShape&gt;

Example

const fetchedLlm = await client.llms.get("your-llm-id");
console.log(fetchedLlm.displayName);

client.llms.list

client.llms.list(options?: LlmsListOptions, requestOptions?: RequestOptions): Promise<Array<LLMResponseShape>>

Retrieves a list of LLM configurations accessible to the caller, with optional filtering. LABEL FILTERS: Label filters accept either label.<key>=<value> or label[key]=value (for example, label.environment=production or label[environment]=production). AUTHORIZATION: Requires LIST_LLM on the GoodMem instance. Each returned LLM must also be visible through READ_LLM; unauthorized LLMs are filtered in PostgreSQL. The ownerId parameter filters that already-authorized result set and does not grant additional visibility. This is a read-only operation with no side effects.

HTTP: GET /v1/llms

Parameters

ParameterTypeDescription
optionsLlmsListOptions optionalOptional query parameters.
requestOptionsRequestOptions optionalPer-call signal, timeout, or headers.

Returns: Promise&lt;Array&lt;LLMResponseShape&gt;&gt;

Example

for (const item of await client.llms.list()) {
  console.log(item.llmId, item.displayName);
}

client.llms.update

client.llms.update(id: string, request: LLMUpdateRequest, requestOptions?: RequestOptions): Promise<LLMResponseShape>

Updates an existing LLM configuration including display information, endpoint configuration, model parameters, credentials, and labels. All fields are optional - only specified fields will be updated. SUPPORTED_MODALITIES UPDATE: If the array contains >=1 elements, it replaces the stored set; if empty or omitted, no change occurs and it does not count as an update by itself. IMPORTANT: providerType is IMMUTABLE after creation and cannot be changed. Requires UPDATE_LLM on the requested LLM.

HTTP: PUT /v1/llms/&#123;id&#125;

Parameters

ParameterTypeDescription
idstringThe unique identifier of the LLM to update
requestLLMUpdateRequestRequest body.
requestOptionsRequestOptions optionalPer-call signal, timeout, or headers.

Returns: Promise&lt;LLMResponseShape&gt;

Example

const updatedLlm = await client.llms.update("your-llm-id", {
  displayName: "Doc LLM (updated)",
  mergeLabels: { version: "2" },
});
console.log(updatedLlm.llmId);

Data Models

Enum Values

LLMProviderType

OPENAI, LITELLM_PROXY, OPEN_ROUTER, DASHSCOPE, VLLM, OLLAMA, LLAMA_CPP, CUSTOM_OPENAI_COMPATIBLE

Interfaces

CreateLLMResponse

Response containing the created LLM and any informational status messages

FieldTypeRequiredDescription
llmLLMResponseyesThe created LLM configuration
statusesArray&lt;GoodMemStatus&gt;noOptional status messages providing information about server-side operations performed during creation, such as capability inference results

LLMCapabilities

Capabilities and features supported by an LLM service

FieldTypeRequiredDescription
supportsChatboolean | nullnoSupports conversational/chat completion format with message roles
supportsCompletionboolean | nullnoSupports raw text completion with prompt continuation
supportsFunctionCallingboolean | nullnoSupports function/tool calling with structured responses
supportsSystemMessagesboolean | nullnoSupports system prompts to define model behavior and context
supportsStreamingboolean | nullnoSupports real-time token streaming during generation
supportsSamplingParametersboolean | nullnoSupports sampling parameters like temperature, top_p, and top_k for generation control

LLMCreationRequest

Request body for creating a new LLM. An LLM represents a configuration for text generation services.

FieldTypeRequiredDescription
displayNamestringyesUser-facing name of the LLM
descriptionstring | nullnoDescription of the LLM
providerTypeLLMProviderTypeyesType of LLM provider
endpointUrlstringyesAPI endpoint base URL (OpenAI-compatible base, typically ends with /v1)
apiPathstring | nullnoAPI path for chat/completions request (defaults to /chat/completions if not provided)
modelIdentifierstringyesModel identifier
supportedModalitiesArray&lt;Modality&gt; | nullnoSupported content modalities (defaults to TEXT if not provided)
credentialsEndpointAuthentication | nullnoStructured credential payload describing how to authenticate with the provider. Required for SaaS providers; optional for local or proxy providers.
labelsRecord&lt;string, string&gt; | nullnoUser-defined labels for categorization
versionstring | nullnoVersion information
monitoringEndpointstring | nullnoMonitoring endpoint URL
capabilitiesLLMCapabilities | nullnoLLM capabilities defining supported features and modes. Optional - server infers capabilities from model identifier if not provided.
defaultSamplingParamsLLMSamplingParams | nullnoDefault sampling parameters for generation requests
maxContextLengthnumber | nullnoMaximum context window size in tokens
clientConfigRecord&lt;string, unknown&gt; | nullnoProvider-specific client configuration as flexible JSON structure
ownerIdstring | nullnoOptional owner principal UUID. If omitted, defaults to the authenticated principal. CREATE_LLM is evaluated against the proposed LLM and owner.
llmIdstring | nullnoOptional client-provided UUID for idempotent creation. If not provided, server generates a new UUID. Returns ALREADY_EXISTS if ID is already in use.
dashscopeApiDialectDashScopeApiDialect | nullnoDashScope request and response API dialect. Valid only for the DASHSCOPE provider. When omitted, a recognized apiPath determines the dialect; otherwise OPENAI_COMPATIBLE is used.

LLMResponse

LLM configuration information

FieldTypeRequiredDescription
llmIdstringyesUnique identifier of the LLM
displayNamestringyesUser-facing name of the LLM
descriptionstring | nullnoDescription of the LLM
providerTypeLLMProviderTypeyesType of LLM provider
endpointUrlstringyesAPI endpoint base URL
apiPathstring | nullnoAPI path for chat/completions request
modelIdentifierstringyesModel identifier
supportedModalitiesArray&lt;Modality&gt;yesSupported content modalities
credentialsEndpointAuthentication | nullnoStored credentials; present only when GetLLM explicitly requests them and the caller has READ_LLM_CREDENTIALS. Always omitted from create, update, and list responses.
labelsRecord&lt;string, string&gt;yesUser-defined labels for categorization
versionstring | nullnoVersion information
monitoringEndpointstring | nullnoMonitoring endpoint URL
capabilitiesLLMCapabilitiesyesLLM capabilities defining supported features and modes
defaultSamplingParamsLLMSamplingParams | nullnoDefault sampling parameters for generation requests
maxContextLengthnumber | nullnoMaximum context window size in tokens
clientConfigRecord&lt;string, unknown&gt; | nullnoProvider-specific client configuration
ownerIdstringyesOwner ID of the LLM
createdAtnumberyesCreation timestamp (milliseconds since epoch)
updatedAtnumberyesLast update timestamp (milliseconds since epoch)
createdByIdstringyesID of the user who created the LLM
updatedByIdstringyesID of the user who last updated the LLM
dashscopeApiDialectDashScopeApiDialect | nullnoConfigured DashScope request and response API dialect; present only for DashScope configurations with a persisted dialect.

LLMSamplingParams

Sampling and generation parameters for controlling LLM text output

FieldTypeRequiredDescription
maxTokensnumber | nullnoMaximum tokens to generate (>0 if set; provider-dependent limits apply)
temperaturenumber | nullnoSampling temperature; valid range depends on the configured provider
topPnumber | nullnoNucleus sampling threshold 0.0-1.0 (smaller values focus on higher probability tokens)
topKnumber | nullnoTop-k sampling limit (>0 if set; primarily for local/open-source models)
frequencyPenaltynumber | nullnoFrequency penalty; valid range depends on the configured provider
presencePenaltynumber | nullnoPresence penalty; valid range depends on the configured provider
stopSequencesArray&lt;string&gt; | nullnoGeneration stop sequences; generation halts on exact match

LLMUpdateRequest

Request body for updating an existing LLM. All fields are optional - only specified fields will be updated. supportedModalities replaces the stored set only when the array contains at least one value; empty or omitted leaves it unchanged and does not count as an update by itself.

FieldTypeRequiredDescription
displayNamestring | nullnoUpdate display name
descriptionstring | nullnoUpdate description
endpointUrlstring | nullnoUpdate endpoint base URL (OpenAI-compatible base, typically ends with /v1)
apiPathstring | nullnoUpdate API path
modelIdentifierstring | nullnoUpdate model identifier (cannot be empty)
supportedModalitiesArray&lt;Modality&gt; | nullnoUpdate supported modalities (if array contains >=1 elements, replaces stored set; if empty or omitted, no change and does not count as an update by itself)
credentialsEndpointAuthentication | nullnoReplace stored credentials. Omit this field to preserve the current credentials; a present empty payload is invalid and never clears them.
versionstring | nullnoUpdate version information
monitoringEndpointstring | nullnoUpdate monitoring endpoint URL
capabilitiesLLMCapabilities | nullnoUpdate LLM capabilities (replaces entire capability set; clients MUST send all flags)
defaultSamplingParamsLLMSamplingParams | nullnoUpdate default sampling parameters
maxContextLengthnumber | nullnoUpdate maximum context window size in tokens
clientConfigRecord&lt;string, unknown&gt; | nullnoUpdate provider-specific client configuration (replaces entire config; no merging)
replaceLabelsRecord&lt;string, string&gt; | nullnoReplace all existing labels with this set. Empty map clears all labels. Cannot be used with mergeLabels.
mergeLabelsRecord&lt;string, string&gt; | nullnoMerge with existing labels: upserts with overwrite. Labels not mentioned are preserved. Cannot be used with replaceLabels.
dashscopeApiDialectDashScopeApiDialect | nullnoUpdate the DashScope request and response API dialect. Valid only for the DASHSCOPE provider. Omit to preserve the stored dialect. Changing apiPath to a recognized canonical DashScope dialect infers its matching dialect; a custom path preserves an existing dialect, while a legacy null dialect is inferred.

ListLLMsResponse

Response containing a list of LLM configurations

FieldTypeRequiredDescription
llmsArray&lt;LLMResponse&gt;yesList of LLM configurations matching the request filters

Response Shapes

Response shape types model values returned by the SDK after forward-compatible unknown enum strings are coerced to null.

CreateLLMResponseShape

FieldTypeRequiredDescription
llmLLMResponseShapeyesThe created LLM configuration
statusesArray&lt;GoodMemStatusResponseShape&gt;noOptional status messages providing information about server-side operations performed during creation, such as capability inference results

LLMCapabilitiesResponseShape

FieldTypeRequiredDescription
supportsChatboolean | nullnoSupports conversational/chat completion format with message roles
supportsCompletionboolean | nullnoSupports raw text completion with prompt continuation
supportsFunctionCallingboolean | nullnoSupports function/tool calling with structured responses
supportsSystemMessagesboolean | nullnoSupports system prompts to define model behavior and context
supportsStreamingboolean | nullnoSupports real-time token streaming during generation
supportsSamplingParametersboolean | nullnoSupports sampling parameters like temperature, top_p, and top_k for generation control

LLMResponseShape

FieldTypeRequiredDescription
llmIdstringyesUnique identifier of the LLM
displayNamestringyesUser-facing name of the LLM
descriptionstring | nullnoDescription of the LLM
providerTypeLLMProviderType | nullyesType of LLM provider
endpointUrlstringyesAPI endpoint base URL
apiPathstring | nullnoAPI path for chat/completions request
modelIdentifierstringyesModel identifier
supportedModalitiesArray&lt;Modality | null&gt;yesSupported content modalities
credentialsEndpointAuthenticationResponseShape | nullnoStored credentials; present only when GetLLM explicitly requests them and the caller has READ_LLM_CREDENTIALS. Always omitted from create, update, and list responses.
labelsRecord&lt;string, string&gt;yesUser-defined labels for categorization
versionstring | nullnoVersion information
monitoringEndpointstring | nullnoMonitoring endpoint URL
capabilitiesLLMCapabilitiesResponseShapeyesLLM capabilities defining supported features and modes
defaultSamplingParamsLLMSamplingParamsResponseShape | nullnoDefault sampling parameters for generation requests
maxContextLengthnumber | nullnoMaximum context window size in tokens
clientConfigRecord&lt;string, unknown&gt; | nullnoProvider-specific client configuration
ownerIdstringyesOwner ID of the LLM
createdAtnumberyesCreation timestamp (milliseconds since epoch)
updatedAtnumberyesLast update timestamp (milliseconds since epoch)
createdByIdstringyesID of the user who created the LLM
updatedByIdstringyesID of the user who last updated the LLM
dashscopeApiDialectDashScopeApiDialect | nullnoConfigured DashScope request and response API dialect; present only for DashScope configurations with a persisted dialect.

LLMSamplingParamsResponseShape

FieldTypeRequiredDescription
maxTokensnumber | nullnoMaximum tokens to generate (>0 if set; provider-dependent limits apply)
temperaturenumber | nullnoSampling temperature; valid range depends on the configured provider
topPnumber | nullnoNucleus sampling threshold 0.0-1.0 (smaller values focus on higher probability tokens)
topKnumber | nullnoTop-k sampling limit (>0 if set; primarily for local/open-source models)
frequencyPenaltynumber | nullnoFrequency penalty; valid range depends on the configured provider
presencePenaltynumber | nullnoPresence penalty; valid range depends on the configured provider
stopSequencesArray&lt;string&gt; | nullnoGeneration stop sequences; generation halts on exact match

ListLLMsResponseShape

FieldTypeRequiredDescription
llmsArray&lt;LLMResponseShape&gt;yesList of LLM configurations matching the request filters