GoodMem
ReferenceAPIgRPC API

Llm

Llm service API reference

Services

LLMService Service

Service for managing LLM configurations in the GoodMem system.

Authentication: gRPC metadata authorization: Bearer <api-key>

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

Permissions model:

  • *_OWN: operate on caller-owned LLMs
  • *_ANY: operate on any user's LLMs (requires elevated role)

CreateLLM

Creates a new LLM configuration.

Type
Requestgoodmem.v1.CreateLLMRequest
Responsegoodmem.v1.CreateLLMResponse

Auth: gRPC metadata authorization: Bearer <api-key>

Permissions Required: CREATE_LLM_OWN or CREATE_LLM_ANY

Summary:

  • Owner defaults to the authenticated user unless owner_id is provided (requires *_ANY if differs)
  • ALREADY_EXISTS: another LLM exists with identical {owner_id, provider_type, endpoint_url, api_path, model_identifier, credentials_fingerprint} after URL canonicalization: trailing slash stripped; host comparison case-insensitive; default ports removed; path and model_identifier comparison case-sensitive; credentials_fingerprint is SHA-256 hash of normalized credentials

Side Effects:

  • Persists LLM; encrypts credentials; sets audit fields

Error Codes:

  • UNAUTHENTICATED: missing/invalid auth
  • PERMISSION_DENIED: lacks CREATE_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 'authorization: Bearer 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 authorization: Bearer <api-key>

Permissions Required: READ_LLM_OWN or READ_LLM_ANY

Side Effects: None

Error Codes:

  • UNAUTHENTICATED: missing/invalid auth
  • PERMISSION_DENIED: lacks READ_LLM_*
  • 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 'authorization: Bearer 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 user.

Type
Requestgoodmem.v1.ListLLMsRequest
Responsegoodmem.v1.ListLLMsResponse

Auth: gRPC metadata authorization: Bearer <api-key>

Permissions Required: LIST_LLM_OWN or LIST_LLM_ANY

Request Parameters:

  • owner_id (optional, bytes UUID): filter by owner. If caller has LIST_LLM_ANY and owner_id is omitted, all LLMs visible to the role are returned; otherwise only caller-owned LLMs are returned
  • provider_type (optional): UNSPECIFIED ignored
  • label_selectors (optional): AND of exact key=value matches (case-sensitive)

Note: bytes fields in JSON must be base64.

Side Effects: None

Error Codes:

  • UNAUTHENTICATED: missing/invalid auth
  • PERMISSION_DENIED: lacks 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 'authorization: Bearer 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 authorization: Bearer <api-key>

Permissions Required: UPDATE_LLM_OWN or UPDATE_LLM_ANY

Side Effects:

  • Persists changes; updates updated_at and updated_by_id

Error Codes:

  • UNAUTHENTICATED: missing/invalid auth
  • PERMISSION_DENIED: lacks UPDATE_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 'authorization: Bearer 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 authorization: Bearer <api-key>

Permissions Required: DELETE_LLM_OWN or DELETE_LLM_ANY

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_*
  • 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 'authorization: Bearer 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: supports all except top_k
  • Local models (vLLM, Ollama): typically support all parameters
  • Custom providers: parameter support varies by implementation
FieldTypeDescription
max_tokensint32OPTIONAL maximum tokens to generate; >0 if set; provider-dependent limits apply
temperaturefloatOPTIONAL sampling temperature 0.0-2.0; 0.0=deterministic, 2.0=highly random; default varies 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 -2.0 to 2.0; positive values reduce repetition based on frequency
presence_penaltyfloatOPTIONAL presence penalty -2.0 to 2.0; positive values encourage topic diversity
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 is INPUT_ONLY and is omitted from all responses.

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 strips trailing slash; host comparison case-insensitive; default ports removed
api_pathstringOPTIONAL; if empty on create, defaults to "/v1/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.EndpointAuthenticationINPUT_ONLY; optional when provider allows anonymous access; never returned in responses
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
REQUIRED on create; 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
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 strips trailing slash
api_pathstringOptional: API path; if empty, defaults to "/v1/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.LLMCapabilitiesRequired: LLM capabilities defining supported features and modes
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 ID (16 bytes UUID); if omitted → authenticated user; requires CREATE_LLM_ANY if different from caller

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)

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 user.

FieldTypeDescription
llmsgoodmem.v1.LLMList of `LLM`s matching filters and permissions.

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 (must be valid HTTP/HTTPS URL)
api_pathstringUpdate API path
model_identifierstringUpdate model identifier (cannot be empty)
supported_modalitiesgoodmem.v1.ModalityUpdates to supported_modalities:
Proto3 cannot distinguish an omitted repeated field from an empty one.
In v1, updates to supported_modalities are NOT supported and the field is ignored.
(If/when presence is added, setting an empty set would clear all modalities.)
See note above. See: goodmem.v1.Modality
credentials...dmem.v1.EndpointAuthenticationUpdate credentials; replaces any existing payload when set
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)
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
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_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