FishMem

Client configuration

Configure authentication, deployment URLs, fetch behavior, headers, and request cancellation.

Constructor

const fishmem = new FishMem({
  apiKey: "fm_...",
  baseUrl: "https://fishmem.com",
  fetch: globalThis.fetch,
  headers: {
    "X-Application": "support-agent",
  },
});
OptionRequiredDescription
apiKeyyesProject API key sent as Authorization: Bearer ….
baseUrlnoCloud or self-hosted origin. Defaults to https://fishmem.com.
fetchnoStandards-compatible fetch implementation. Uses globalThis.fetch.
headersnoHeaders included with every request.

The constructor fails immediately when apiKey is empty or the runtime has no fetch. It does not silently switch endpoints or install a Node-only fetch polyfill.

Per-request options

Every method accepts an optional final argument:

await fishmem.memories.search(
  { query: "deployment decision", user_id: "alex" },
  {
    signal: AbortSignal.timeout(5_000),
    headers: { "X-Trace-Id": traceId },
  },
);
OptionPurpose
signalCancel or time-limit a request.
headersAdd or override headers for this request.
idempotencyKeyMake a mutation safe to retry.

Self-hosted deployments

baseUrl is the origin, not the /v1 path:

const fishmem = new FishMem({
  apiKey: env.FISHMEM_API_KEY,
  baseUrl: "https://memory.internal.example",
});

The SDK calls /v1/memories, /v1/operations, and the other versioned API routes beneath that origin.

On this page