RememberStackremember.dev/docs

Models and providers

RememberStack calls language models to read your documents and an embedding model to make them searchable. A self-hosted deployment sends every one of those calls through OpenRouter with the key in REMEMBERSTACK_OPENROUTER_API_KEY, and pays for them on that account. This page lists each place a model is used (a seat), what it does, and the settings that shape the calls.

Retrieval itself calls no language model. A search embeds your query text once; the operations, graph and SQL queries then read the database.

Model seats

Each seat is one environment variable holding an OpenRouter model id. The defaults are the values compose.yaml passes when .env leaves them unset.

SeatVariableDefaultWhat it does
Structure fallbackREMEMBERSTACK_STRUCTURER_MODELopenai/gpt-6-lunaProposes section anchors when a document's own headings do not give a usable outline. A document whose headings pass the structure checks never reaches this seat.
Skeleton checkREMEMBERSTACK_SKELETON_CHECK_MODELopenai/gpt-6-lunaChecks a proposed section outline in a separate call from the one that proposed it.
Section roleREMEMBERSTACK_ROLE_MODELopenai/gpt-6-lunaClassifies what each section is for, from its title.
Section summaryREMEMBERSTACK_SUMMARY_MODELopenai/gpt-6-lunaWrites the short summary of each section.
Claim extractionREMEMBERSTACK_E2_EXTRACT_MODELopenai/gpt-6-lunaSelects the sentences that state something and turns them into claims. Used by both the extract_claims and ground_claims workers.
Relation normalisationREMEMBERSTACK_E3_NORMALIZE_MODELopenai/gpt-6-lunaTurns claims into relations between entities.
Entity resolutionREMEMBERSTACK_OBS_SMALL_MODELopenai/gpt-6-lunaDecides between candidate entities when the deterministic name matching cannot.
Fact adjudication (prompt engine)REMEMBERSTACK_FACT_MODELopenai/gpt-6-lunaDecides whether a new statement confirms, contradicts or replaces a fact the memory holds, when REMEMBERSTACK_FACT_ADJUDICATION_ENGINE=prompt. The default jev engine uses Jev instead (see below).
EmbeddingsREMEMBERSTACK_P1_EMBEDDING_MODELqwen/qwen3-embedding-8bEvery vector: chunks, claims, facts, entity profiles, and the query text of each search.

GET /deployment reports the models the running deployment is bound to under model_bindings, so you can check what is serving:

curl http://localhost:8000/deployment

Fact adjudication

Fact adjudication decides what the memory holds true, so it has two extra settings:

VariableDefaultMeaning
REMEMBERSTACK_FACT_ADJUDICATION_ENGINEjevjev asks TypeSafe AI's System One model Jev, through OpenRouter by default. prompt asks REMEMBERSTACK_FACT_MODEL through OpenRouter instead.
REMEMBERSTACK_FACT_CONFIDENCE_FLOOR0.75Below this confidence the adjudicator does not replace or contradict anything: the new statement and the existing fact are both kept.

The jev engine has its own settings:

VariableDefault
REMEMBERSTACK_TYPESAFE_ROUTEopenrouter: Jev is called through OpenRouter with your OpenRouter key (see below). Set typesafe to call TypeSafe's own API instead.
REMEMBERSTACK_TYPESAFE_API_KEYnone (required only on the typesafe route; the fact workers refuse to start without it there)
REMEMBERSTACK_TYPESAFE_MODELjev-latest
REMEMBERSTACK_TYPESAFE_BASE_URLhttps://api.typesafe.ai/v1
REMEMBERSTACK_TYPESAFE_TIMEOUT_S30.0
REMEMBERSTACK_FACT_FALLBACK_TO_PROMPTfalse. When true, a failed TypeSafe call falls back to the prompt engine instead of failing the work item.

Jev through OpenRouter

OpenRouter serves a TypeSafe-compatible System One endpoint (POST /api/v1/systemone). On the default REMEMBERSTACK_TYPESAFE_ROUTE=openrouter, the jev engine calls it with REMEMBERSTACK_OPENROUTER_API_KEY and REMEMBERSTACK_OPENROUTER_BASE_URL, so Jev spend lands on your OpenRouter account and no TypeSafe key is needed. REMEMBERSTACK_TYPESAFE_BASE_URL and REMEMBERSTACK_TYPESAFE_API_KEY are ignored on this route. The recorded cost is the usage.cost OpenRouter reports; a response without it fails as an accounting error.

With REMEMBERSTACK_OPENROUTER_ZDR=true, every Jev call also sends "provider": {"zdr": true, "data_collection": "deny"}, so OpenRouter routes it only to endpoints your account or key policy counts as zero data retention: TypeSafe's ZDR endpoint, plus Safety Retention endpoints if that policy allows them (see below). With ZDR on, the engine refuses to start on the direct typesafe route, because TypeSafe's own API cannot be held to zero data retention, refuses a REMEMBERSTACK_OPENROUTER_BASE_URL outside the https://openrouter.ai origin (the default, https://openrouter.ai/api/v1, is fine; provider.zdr binds only OpenRouter), and refuses the OpenAI Decisions backup below, because it would send the same content outside OpenRouter; keep REMEMBERSTACK_TYPESAFE_BACKUP=none.

The request flag alone does not guarantee strict zero retention. OpenRouter combines zdr: true with your account's policy (or the policy of the guardrail on the API key), and that policy decides whether Safety Retention endpoints also count. A Safety Retention endpoint may keep any request, flagged or not, to detect and prevent abuse. OpenRouter sets this choice separately for Google models and All other models; Jev is in All other models. Self-serve accounts allow Safety Retention by default, and no request field turns it off. For strict zero retention, set your OpenRouter account, or the guardrail on every key the engine uses, to ZDR only with Safety Retention excluded for that group, and confirm it before you send customer content. Also keep OpenRouter's own input and output logging turned off for the account, since that is a separate setting from provider routing. OpenRouter also screens requests for child sexual abuse material, ZDR traffic included: flagged content may be retained for OpenRouter's human review, and material reported where the law requires it is preserved for the legal period. No setting removes that, so check that OpenRouter's terms meet your retention requirement. See OpenRouter's ZDR guide. The response names TypeSafe as the provider for both Jev endpoints, so it does not show which one served a call.

# The defaults already select Jev on the openrouter route; ZDR is opt-in.
REMEMBERSTACK_OPENROUTER_ZDR=true

With Docker Compose, put these in the project .env. The services read REMEMBERSTACK_OPENROUTER_ZDR and REMEMBERSTACK_OPENROUTER_BASE_URL only from there (env_file), so a value exported in your shell does not reach the engine, and an alternate --env-file cannot override or clear them.

Change a model

Put the new model id in .env and apply it:

# .env
REMEMBERSTACK_E2_EXTRACT_MODEL=openai/gpt-5.6-sol
docker compose up -d

Use exact model ids. A rotating router id such as openrouter/free makes results impossible to reproduce and to attribute. A chat seat needs a model that supports structured (JSON schema) output, because every seat asks for a typed answer and rejects one that does not match.

A new model applies to work done from then on. Documents already processed keep what the old model produced; RememberStack does not re-run them on its own.

Changing the embedding model

Every vector in RememberStack has 1,536 dimensions. The column types, the search channels and every request are fixed at that size: the engine asks the provider for 1,536 dimensions and rejects a response of any other length. An embedding model can replace qwen/qwen3-embedding-8b only if it can return 1,536-dimension vectors on request.

Each stored vector is stamped with the model that produced it, and search compares a query only with vectors of the same model. Nothing re-embeds stored chunks, claims and facts, so the embedding model is fixed once anything has been embedded:

  • Before the first document is embedded, you can change REMEMBERSTACK_P1_EMBEDDING_MODEL freely.
  • After that, setup refuses to run with a different model. It exits with an error that names the configured model and the stored one, and the API and workers do not start. Set the variable back to the stored model.

To change it before anything is embedded, stop the workers first (docker compose stop), then change the variable and run docker compose up -d. A worker still running on the old model could otherwise embed with it after the switch; the next setup would then refuse the new model.

To use a different embedding model, start a new deployment and send the documents again.

Optional OpenAI Decisions backup for Jev

With the jev engine, Jev stays primary. Set REMEMBERSTACK_TYPESAFE_BACKUP=openai_decisions and REMEMBERSTACK_OPENAI_DECISIONS_API_KEY to permit one native Decisions request after exhausted connection-establishment, rate-limit (429), or overload (529) failures. The default is none. The backup uses gpt-6-luna on OpenAI's native API; OpenRouter credit does not pay for it. Outside Compose, OPENAI_API_KEY is also accepted. Compose forwards only the prefixed credential, so set that variable for container deployments. Native response handling has only been validated with offline mock transports. Run a small live API check with your native credential before enabling the backup.

Valid low confidence, invalid credentials, malformed answers, ambiguous read timeouts, generic gateway errors and missing usage do not trigger the backup. The adapter supports choice, yes/no and score questions and retains the full option set. Decisions cannot silently invent an option or replace an uncertain answer with one from another provider. Evaluate both providers on your own labeled cases before sharing a confidence threshold between them.

Usage records identify openai-decisions/<served-model>. Costs include ordinary input, cache reads, 30-minute cache writes, long-context rates and regional multipliers; output tokens are free on this endpoint. The initial verified global short-context rates are $0.10/$0.01/$0.125 per million tokens for ordinary, cached and cache-write input, respectively. Price settings are configurable; keep them current with OpenAI's pricing. The current LoCoMo profile explicitly disables this backup.

OpenRouter routing and limits

Entity resolution gives the model a closed list of existing candidate IDs and an explicit new-entity outcome. Both the provider schema and local validation reject IDs outside that list. Choosing a new entity uses a null ID; the engine creates the ID. Invalid matches never implicitly create entities.

These settings apply to every call through OpenRouter.

VariableDefaultMeaning
REMEMBERSTACK_OPENROUTER_CHAT_PROVIDER_ORDERunsetComma-separated provider slugs to try first for chat calls. Other providers remain a fallback unless the same set is also supplied as the hard allowlist.
REMEMBERSTACK_OPENROUTER_CHAT_PROVIDER_ONLYunsetComma-separated provider slugs that are the only ones allowed. Alone it disables fallback. Combine with an order naming exactly the same unique slugs to allow fallback within this set.
REMEMBERSTACK_OPENROUTER_EMBEDDING_PROVIDER_ORDERunsetProvider slugs to try first for embeddings, with fallback, for example nebius,deepinfra,siliconflow. Other providers remain a fallback unless the same set is also supplied as the embedding allowlist.
REMEMBERSTACK_OPENROUTER_EMBEDDING_PROVIDER_ONLYunsetComma-separated provider slugs that are the only ones allowed for embeddings, for example nebius,deepinfra. With two or more slugs, OpenRouter falls back only within the list; with one, fallback is off, also when an order is set. An embedding order used with it must name exactly the same unique slugs. Cannot be combined with REMEMBERSTACK_OPENROUTER_EMBEDDING_PROVIDER. A blank entry (including a trailing comma) stops startup.
REMEMBERSTACK_OPENROUTER_EMBEDDING_PROVIDERunsetOne provider slug that embeddings must use, with no fallback. The order wins if both are set.
REMEMBERSTACK_OPENROUTER_ZDRfalseRestricts chat and embedding calls, and Jev calls on the openrouter route, to endpoints your OpenRouter account or key policy counts as zero data retention (see the Safety Retention note above).
REMEMBERSTACK_OPENROUTER_REASONING_EFFORTunset (model default)One of none, minimal, low, medium, high, xhigh, max, applied to every chat call.
REMEMBERSTACK_OPENROUTER_REASONING_EFFORT_MAPunsetA JSON object of model id to effort. An entry wins over the global value for that model.
REMEMBERSTACK_OPENROUTER_MAX_COMPLETION_TOKENS32000Output allowance per chat call, reasoning included.
REMEMBERSTACK_OPENROUTER_TIMEOUT_S120Per-request timeout in seconds.
REMEMBERSTACK_OPENROUTER_CHAT_THROTTLE_RETRIES3How many times a chat call that gets HTTP 429 is retried, moving to the next listed provider. These retries do not count against the work item's attempts.
REMEMBERSTACK_OPENROUTER_CHAT_UPSTREAM_OVERLOAD_MAX_RETRY_AFTER_S30The longest single wait before retrying an overloaded provider.
REMEMBERSTACK_OPENROUTER_BASE_URLhttps://openrouter.ai/api/v1The OpenRouter API address.

When you set a provider list or ZDR, each chat call also tells OpenRouter not to route to providers that collect data (data_collection: deny). With none of them set, OpenRouter applies your account's own routing settings.

With REMEMBERSTACK_OPENROUTER_ZDR=true, every chat and embedding call carries zdr: true and data_collection: deny, even when no provider list is set, so a fallback can only reach a zero-data-retention endpoint. To keep embeddings on approved zero-data-retention hosts, combine it with the allowlist:

REMEMBERSTACK_OPENROUTER_ZDR=true
REMEMBERSTACK_OPENROUTER_EMBEDDING_PROVIDER_ONLY=nebius,deepinfra
# Leave both empty: a pin stops startup, and an order adds an "order" field.
REMEMBERSTACK_OPENROUTER_EMBEDDING_PROVIDER_ORDER=
REMEMBERSTACK_OPENROUTER_EMBEDDING_PROVIDER=

Each embedding call then sends {"only": ["nebius", "deepinfra"], "allow_fallbacks": true, "data_collection": "deny", "zdr": true}. An embedding order alone (without the allowlist) may fall back to any host serving the model. The image-description converter has its own switch, REMEMBERSTACK_IMAGE_DESCRIPTION_ZDR; see converters.

The request flags alone do not guarantee strict zero retention. OpenRouter combines zdr: true with your account's ZDR settings (or those of the guardrail on the API key), which are set per model group: OpenAI, Anthropic, Google, SpaceXSI and All other models. For Google and All other models they also decide whether Safety Retention endpoints count. A Safety Retention endpoint may keep the prompt and response of any request, flagged or not, to detect and prevent abuse, and self-serve accounts allow it by default. The default OpenAI chat and image-description models are in OpenAI; Qwen embeddings are in All other models; a Google model in any role adds Google. No request field changes these settings. If you need strict zero retention, set your OpenRouter account, or the guardrail on every key the engine uses, to enforce ZDR for every group your models fall in, with Safety Retention excluded for Google and All other models. OpenRouter's own logging is separate from provider routing: exclude the engine's keys from Input & Output Logging and keep the account's data-sharing logging opt-in off, or OpenRouter itself can store prompts and completions. Check that the endpoints you pin stay eligible, and confirm all of it before you send customer content. See OpenRouter's ZDR guide and logging guide.

With Docker Compose, set REMEMBERSTACK_OPENROUTER_ZDR and REMEMBERSTACK_OPENROUTER_EMBEDDING_PROVIDER_ONLY in the project .env as literal values (no ${...} references). The services read them only from there (env_file): a value exported in your shell, or one in an alternate --env-file, does not reach the engine, so neither can override or clear what .env says. A blank REMEMBERSTACK_OPENROUTER_ZDR stops startup; a blank allowlist means no allowlist.

These embedding settings need an engine image that includes them; an older image ignores them without an error (it still honours REMEMBERSTACK_OPENROUTER_ZDR for chat). Until a release includes them, check out a revision that does and build from it with docker compose up --build -d --wait. Before you send customer content, check GET /deployment (see deployment): build_revision must be that revision and model_bindings.openrouter_embedding_provider_only must list your hosts. An image without this feature does not report that key.

An explicit Flex capacity rejection can arrive inside HTTP 200 and include an ID even though processing did not start. When that error carries neither choices nor usage, the adapter applies its bounded capacity retries while keeping your provider restriction. To prefer Flex and permit normal OpenAI processing when Flex is unavailable, set both chat provider variables to openai/flex,openai. This keeps the requested model and reasoning effort; standard processing can cost more, and no other provider is admitted. A Flex-only allowlist continues to forbid standard-price fallback.

The same bounded retry path handles a transient error whose error.metadata.error_type is provider_unavailable, even when OpenRouter has allocated an ID, provided neither choices nor usage is present. This follows OpenRouter's failed-attempt billing policy. Generic ID-bearing errors and any response with choices or usage still require accounting recovery; this rule does not assume missing usage means zero cost.

If a completed response has unusable token or cost accounting, the adapter looks up that existing generation's metadata. If recovery fails, the work item stops with an accounting error containing the generation ID and lookup status. Use those identifiers to reconcile the request with the provider before retrying paid work. The adapter does not invent a zero cost or automatically generate the same potentially paid response again.

A reply can arrive with a success status but a body that is not a JSON object: empty, only whitespace, an HTML page, a cut-off object, or a JSON value such as null or []. The call then fails with an ordinary OpenRouter provider error, on chat and embedding calls alike. The message names the endpoint, the status, the body size and the kind of problem, for example:

OpenRouter /chat/completions returned 200 with an undecodable body (body=whitespace_only, body_bytes=26, decode_error='Expecting value', decode_pos=26)

The message never contains the body text, headers or your API key. A success status does not prove the request was free, so usage stays unknown rather than zero. The adapter does not treat this as a capacity rejection, so it does not retry, rotate to another provider, or start a new retry budget. Callers handle it as an ordinary provider error, using their existing retry or fallback policy: some stages retry the work item, while optional steps, such as section summaries, continue without the model's answer. Valid replies and the capacity retries above work as before.

Lowering reasoning effort makes extraction faster and cheaper; the comment in .env.example notes that none can reduce adjudication quality and that some models reject it. A map sets the effort for one model id only:

REMEMBERSTACK_OPENROUTER_REASONING_EFFORT_MAP={"openai/gpt-6-luna":"high"}

For debugging, REMEMBERSTACK_OPENROUTER_INVALID_COMPLETION_CAPTURE_DIR (an absolute path, for example /var/lib/rememberstack/openrouter-invalid-completions) keeps every model answer that failed schema validation and each response whose accounting could not be recovered, one file each, readable only by the engine user. Accounting captures keep the original provider response for reconciliation and do not authorize replay. These files can repeat text from your documents; treat the directory as customer data and leave the setting off otherwise.

Cost

Every document costs model calls: section work during structuring, claim extraction for every chunk, relation normalisation, entity resolution and fact adjudication for what it says, and embeddings for its chunks, claims and facts. Each search costs one query embedding. The size of the bill depends on your documents and the models you choose; RememberStack has published no per-document cost figures.

Every billed call is written to the cost ledger with its model, tokens, cost in US dollars and the pipeline stage that made it. Read it with the cost export, and cap it per stage with spend budgets. The provider account's own limit is the final monetary boundary.