GoodMemGoodMem
ReferenceClient SDKs

TypeScript SDK

Installation

npm install @pairsystems/goodmem

Client

import { Goodmem } from "@pairsystems/goodmem";

const client = new Goodmem({
  baseUrl: "http://localhost:8080",
  apiKey: process.env.GOODMEM_API_KEY,
});

The TypeScript SDK exposes generated namespace clients on client.<namespace>.

NamespaceAccessorDescription
Embeddersclient.embeddersEmbedder management
Rerankersclient.rerankersReranker management
LLMsclient.llmsLLM management
Spacesclient.spacesMemory space management
Memoriesclient.memoriesMemory CRUD, retrieval, and batch operations
OCRclient.ocrDocument text extraction
Systemclient.systemServer info and initialization
Usersclient.usersUser lookup
Adminclient.adminServer lifecycle operations
API Keysclient.apikeysAPI key lifecycle management
Pingclient.pingEndpoint health probes

Methods

NamespaceMethodSignatureReturns
embedderscreateclient.embedders.create(request: EmbeddersCreateRequest, requestOptions?: ProviderApiKeyOptions): Promise&lt;EmbedderResponseShape&gt;Promise&lt;EmbedderResponseShape&gt;
embeddersdeleteclient.embedders.delete(id: string, requestOptions?: RequestOptions): Promise&lt;void&gt;Promise&lt;void&gt;
embeddersgetclient.embedders.get(id: string, requestOptions?: RequestOptions): Promise&lt;EmbedderResponseShape&gt;Promise&lt;EmbedderResponseShape&gt;
embedderslistclient.embedders.list(options?: EmbeddersListOptions, requestOptions?: RequestOptions): Promise&lt;Array&lt;EmbedderResponseShape&gt;&gt;Promise&lt;Array&lt;EmbedderResponseShape&gt;&gt;
embeddersupdateclient.embedders.update(id: string, request: UpdateEmbedderRequest, requestOptions?: RequestOptions): Promise&lt;EmbedderResponseShape&gt;Promise&lt;EmbedderResponseShape&gt;
rerankerscreateclient.rerankers.create(request: RerankersCreateRequest, requestOptions?: ProviderApiKeyOptions): Promise&lt;RerankerResponseShape&gt;Promise&lt;RerankerResponseShape&gt;
rerankersdeleteclient.rerankers.delete(id: string, requestOptions?: RequestOptions): Promise&lt;void&gt;Promise&lt;void&gt;
rerankersgetclient.rerankers.get(id: string, requestOptions?: RequestOptions): Promise&lt;RerankerResponseShape&gt;Promise&lt;RerankerResponseShape&gt;
rerankerslistclient.rerankers.list(options?: RerankersListOptions, requestOptions?: RequestOptions): Promise&lt;Array&lt;RerankerResponseShape&gt;&gt;Promise&lt;Array&lt;RerankerResponseShape&gt;&gt;
rerankersupdateclient.rerankers.update(id: string, request: UpdateRerankerRequest, requestOptions?: RequestOptions): Promise&lt;RerankerResponseShape&gt;Promise&lt;RerankerResponseShape&gt;
llmscreateclient.llms.create(request: LlmsCreateRequest, requestOptions?: ProviderApiKeyOptions): Promise&lt;CreateLLMResponseShape&gt;Promise&lt;CreateLLMResponseShape&gt;
llmsdeleteclient.llms.delete(id: string, requestOptions?: RequestOptions): Promise&lt;void&gt;Promise&lt;void&gt;
llmsgetclient.llms.get(id: string, requestOptions?: RequestOptions): Promise&lt;LLMResponseShape&gt;Promise&lt;LLMResponseShape&gt;
llmslistclient.llms.list(options?: LlmsListOptions, requestOptions?: RequestOptions): Promise&lt;Array&lt;LLMResponseShape&gt;&gt;Promise&lt;Array&lt;LLMResponseShape&gt;&gt;
llmsupdateclient.llms.update(id: string, request: LLMUpdateRequest, requestOptions?: RequestOptions): Promise&lt;LLMResponseShape&gt;Promise&lt;LLMResponseShape&gt;
spacescreateclient.spaces.create(request: SpaceCreationRequest, requestOptions?: RequestOptions): Promise&lt;SpaceResponseShape&gt;Promise&lt;SpaceResponseShape&gt;
spacesdeleteclient.spaces.delete(id: string, requestOptions?: RequestOptions): Promise&lt;void&gt;Promise&lt;void&gt;
spacesgetclient.spaces.get(id: string, requestOptions?: RequestOptions): Promise&lt;SpaceResponseShape&gt;Promise&lt;SpaceResponseShape&gt;
spaceslistclient.spaces.list(options?: SpacesListOptions, requestOptions?: RequestOptions): Promise&lt;Page&lt;SpaceResponseShape&gt;&gt;Promise&lt;Page&lt;SpaceResponseShape&gt;&gt;
spacesupdateclient.spaces.update(id: string, request: UpdateSpaceRequest, requestOptions?: RequestOptions): Promise&lt;SpaceResponseShape&gt;Promise&lt;SpaceResponseShape&gt;
memoriesbatchCreateclient.memories.batchCreate(request: JsonBatchMemoryCreationRequest, requestOptions?: RequestOptions): Promise&lt;BatchMemoryResponseShape&gt;Promise&lt;BatchMemoryResponseShape&gt;
memoriesbatchDeleteclient.memories.batchDelete(request: BatchMemoryDeletionRequest, requestOptions?: RequestOptions): Promise&lt;BatchMemoryResponseShape&gt;Promise&lt;BatchMemoryResponseShape&gt;
memoriesbatchGetclient.memories.batchGet(request: BatchMemoryRetrievalRequest, requestOptions?: RequestOptions): Promise&lt;BatchMemoryResponseShape&gt;Promise&lt;BatchMemoryResponseShape&gt;
memoriescontentclient.memories.content(id: string, requestOptions?: RequestOptions): Promise&lt;Uint8Array&gt;Promise&lt;Uint8Array&gt;
memoriescreateclient.memories.create(request: JsonMemoryCreationRequest, requestOptions?: RequestOptions): Promise&lt;MemoryResponseShape&gt;Promise&lt;MemoryResponseShape&gt;
memoriesdeleteclient.memories.delete(id: string, requestOptions?: RequestOptions): Promise&lt;void&gt;Promise&lt;void&gt;
memoriesgetclient.memories.get(id: string, options?: MemoriesGetOptions, requestOptions?: RequestOptions): Promise&lt;MemoryResponseShape&gt;Promise&lt;MemoryResponseShape&gt;
memorieslistclient.memories.list(spaceId: string, options?: MemoriesListOptions, requestOptions?: RequestOptions): Promise&lt;Page&lt;MemoryResponseShape&gt;&gt;Promise&lt;Page&lt;MemoryResponseShape&gt;&gt;
memoriespagesclient.memories.pages(id: string, options?: MemoriesPagesOptions, requestOptions?: RequestOptions): Promise&lt;Page&lt;MemoryPageImageResponseShape&gt;&gt;Promise&lt;Page&lt;MemoryPageImageResponseShape&gt;&gt;
memoriespagesImageclient.memories.pagesImage(id: string, pageIndex: number, options?: MemoriesPagesImageOptions, requestOptions?: RequestOptions): Promise&lt;Uint8Array&gt;Promise&lt;Uint8Array&gt;
memoriesretrieveclient.memories.retrieve(request: MemoriesRetrieveParams, requestOptions?: RequestOptions): AsyncIterable&lt;RetrieveMemoryEventResponseShape&gt;AsyncIterable&lt;RetrieveMemoryEventResponseShape&gt;
ocrdocumentclient.ocr.document(request: OcrDocumentRequest, requestOptions?: RequestOptions): Promise&lt;OcrDocumentResponseShape&gt;Promise&lt;OcrDocumentResponseShape&gt;
systeminfoclient.system.info(requestOptions?: RequestOptions): Promise&lt;SystemInfoResponseShape&gt;Promise&lt;SystemInfoResponseShape&gt;
systeminitclient.system.init(requestOptions?: RequestOptions): Promise&lt;SystemInitResponseShape&gt;Promise&lt;SystemInitResponseShape&gt;
usersgetclient.users.get(options?: UsersGetOptions, requestOptions?: RequestOptions): Promise&lt;UserResponseShape&gt;Promise&lt;UserResponseShape&gt;
usersmeclient.users.me(requestOptions?: RequestOptions): Promise&lt;UserResponseShape&gt;Promise&lt;UserResponseShape&gt;
adminbackgroundJobsPurgeclient.admin.backgroundJobsPurge(request: AdminPurgeJobsRequest, requestOptions?: RequestOptions): Promise&lt;AdminPurgeJobsResponseShape&gt;Promise&lt;AdminPurgeJobsResponseShape&gt;
admindrainclient.admin.drain(request: AdminDrainRequest, requestOptions?: RequestOptions): Promise&lt;AdminDrainResponseShape&gt;Promise&lt;AdminDrainResponseShape&gt;
adminlicenseReloadclient.admin.licenseReload(requestOptions?: RequestOptions): Promise&lt;AdminReloadLicenseResponseShape&gt;Promise&lt;AdminReloadLicenseResponseShape&gt;
adminretrieveMemoryLogPoliciesCreateclient.admin.retrieveMemoryLogPoliciesCreate(request: CreateRetrieveMemoryLogPolicyRequest, requestOptions?: RequestOptions): Promise&lt;RetrieveMemoryLogPolicyResponseShape&gt;Promise&lt;RetrieveMemoryLogPolicyResponseShape&gt;
adminretrieveMemoryLogPoliciesDeleteclient.admin.retrieveMemoryLogPoliciesDelete(id: string, request: DeleteRetrieveMemoryLogPolicyRequest, requestOptions?: RequestOptions): Promise&lt;RetrieveMemoryLogPolicyResponseShape&gt;Promise&lt;RetrieveMemoryLogPolicyResponseShape&gt;
adminretrieveMemoryLogPoliciesGetclient.admin.retrieveMemoryLogPoliciesGet(id: string, options?: AdminRetrieveMemoryLogPoliciesGetOptions, requestOptions?: RequestOptions): Promise&lt;RetrieveMemoryLogPolicyResponseShape&gt;Promise&lt;RetrieveMemoryLogPolicyResponseShape&gt;
adminretrieveMemoryLogPoliciesListclient.admin.retrieveMemoryLogPoliciesList(options?: AdminRetrieveMemoryLogPoliciesListOptions, requestOptions?: RequestOptions): Promise&lt;Page&lt;RetrieveMemoryLogPolicyResponseShape&gt;&gt;Promise&lt;Page&lt;RetrieveMemoryLogPolicyResponseShape&gt;&gt;
apikeyscreateclient.apikeys.create(request: CreateApiKeyRequest, requestOptions?: RequestOptions): Promise&lt;CreateApiKeyResponseShape&gt;Promise&lt;CreateApiKeyResponseShape&gt;
apikeysdeleteclient.apikeys.delete(id: string, requestOptions?: RequestOptions): Promise&lt;void&gt;Promise&lt;void&gt;
apikeyslistclient.apikeys.list(requestOptions?: RequestOptions): Promise&lt;Array&lt;ApiKeyResponseShape&gt;&gt;Promise&lt;Array&lt;ApiKeyResponseShape&gt;&gt;
apikeysupdateclient.apikeys.update(id: string, request: UpdateApiKeyRequest, requestOptions?: RequestOptions): Promise&lt;ApiKeyResponseShape&gt;Promise&lt;ApiKeyResponseShape&gt;
pingonceclient.ping.once(request: PingOnceRequest, requestOptions?: RequestOptions): Promise&lt;PingResultResponseShape&gt;Promise&lt;PingResultResponseShape&gt;
pingstreamclient.ping.stream(request: PingStreamParams, requestOptions?: RequestOptions): AsyncIterable&lt;PingEventResponseShape&gt;AsyncIterable&lt;PingEventResponseShape&gt;

Errors

All HTTP failures raise APIError subclasses. Transport failures raise NetworkError; malformed JSON or NDJSON responses raise ParseError.

ErrorMeaning
GoodMemErrorBase class for SDK errors.
NetworkErrorTransport failures, including mid-stream read failures.
ParseErrorJSON and NDJSON response parse failures.
APIErrorGeneric HTTP error; exposes statusCode, body, and response.
BadRequestErrorHTTP 400.
AuthenticationErrorHTTP 401.
PermissionDeniedErrorHTTP 403.
NotFoundErrorHTTP 404.
ConflictErrorHTTP 409.
UnprocessableEntityErrorHTTP 422.
RateLimitErrorHTTP 429; exposes retryAfter when the header is present.
InternalServerErrorHTTP 5xx.
try {
  await client.memories.get("missing-memory-id");
} catch (error) {
  if (error instanceof NotFoundError) {
    console.log("Memory not found");
  }
}

Data Models

Enum Values

CredentialKind

CREDENTIAL_KIND_UNSPECIFIED, CREDENTIAL_KIND_API_KEY, CREDENTIAL_KIND_GCP_ADC

LengthMeasurement

CHARACTER_COUNT, TOKEN_COUNT, CUSTOM

Modality

TEXT, IMAGE, AUDIO, VIDEO

ProviderType

OPENAI, VLLM, TEI, LLAMA_CPP, VOYAGE, COHERE, JINA

SeparatorKeepStrategy

KEEP_NONE, KEEP_START, KEEP_END

SortOrder

ASCENDING, DESCENDING, SORT_ORDER_UNSPECIFIED

Interfaces

ApiKeyAuth

Configuration for classic API-key authentication.

FieldTypeRequiredDescription
inlineSecretstring | nullnoSecret stored directly in GoodMem (mutually exclusive with secretRef)
secretRefSecretReference | nullnoReference to an external secret manager entry (mutually exclusive with inlineSecret)
headerNamestring | nullnoDesired HTTP header to carry the credential (defaults to Authorization)
prefixstring | nullnoOptional prefix prepended to the secret (e.g., "Bearer ")

ChunkingConfiguration

Configuration for text chunking strategy used when processing content. Exactly one of none, recursive, or sentence must be provided.

FieldTypeRequiredDescription
noneNoChunkingConfiguration | nullnoNo chunking strategy - preserve original content as single unit
recursiveRecursiveChunkingConfiguration | nullnoRecursive hierarchical chunking strategy with configurable separators
sentenceSentenceChunkingConfiguration | nullnoSentence-based chunking strategy with language detection

EndpointAuthentication

Structured credential payload describing how GoodMem should authenticate with an upstream provider.

FieldTypeRequiredDescription
kindCredentialKindyesSelected credential strategy
apiKeyApiKeyAuth | nullnoConfiguration when kind is CREDENTIAL_KIND_API_KEY
gcpAdcGcpAdcAuth | nullnoConfiguration when kind is CREDENTIAL_KIND_GCP_ADC
labelsRecord&lt;string, string&gt; | nullnoOptional annotations to aid operators (e.g., "owner=vertex")

GcpAdcAuth

Configuration for Google Application Default Credentials (ADC).

FieldTypeRequiredDescription
scopesArray&lt;string&gt; | nullnoAdditional OAuth scopes. Empty list falls back to the default cloud-platform scope.
quotaProjectIdstring | nullnoOptional quota project used for billing

GoodMemStatus

Warning or non-fatal status with granular codes (operation continues)

FieldTypeRequiredDescription
code"GOODMEM_STATUS_CODE_UNSPECIFIED" | "INVALID_ARGUMENT" | "NOT_FOUND" | "PERMISSION_DENIED" | "FAILED_PRECONDITION" | "EMBEDDER_FAILED" | "EMBEDDER_UNAVAILABLE" | "EMBEDDER_TIMEOUT" | "VECTOR_SEARCH_FAILED" | "VECTOR_SEARCH_PARTIAL" | "VECTOR_SEARCH_TIMEOUT" | "SPACE_INACCESSIBLE" | "SPACE_NOT_FOUND" | "SPACE_NO_EMBEDDERS" | "CHUNK_NOT_FOUND" | "MEMORY_LOAD_FAILED" | "MEMORY_CONTENT_UNAVAILABLE" | "RERANKING_FAILED" | "SUMMARIZATION_FAILED" | "SUMMARIZATION_TIMEOUT" | "RATE_LIMITED" | "RESOURCE_EXHAUSTED" | "CONFIGURATION_ERROR" | "LLM_CAPABILITY_INFERRED" | "FEATURE_DISABLED"yesStatus code for the warning or informational message
messagestringyesHuman-readable status message
detailsRecord&lt;string, string&gt; | nullnoAdditional contextual details

MemoryCreationRequest

Request body for creating a new Memory. A Memory represents content stored in a space.

FieldTypeRequiredDescription
memoryIdstring | nullnoOptional client-provided UUID for the memory. If omitted, the server generates one. Returns ALREADY_EXISTS if the ID is already in use.
spaceIdstringyesID of the space where this memory will be stored
originalContentstring | nullnoOriginal content as plain text (use either this or originalContentB64)
originalContentB64string | nullnoOriginal content as base64-encoded binary data (use either this or originalContent)
originalContentRefstring | nullnoReference to external content location
contentTypestringyesMIME type of the content
metadataRecord&lt;string, unknown&gt; | nullnoAdditional metadata for the memory
chunkingConfigChunkingConfiguration | nullnoChunking strategy for this memory (if not provided, uses space default)
extractPageImagesboolean | nullnoOptional hint to extract page images for eligible document types (for example, PDFs)
fileFieldstring | nullnoOptional multipart file field name to bind binary content; required when multiple files are uploaded in a batch multipart request.

NoChunkingConfiguration

No chunking strategy - preserves original content as a single unit

No fields.

RecursiveChunkingConfiguration

Recursive hierarchical chunking strategy with configurable separators and overlap

FieldTypeRequiredDescription
chunkSizenumberyesMaximum size of a chunk (should be ≤ context window)
chunkOverlapnumberyesSliding overlap between chunks
separatorsArray&lt;string&gt; | nullnoHierarchical separator list (order = preference)
keepStrategySeparatorKeepStrategyyesHow to handle separators after splitting. KEEP_NONE is deprecated and behaves as KEEP_END.
separatorIsRegexboolean | nullnoWhether separators are regex patterns
lengthMeasurementLengthMeasurementyesHow to measure chunk length

SecretReference

FieldTypeRequiredDescription
uristringyesURI identifying where the secret can be resolved (e.g., vault://, env://)
hintsRecord&lt;string, string&gt; | nullnoOptional metadata to help resolvers decode the secret (e.g., {"encoding":"base64"})

SentenceChunkingConfiguration

Sentence-based chunking strategy with language detection support

FieldTypeRequiredDescription
maxChunkSizenumberyesMaximum size of a chunk
minChunkSizenumberyesMinimum size before creating a new chunk
enableLanguageDetectionboolean | nullnoWhether to detect language for better segmentation
lengthMeasurementLengthMeasurementyesHow to measure chunk length

SystemInitRequest

Request for initializing the system. No parameters required.

No fields.

Response Shapes

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

ApiKeyAuthResponseShape

Type constraint: ApiKeyAuthResponseShape = RequireExactlyOne&lt;ApiKeyAuthResponseShapeBase, "inlineSecret" \| "secretRef"&gt;

FieldTypeRequiredDescription
inlineSecretstring | nullnoSecret stored directly in GoodMem (mutually exclusive with secretRef)
secretRefSecretReferenceResponseShape | nullnoReference to an external secret manager entry (mutually exclusive with inlineSecret)
headerNamestring | nullnoDesired HTTP header to carry the credential (defaults to Authorization)
prefixstring | nullnoOptional prefix prepended to the secret (e.g., "Bearer ")

ChunkingConfigurationResponseShape

Type constraint: ChunkingConfigurationResponseShape = RequireExactlyOne&lt;ChunkingConfigurationResponseShapeBase, "none" \| "recursive" \| "sentence"&gt;

FieldTypeRequiredDescription
noneNoChunkingConfigurationResponseShape | nullnoNo chunking strategy - preserve original content as single unit
recursiveRecursiveChunkingConfigurationResponseShape | nullnoRecursive hierarchical chunking strategy with configurable separators
sentenceSentenceChunkingConfigurationResponseShape | nullnoSentence-based chunking strategy with language detection

EndpointAuthenticationResponseShape

Type constraint: discriminated union on kind with response-shaped credential payloads; kind: null is allowed for unknown server enum values.

FieldTypeRequiredDescription
kindCredentialKind | nullyesSelected credential strategy
apiKeyApiKeyAuthResponseShape | nullnoConfiguration when kind is CREDENTIAL_KIND_API_KEY
gcpAdcGcpAdcAuthResponseShape | nullnoConfiguration when kind is CREDENTIAL_KIND_GCP_ADC
labelsRecord&lt;string, string&gt; | nullnoOptional annotations to aid operators (e.g., "owner=vertex")

GcpAdcAuthResponseShape

FieldTypeRequiredDescription
scopesArray&lt;string&gt; | nullnoAdditional OAuth scopes. Empty list falls back to the default cloud-platform scope.
quotaProjectIdstring | nullnoOptional quota project used for billing

GoodMemStatusResponseShape

FieldTypeRequiredDescription
code"GOODMEM_STATUS_CODE_UNSPECIFIED" | "INVALID_ARGUMENT" | "NOT_FOUND" | "PERMISSION_DENIED" | "FAILED_PRECONDITION" | "EMBEDDER_FAILED" | "EMBEDDER_UNAVAILABLE" | "EMBEDDER_TIMEOUT" | "VECTOR_SEARCH_FAILED" | "VECTOR_SEARCH_PARTIAL" | "VECTOR_SEARCH_TIMEOUT" | "SPACE_INACCESSIBLE" | "SPACE_NOT_FOUND" | "SPACE_NO_EMBEDDERS" | "CHUNK_NOT_FOUND" | "MEMORY_LOAD_FAILED" | "MEMORY_CONTENT_UNAVAILABLE" | "RERANKING_FAILED" | "SUMMARIZATION_FAILED" | "SUMMARIZATION_TIMEOUT" | "RATE_LIMITED" | "RESOURCE_EXHAUSTED" | "CONFIGURATION_ERROR" | "LLM_CAPABILITY_INFERRED" | "FEATURE_DISABLED" | nullyesStatus code for the warning or informational message
messagestringyesHuman-readable status message
detailsRecord&lt;string, string&gt; | nullnoAdditional contextual details

NoChunkingConfigurationResponseShape

No fields.

RecursiveChunkingConfigurationResponseShape

FieldTypeRequiredDescription
chunkSizenumberyesMaximum size of a chunk (should be ≤ context window)
chunkOverlapnumberyesSliding overlap between chunks
separatorsArray&lt;string&gt; | nullnoHierarchical separator list (order = preference)
keepStrategySeparatorKeepStrategy | nullyesHow to handle separators after splitting. KEEP_NONE is deprecated and behaves as KEEP_END.
separatorIsRegexboolean | nullnoWhether separators are regex patterns
lengthMeasurementLengthMeasurement | nullyesHow to measure chunk length

SecretReferenceResponseShape

FieldTypeRequiredDescription
uristringyesURI identifying where the secret can be resolved (e.g., vault://, env://)
hintsRecord&lt;string, string&gt; | nullnoOptional metadata to help resolvers decode the secret (e.g., {"encoding":"base64"})

SentenceChunkingConfigurationResponseShape

FieldTypeRequiredDescription
maxChunkSizenumberyesMaximum size of a chunk
minChunkSizenumberyesMinimum size before creating a new chunk
enableLanguageDetectionboolean | nullnoWhether to detect language for better segmentation
lengthMeasurementLengthMeasurement | nullyesHow to measure chunk length