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
| Parameter | Type | Description |
|---|---|---|
request | LlmsCreateRequest | Creation request. Known modelIdentifier values fill provider, endpoint, dimensionality, and modality defaults. |
requestOptions | ProviderApiKeyOptions optional | Provider API key plus per-call signal, timeout, or headers. |
Returns: Promise<CreateLLMResponseShape>
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/{id}
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The unique identifier of the LLM to delete |
requestOptions | RequestOptions optional | Per-call signal, timeout, or headers. |
Returns: Promise<void>
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/{id}
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The unique identifier of the LLM to retrieve |
options | LlmsGetOptions optional | Optional query parameters. |
requestOptions | RequestOptions optional | Per-call signal, timeout, or headers. |
Returns: Promise<LLMResponseShape>
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
| Parameter | Type | Description |
|---|---|---|
options | LlmsListOptions optional | Optional query parameters. |
requestOptions | RequestOptions optional | Per-call signal, timeout, or headers. |
Returns: Promise<Array<LLMResponseShape>>
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/{id}
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The unique identifier of the LLM to update |
request | LLMUpdateRequest | Request body. |
requestOptions | RequestOptions optional | Per-call signal, timeout, or headers. |
Returns: Promise<LLMResponseShape>
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
| Field | Type | Required | Description |
|---|---|---|---|
llm | LLMResponse | yes | The created LLM configuration |
statuses | Array<GoodMemStatus> | no | Optional 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
| Field | Type | Required | Description |
|---|---|---|---|
supportsChat | boolean | null | no | Supports conversational/chat completion format with message roles |
supportsCompletion | boolean | null | no | Supports raw text completion with prompt continuation |
supportsFunctionCalling | boolean | null | no | Supports function/tool calling with structured responses |
supportsSystemMessages | boolean | null | no | Supports system prompts to define model behavior and context |
supportsStreaming | boolean | null | no | Supports real-time token streaming during generation |
supportsSamplingParameters | boolean | null | no | Supports 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.
| Field | Type | Required | Description |
|---|---|---|---|
displayName | string | yes | User-facing name of the LLM |
description | string | null | no | Description of the LLM |
providerType | LLMProviderType | yes | Type of LLM provider |
endpointUrl | string | yes | API endpoint base URL (OpenAI-compatible base, typically ends with /v1) |
apiPath | string | null | no | API path for chat/completions request (defaults to /chat/completions if not provided) |
modelIdentifier | string | yes | Model identifier |
supportedModalities | Array<Modality> | null | no | Supported content modalities (defaults to TEXT if not provided) |
credentials | EndpointAuthentication | null | no | Structured credential payload describing how to authenticate with the provider. Required for SaaS providers; optional for local or proxy providers. |
labels | Record<string, string> | null | no | User-defined labels for categorization |
version | string | null | no | Version information |
monitoringEndpoint | string | null | no | Monitoring endpoint URL |
capabilities | LLMCapabilities | null | no | LLM capabilities defining supported features and modes. Optional - server infers capabilities from model identifier if not provided. |
defaultSamplingParams | LLMSamplingParams | null | no | Default sampling parameters for generation requests |
maxContextLength | number | null | no | Maximum context window size in tokens |
clientConfig | Record<string, unknown> | null | no | Provider-specific client configuration as flexible JSON structure |
ownerId | string | null | no | Optional owner principal UUID. If omitted, defaults to the authenticated principal. CREATE_LLM is evaluated against the proposed LLM and owner. |
llmId | string | null | no | Optional client-provided UUID for idempotent creation. If not provided, server generates a new UUID. Returns ALREADY_EXISTS if ID is already in use. |
dashscopeApiDialect | DashScopeApiDialect | null | no | DashScope 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
| Field | Type | Required | Description |
|---|---|---|---|
llmId | string | yes | Unique identifier of the LLM |
displayName | string | yes | User-facing name of the LLM |
description | string | null | no | Description of the LLM |
providerType | LLMProviderType | yes | Type of LLM provider |
endpointUrl | string | yes | API endpoint base URL |
apiPath | string | null | no | API path for chat/completions request |
modelIdentifier | string | yes | Model identifier |
supportedModalities | Array<Modality> | yes | Supported content modalities |
credentials | EndpointAuthentication | null | no | Stored credentials; present only when GetLLM explicitly requests them and the caller has READ_LLM_CREDENTIALS. Always omitted from create, update, and list responses. |
labels | Record<string, string> | yes | User-defined labels for categorization |
version | string | null | no | Version information |
monitoringEndpoint | string | null | no | Monitoring endpoint URL |
capabilities | LLMCapabilities | yes | LLM capabilities defining supported features and modes |
defaultSamplingParams | LLMSamplingParams | null | no | Default sampling parameters for generation requests |
maxContextLength | number | null | no | Maximum context window size in tokens |
clientConfig | Record<string, unknown> | null | no | Provider-specific client configuration |
ownerId | string | yes | Owner ID of the LLM |
createdAt | number | yes | Creation timestamp (milliseconds since epoch) |
updatedAt | number | yes | Last update timestamp (milliseconds since epoch) |
createdById | string | yes | ID of the user who created the LLM |
updatedById | string | yes | ID of the user who last updated the LLM |
dashscopeApiDialect | DashScopeApiDialect | null | no | Configured 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
| Field | Type | Required | Description |
|---|---|---|---|
maxTokens | number | null | no | Maximum tokens to generate (>0 if set; provider-dependent limits apply) |
temperature | number | null | no | Sampling temperature; valid range depends on the configured provider |
topP | number | null | no | Nucleus sampling threshold 0.0-1.0 (smaller values focus on higher probability tokens) |
topK | number | null | no | Top-k sampling limit (>0 if set; primarily for local/open-source models) |
frequencyPenalty | number | null | no | Frequency penalty; valid range depends on the configured provider |
presencePenalty | number | null | no | Presence penalty; valid range depends on the configured provider |
stopSequences | Array<string> | null | no | Generation 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.
| Field | Type | Required | Description |
|---|---|---|---|
displayName | string | null | no | Update display name |
description | string | null | no | Update description |
endpointUrl | string | null | no | Update endpoint base URL (OpenAI-compatible base, typically ends with /v1) |
apiPath | string | null | no | Update API path |
modelIdentifier | string | null | no | Update model identifier (cannot be empty) |
supportedModalities | Array<Modality> | null | no | Update 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) |
credentials | EndpointAuthentication | null | no | Replace stored credentials. Omit this field to preserve the current credentials; a present empty payload is invalid and never clears them. |
version | string | null | no | Update version information |
monitoringEndpoint | string | null | no | Update monitoring endpoint URL |
capabilities | LLMCapabilities | null | no | Update LLM capabilities (replaces entire capability set; clients MUST send all flags) |
defaultSamplingParams | LLMSamplingParams | null | no | Update default sampling parameters |
maxContextLength | number | null | no | Update maximum context window size in tokens |
clientConfig | Record<string, unknown> | null | no | Update provider-specific client configuration (replaces entire config; no merging) |
replaceLabels | Record<string, string> | null | no | Replace all existing labels with this set. Empty map clears all labels. Cannot be used with mergeLabels. |
mergeLabels | Record<string, string> | null | no | Merge with existing labels: upserts with overwrite. Labels not mentioned are preserved. Cannot be used with replaceLabels. |
dashscopeApiDialect | DashScopeApiDialect | null | no | Update 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
| Field | Type | Required | Description |
|---|---|---|---|
llms | Array<LLMResponse> | yes | List 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
| Field | Type | Required | Description |
|---|---|---|---|
llm | LLMResponseShape | yes | The created LLM configuration |
statuses | Array<GoodMemStatusResponseShape> | no | Optional status messages providing information about server-side operations performed during creation, such as capability inference results |
LLMCapabilitiesResponseShape
| Field | Type | Required | Description |
|---|---|---|---|
supportsChat | boolean | null | no | Supports conversational/chat completion format with message roles |
supportsCompletion | boolean | null | no | Supports raw text completion with prompt continuation |
supportsFunctionCalling | boolean | null | no | Supports function/tool calling with structured responses |
supportsSystemMessages | boolean | null | no | Supports system prompts to define model behavior and context |
supportsStreaming | boolean | null | no | Supports real-time token streaming during generation |
supportsSamplingParameters | boolean | null | no | Supports sampling parameters like temperature, top_p, and top_k for generation control |
LLMResponseShape
| Field | Type | Required | Description |
|---|---|---|---|
llmId | string | yes | Unique identifier of the LLM |
displayName | string | yes | User-facing name of the LLM |
description | string | null | no | Description of the LLM |
providerType | LLMProviderType | null | yes | Type of LLM provider |
endpointUrl | string | yes | API endpoint base URL |
apiPath | string | null | no | API path for chat/completions request |
modelIdentifier | string | yes | Model identifier |
supportedModalities | Array<Modality | null> | yes | Supported content modalities |
credentials | EndpointAuthenticationResponseShape | null | no | Stored credentials; present only when GetLLM explicitly requests them and the caller has READ_LLM_CREDENTIALS. Always omitted from create, update, and list responses. |
labels | Record<string, string> | yes | User-defined labels for categorization |
version | string | null | no | Version information |
monitoringEndpoint | string | null | no | Monitoring endpoint URL |
capabilities | LLMCapabilitiesResponseShape | yes | LLM capabilities defining supported features and modes |
defaultSamplingParams | LLMSamplingParamsResponseShape | null | no | Default sampling parameters for generation requests |
maxContextLength | number | null | no | Maximum context window size in tokens |
clientConfig | Record<string, unknown> | null | no | Provider-specific client configuration |
ownerId | string | yes | Owner ID of the LLM |
createdAt | number | yes | Creation timestamp (milliseconds since epoch) |
updatedAt | number | yes | Last update timestamp (milliseconds since epoch) |
createdById | string | yes | ID of the user who created the LLM |
updatedById | string | yes | ID of the user who last updated the LLM |
dashscopeApiDialect | DashScopeApiDialect | null | no | Configured DashScope request and response API dialect; present only for DashScope configurations with a persisted dialect. |
LLMSamplingParamsResponseShape
| Field | Type | Required | Description |
|---|---|---|---|
maxTokens | number | null | no | Maximum tokens to generate (>0 if set; provider-dependent limits apply) |
temperature | number | null | no | Sampling temperature; valid range depends on the configured provider |
topP | number | null | no | Nucleus sampling threshold 0.0-1.0 (smaller values focus on higher probability tokens) |
topK | number | null | no | Top-k sampling limit (>0 if set; primarily for local/open-source models) |
frequencyPenalty | number | null | no | Frequency penalty; valid range depends on the configured provider |
presencePenalty | number | null | no | Presence penalty; valid range depends on the configured provider |
stopSequences | Array<string> | null | no | Generation stop sequences; generation halts on exact match |
ListLLMsResponseShape
| Field | Type | Required | Description |
|---|---|---|---|
llms | Array<LLMResponseShape> | yes | List of LLM configurations matching the request filters |