GoodMemGoodMem
ReferenceAPIgRPC API

Llm

gRPC LLMService reference for CreateLLM, GetLLM, ListLLMs, UpdateLLM and other RPCs, with request messages, response types, and service documentation.

Services

LLMService Service

Service for managing LLM configurations in the GoodMem system.

Authentication: gRPC metadata x-api-key: <api-key>

Global errors: All RPCs may return DEADLINE_EXCEEDED, CANCELLED, UNAVAILABLE, RESOURCE_EXHAUSTED, INTERNAL.

Authorization model:

  • Every RPC evaluates a typed authorization operation against the GoodMem instance or a particular LLM.
  • Ownership, code-defined role assignments, and direct grants can supply authority; an API-key ceiling may further restrict the authenticated principal's effective authority.
  • Listing requires LIST_LLM on the instance and returns only LLMs on which the caller has READ_LLM.

CreateLLM

Creates a new LLM configuration.

Type
Requestgoodmem.v1.CreateLLMRequest
Responsegoodmem.v1.CreateLLMResponse

Auth: gRPC metadata x-api-key: <api-key>

Authorization Required: CREATE_LLM on the proposed LLM, evaluated using its proposed owner.

Summary:

  • Owner defaults to the authenticated principal unless owner_id is provided; authorization is evaluated against that proposed owner
  • ALREADY_EXISTS: another LLM for the same owner has the same effective provider connection and model configuration after endpoint canonicalization and provider-default resolution; equivalent credentials participate in this comparison
  • The response omits stored credentials; use GetLLM with include_credentials=true for separately authorized disclosure

Side Effects:

  • Persists the LLM and its credentials; sets audit fields

Error Codes:

  • UNAUTHENTICATED: missing/invalid auth
  • PERMISSION_DENIED: lacks CREATE_LLM on the proposed LLM
  • INVALID_ARGUMENT: bad URL(s); empty/invalid fields; UNSPECIFIED enums; labels exceed limits/charset; unsupported modality; invalid sampling parameters
  • ALREADY_EXISTS: matching LLM as defined above
  • INTERNAL: unexpected server error

Idempotency: Non-idempotent; clients SHOULD NOT blindly retry on unknown failures.

Examples:

grpcurl -plaintext \
-H 'x-api-key: gm_xxx' \
-d '{
"display_name": "GPT-4 Turbo",
"provider_type": "LLM_PROVIDER_TYPE_OPENAI",
"endpoint_url": "https://api.openai.com",
"model_identifier": "gpt-4-turbo-preview",
"capabilities": {"supports_chat": true, "supports_streaming": true},
"credentials": "sk-***",
"labels": {"env":"prod","team":"ai"}
}' \
localhost:8080 goodmem.v1.LLMService/CreateLLM

Note: bytes fields in JSON must be base64.

GetLLM

Retrieves details of a specific LLM.

Type
Requestgoodmem.v1.GetLLMRequest
Responsegoodmem.v1.LLM

Auth: gRPC metadata x-api-key: <api-key>

Authorization Required: READ_LLM on the requested LLM. When include_credentials is true, the caller must also hold READ_LLM_CREDENTIALS; only the current owner or an instance administrator can supply that authority.

Side Effects: None

Error Codes:

  • UNAUTHENTICATED: missing/invalid auth
  • PERMISSION_DENIED: lacks READ_LLM, or requests credentials without READ_LLM_CREDENTIALS
  • INVALID_ARGUMENT: invalid LLM ID format
  • NOT_FOUND: LLM does not exist
  • INTERNAL: unexpected server error

Idempotency: Read-only; safe to retry; results may change over time.

Examples:

grpcurl -plaintext \
-H 'x-api-key: gm_xxx' \
-d '{ "llm_id": "BASE64_UUID_BYTES_HERE" }' \
localhost:8080 goodmem.v1.LLMService/GetLLM

Note: bytes fields in JSON must be base64.

ListLLMs

Lists LLMs accessible to the authenticated principal.

Type
Requestgoodmem.v1.ListLLMsRequest
Responsegoodmem.v1.ListLLMsResponse

Auth: gRPC metadata x-api-key: <api-key>

Authorization Required: LIST_LLM on the GoodMem instance and READ_LLM on each returned LLM. The standard user role may enumerate the catalog and read owned LLMs; direct grants can expose additional LLMs.

Request Parameters:

  • owner_id (optional, bytes UUID): filter the already-authorized result set by owner
  • provider_type (optional): UNSPECIFIED ignored
  • label_selectors (optional): AND of exact key=value matches (case-sensitive)
  • Stored credentials are always omitted from list responses

Note: bytes fields in JSON must be base64.

Side Effects: None

Error Codes:

  • UNAUTHENTICATED: missing/invalid auth
  • PERMISSION_DENIED: lacks instance-level LIST_LLM
  • INVALID_ARGUMENT: invalid filters or parameters
  • INTERNAL: unexpected server error

Idempotency: Read-only; safe to retry; results may change over time.

Examples:

grpcurl -plaintext \
-H 'x-api-key: gm_xxx' \
-d '{ "provider_type":"LLM_PROVIDER_TYPE_OPENAI", "label_selectors":{"env":"prod"} }' \
localhost:8080 goodmem.v1.LLMService/ListLLMs

UpdateLLM

Updates mutable properties of an LLM.

Type
Requestgoodmem.v1.UpdateLLMRequest
Responsegoodmem.v1.LLM

Auth: gRPC metadata x-api-key: <api-key>

Authorization Required: UPDATE_LLM on the requested LLM.

Summary:

  • Mutable fields include display_name, description, endpoint_url, api_path, model_identifier, supported_modalities, credentials, version, monitoring_endpoint, capabilities, default_sampling_params, max_context_length, client_config, and labels
  • For supported_modalities, a non-empty list replaces the stored set; omission or an empty list leaves it unchanged and does not count as an update by itself
  • provider_type and owner_id are immutable after creation
  • Omitting credentials preserves the stored value; a present empty payload is invalid
  • The response always omits stored credentials

Side Effects:

  • Persists changes; updates updated_at and updated_by_id

Error Codes:

  • UNAUTHENTICATED: missing/invalid auth
  • PERMISSION_DENIED: lacks UPDATE_LLM on the requested LLM
  • INVALID_ARGUMENT: invalid fields or formats
  • NOT_FOUND: LLM does not exist
  • INTERNAL: unexpected server error

Idempotency: Idempotent with identical input; safe to retry.

Examples:

grpcurl -plaintext \
-H 'x-api-key: gm_xxx' \
-d '{
"llm_id": "BASE64_UUID_BYTES_HERE",
"replace_labels": { "items": {} }
}' \
localhost:8080 goodmem.v1.LLMService/UpdateLLM

Note: bytes fields in JSON must be base64.

DeleteLLM

Permanently deletes an LLM configuration.

Type
Requestgoodmem.v1.DeleteLLMRequest
Responsegoogle.protobuf.Empty

Auth: gRPC metadata x-api-key: <api-key>

Authorization Required: DELETE_LLM on the requested LLM.

Side Effects:

  • Removes the LLM record; securely deletes stored credentials
  • Does not cancel in-flight generations; previously generated content is unaffected

Error Codes:

  • UNAUTHENTICATED: missing/invalid auth
  • PERMISSION_DENIED: lacks DELETE_LLM on the requested LLM
  • INVALID_ARGUMENT: invalid LLM ID format
  • NOT_FOUND: LLM does not exist
  • INTERNAL: unexpected server error

Idempotency: Safe to retry; may return NOT_FOUND if already deleted or never existed.

Examples:

grpcurl -plaintext \
-H 'x-api-key: gm_xxx' \
-d '{ "llm_id": "BASE64_UUID_BYTES_HERE" }' \
localhost:8080 goodmem.v1.LLMService/DeleteLLM

Note: bytes fields in JSON must be base64.

Messages

LLMCapabilities

Capabilities and features supported by an LLM service.

Defines the interface features and generation modes available from the model endpoint. These capabilities determine which API methods and request formats can be used.

Multi-modal capabilities:

  • Vision support is derived from IMAGE in supported_modalities field
  • Audio support is derived from AUDIO in supported_modalities field

Capability interactions:

  • supports_chat and supports_completion may be independent; some providers expose only one mode
  • supports_function_calling requires supports_chat in most implementations
  • supports_system_messages enhances both chat and completion modes when available
  • supports_streaming applies to both chat and completion generation modes
  • supports_sampling_parameters controls whether stochastic generation knobs (e.g., temperature, top_p) are available; deterministic-only models will disable this

See also: goodmem.v1.Modality

FieldTypeDescription
supports_chatboolSupports conversational/chat completion format with message roles
supports_completionboolSupports raw text completion with prompt continuation
supports_function_callingboolSupports function/tool calling with structured responses
supports_system_messagesboolSupports system prompts to define model behavior and context
supports_streamingboolSupports real-time token streaming during generation
supports_sampling_parametersboolSupports stochastic sampling controls (e.g., temperature, top_p) for non-deterministic output

LLMSamplingParams

Sampling and generation parameters for controlling LLM text output.

These parameters fine-tune the generation behavior, creativity, and output constraints of the language model. Different providers may support different subsets of parameters.

Parameter interactions:

  • temperature and top_p work together; lower values increase determinism
  • top_k is primarily used by local/open-source models (HuggingFace, Ollama)
  • frequency_penalty and presence_penalty help reduce repetitive output
  • stop_sequences provide precise generation termination control

Provider compatibility:

  • OpenAI-style APIs commonly support temperature/top_p/frequency/presence controls, with OpenAI using temperature 0-2 and penalties -2..2; top_k support varies.
  • Anthropic-compatible APIs cap or ignore some OpenAI sampling fields.
  • Cohere, Vertex/Gemini, local models, and custom providers use provider-specific ranges and supported subsets.
FieldTypeDescription
max_tokensint32OPTIONAL maximum tokens to generate; >0 if set; provider-dependent limits apply
temperaturefloatOPTIONAL sampling temperature; interpretation and valid range vary by provider
top_pfloatOPTIONAL nucleus sampling threshold 0.0-1.0; smaller values focus on higher probability tokens
top_kint32OPTIONAL top-k sampling limit; >0 if set; primarily for local/open-source models
frequency_penaltyfloatOPTIONAL frequency penalty; interpretation and valid range vary by provider
presence_penaltyfloatOPTIONAL presence penalty; interpretation and valid range vary by provider
stop_sequencesstringOPTIONAL generation stop sequences; ≤10 sequences; each ≤100 chars; generation halts on exact match

LLM

Represents a connection to a Large Language Model service for text generation.

LLMs provide generative AI capabilities for chat completion, text completion, and function calling by interfacing with both hosted services (OpenAI, API gateways) and self-hosted models (vLLM, Ollama). Each configuration includes connection details, model parameters, generation capabilities, and access credentials.

Security:

  • credentials are returned only by GetLLM when explicitly requested and separately authorized. Create, update, and list responses omit them.

Immutability:

  • provider_type is IMMUTABLE after creation.
  • owner_id is set at creation and cannot be modified.

Notes:

  • All timestamps are UTC (google.protobuf.Timestamp).
  • Complex configuration objects (capabilities, default_sampling_params, client_config) are stored as JSONB.

See also: LLMProviderType, LLMCapabilities, LLMSamplingParams, goodmem.v1.Modality

FieldTypeDescription
llm_idbytesOUTPUT_ONLY UUID (16 bytes); immutable primary identifier
display_namestringREQUIRED on create; ≤255 chars; leading/trailing whitespace trimmed; cannot be empty
descriptionstringOPTIONAL
provider_typegoodmem.v1.LLMProviderTypeREQUIRED on create; IMMUTABLE thereafter
endpoint_urlstringREQUIRED HTTP(S) URL; server canonicalizes (trim, lowercase scheme/host, remove default ports, strip trailing '/' from path; preserve query)
api_pathstringOPTIONAL relative path (no scheme/host; preserve trailing '/' and query); if empty on create, uses the provider-specific default (DashScope uses "/compatible-mode/v1/chat/completions"; other providers normally use "/chat/completions")
model_identifierstringREQUIRED on create; non-empty after trimming
supported_modalitiesgoodmem.v1.ModalityOUTPUT semantics: server-stored set; default TEXT if omitted at create. See: goodmem.v1.Modality
credentials...dmem.v1.EndpointAuthenticationOPTIONAL structured credentials for upstream authentication; may be empty when provider allows anonymous access
labelsgoodmem.v1.LLM.LabelsEntry≤20 entries; keys/values ≤255 chars; keys [a-z0-9._-], case-sensitive; merge overwrites on exact key match
versionstringOPTIONAL
monitoring_endpointstringOPTIONAL http(s) URL for health/metrics
capabilitiesgoodmem.v1.LLMCapabilitiesLLM-specific configuration
OPTIONAL; server infers from model_identifier if omitted; defines supported generation modes and features
default_sampling_paramsgoodmem.v1.LLMSamplingParamsOPTIONAL default parameters for generation requests
max_context_lengthint32OPTIONAL maximum context window size in tokens; >0 if set
client_configgoogle.protobuf.StructOPTIONAL provider-specific configuration as flexible JSON structure
owner_idbytesStandard audit fields
OUTPUT_ONLY owner UUID (16 bytes); set at create; not updatable
dashscope_api_dialectgoodmem.v1.DashScopeApiDialectOPTIONAL persisted DashScope API dialect; present only for LLM_PROVIDER_TYPE_DASHSCOPE. See: goodmem.v1.DashScopeApiDialect
created_atgoogle.protobuf.TimestampOUTPUT_ONLY
updated_atgoogle.protobuf.TimestampOUTPUT_ONLY
created_by_idbytesOUTPUT_ONLY
updated_by_idbytesOUTPUT_ONLY

LLM.LabelsEntry

FieldTypeDescription
keystring
valuestring

CreateLLMRequest

FieldTypeDescription
llm_idbytesOptional: client-provided UUID (16 bytes); server generates if omitted; returns ALREADY_EXISTS if ID exists
display_namestringRequired: User-facing name (≤255 chars; leading/trailing whitespace trimmed; cannot be empty)
descriptionstringOptional: description of the LLM's purpose
provider_typegoodmem.v1.LLMProviderTypeRequired: Provider type; LLM_PROVIDER_TYPE_UNSPECIFIED → INVALID_ARGUMENT
endpoint_urlstringRequired: HTTP(S) URL; server canonicalizes (trim, lowercase scheme/host, remove default ports, strip trailing '/' from path; preserve query)
api_pathstringOptional relative path (no scheme/host; preserve trailing '/' and query); if empty, uses the provider-specific default (DashScope uses "/compatible-mode/v1/chat/completions"; other providers normally use "/chat/completions")
model_identifierstringRequired: Model identifier string (non-empty after trimming)
supported_modalitiesgoodmem.v1.ModalityOptional: supported modalities; empty defaults to TEXT only. See: goodmem.v1.Modality
credentials...dmem.v1.EndpointAuthenticationStructured credential payload describing upstream authentication; omit when provider does not require credentials
labels...1.CreateLLMRequest.LabelsEntryOptional: labels (≤20 entries; keys/values ≤255 chars; keys [a-z0-9._-], case-sensitive)
versionstringOptional: version information for the model/service
monitoring_endpointstringOptional: HTTP(S) URL for health/metrics
capabilitiesgoodmem.v1.LLMCapabilitiesOptional: LLM capabilities; server infers from model_identifier if omitted
default_sampling_paramsgoodmem.v1.LLMSamplingParamsOptional: Default sampling parameters for generation requests
max_context_lengthint32Optional: Maximum context window size in tokens (>0 if set)
client_configgoogle.protobuf.StructOptional: Provider-specific client configuration as flexible JSON structure
owner_idbytesOptional: owner principal UUID (16 bytes); if omitted → authenticated principal; CREATE_LLM is evaluated using this proposed owner
dashscope_api_dialectgoodmem.v1.DashScopeApiDialectOptional DashScope API dialect; valid only for LLM_PROVIDER_TYPE_DASHSCOPE and inferred from a recognized explicit api_path, otherwise OPENAI_COMPATIBLE, when omitted. See: goodmem.v1.DashScopeApiDialect

CreateLLMRequest.LabelsEntry

FieldTypeDescription
keystring
valuestring

CreateLLMResponse

Response message for the CreateLLM RPC.

Contains the newly created LLM configuration and any informational statuses generated during the creation process, such as results from capability inference.

FieldTypeDescription
llmgoodmem.v1.LLMThe created `LLM` configuration.
statusesgoodmem.v1.GoodMemStatusOptional: A list of statuses detailing the results of server-side operations, such as capability inference. See `goodmem.v1.GoodMemStatus`.

GetLLMRequest

FieldTypeDescription
llm_idbytesRequired: LLM ID (16 bytes UUID)
include_credentialsboolOptional: Include stored credentials; requires READ_LLM_CREDENTIALS and defaults to false

ListLLMsRequest

FieldTypeDescription
owner_idbytesOptional filters
Optional: Filter by owner (16 bytes UUID)
provider_typegoodmem.v1.LLMProviderTypeOptional: Filter by provider type; LLM_PROVIDER_TYPE_UNSPECIFIED ignored
label_selectors...LMsRequest.LabelSelectorsEntryOptional: conjunction (AND) of exact key=value matches

ListLLMsRequest.LabelSelectorsEntry

FieldTypeDescription
keystring
valuestring

ListLLMsResponse

Response message for the ListLLMs RPC.

Contains a list of LLM configurations that match the request filters and are accessible by the authenticated principal.

FieldTypeDescription
llmsgoodmem.v1.LLMList of `LLM`s matching filters and permissions, ordered by created_at DESC then llm_id DESC.

UpdateLLMRequest

FieldTypeDescription
llm_idbytesRequired: ID of the LLM to update (16 bytes UUID)
display_namestringOptional fields to update (if omitted → unchanged)
Update display name (≤255 chars; cannot be empty)
descriptionstringUpdate description
endpoint_urlstringUpdate endpoint URL; server canonicalizes (trim, lowercase scheme/host, remove default ports, strip trailing '/' from path; preserve query)
api_pathstringUpdate API path; omit to keep existing; set blank to reset to default
model_identifierstringUpdate model identifier (cannot be empty)
supported_modalitiesgoodmem.v1.ModalityOptional: If provided with >=1 entries, replaces stored set; omit or empty to leave unchanged and does not count as an update by itself. See: goodmem.v1.Modality
credentials...dmem.v1.EndpointAuthenticationUpdate credentials; omit to leave unchanged; a present empty payload is invalid and never clears stored credentials
versionstringUpdate version information
monitoring_endpointstringUpdate monitoring endpoint URL
capabilitiesgoodmem.v1.LLMCapabilitiesUpdate LLM capabilities (replaces entire capability set; clients MUST send all flags)
default_sampling_paramsgoodmem.v1.LLMSamplingParamsUpdate default sampling parameters
max_context_lengthint32Update maximum context window size in tokens
client_configgoogle.protobuf.StructUpdate provider-specific client configuration (replaces entire config; no merging)
dashscope_api_dialectgoodmem.v1.DashScopeApiDialectUpdate DashScope API dialect; valid only for LLM_PROVIDER_TYPE_DASHSCOPE; omit to preserve the stored value. A recognized canonical api_path selects its matching dialect; an unrecognized custom path preserves the stored dialect. See: goodmem.v1.DashScopeApiDialect
replace_labelsgoodmem.v1.StringMapReplace all existing labels with this set. Empty StringMap clears all labels.
See: goodmem.v1.StringMap
merge_labelsgoodmem.v1.StringMapMerge with existing labels: upserts with overwrite. Labels not mentioned are preserved.
See: goodmem.v1.StringMap

DeleteLLMRequest

FieldTypeDescription
llm_idbytesRequired: ID of the LLM to delete (16 bytes UUID)

Enums

LLMProviderType

LLM provider type for text generation services.

Organized by deployment model with distinct value ranges:

  • 0: Invalid type
  • 1-99: Reserved for future general providers
  • 10-19: Cloud/SaaS providers and API gateways
  • 100-199: Self-hosted and local deployment solutions
  • 999: Generic compatibility fallback

GoodMem's DashScope integration

NameValueDescription
LLM_PROVIDER_TYPE_UNSPECIFIED0Invalid provider type; `INVALID_ARGUMENT` on writes
LLM_PROVIDER_TYPE_OPENAI10SaaS or Gateway (10-19)
OpenAI API service (api.openai.com)
LLM_PROVIDER_TYPE_LITELLM_PROXY11LiteLLM proxy for unified model access
LLM_PROVIDER_TYPE_OPEN_ROUTER12OpenRouter API gateway service
LLM_PROVIDER_TYPE_DASHSCOPE13Alibaba Cloud Model Studio through GoodMem's DashScope integration
LLM_PROVIDER_TYPE_VLLM100Local / self-hosted (100-199)
vLLM inference server for high-performance serving
LLM_PROVIDER_TYPE_OLLAMA101Ollama local model runner
LLM_PROVIDER_TYPE_LLAMA_CPP102llama-cpp-python server implementations
LLM_PROVIDER_TYPE_CUSTOM_OPENAI_COMPATIBLE999Generic compatibility (999)
Any OpenAI-compatible API endpoint