memorix icon indicating copy to clipboard operation
memorix copied to clipboard

OrcaRouter provider support for Memorix

Open nissrin2020ali-ux opened this issue 2 months ago • 2 comments

Context

Memorix is a local-first shared memory layer for AI coding agents. Your README pitch — use Claude Code today, Codex tomorrow, and Cursor in the afternoon, with project memory that stays the same — targets a workflow pain: design decisions get buried in chats users cannot find again. Git Memory turns commits into searchable engineering facts, and Reasoning Memory keeps the rationale and trade-offs alive.

That intelligence is LLM-backed, and Memorix already models it as provider lanes: [memory.llm], [embedding], and memcode's [agent] accept provider, model, base_url, and api_key, with OpenAI-compatible gateways like DashScope and OpenRouter documented. An OrcaRouter option would give Memorix users a routing layer for memory-formation calls — provider failover when an upstream model degrades, plus centralised usage and budget visibility for teams running a shared background service.

Proposal

Add OrcaRouter as an optional provider for Memorix's model-backed lanes. It would not replace or change any existing provider — users who are happy with DeepSeek, DashScope, OpenRouter, or a local gateway keep their current config untouched. OrcaRouter exposes an OpenAI-compatible API and uses standard API-key authentication, so the expected integration point is Memorix's existing abstraction: set base_url to OrcaRouter's endpoint and add an OrcaRouter API key in [memory.llm], [agent], and/or [embedding], exactly as docs/CONFIGURATION.md documents for OpenAI-compatible gateways today. Maintainers could optionally add OrcaRouter-aware defaults similar to the existing OpenRouter embedding special-case. This is a proposal only — nothing is implemented or tested yet.

Why this is useful for Memorix users specifically:

  • Automatic model routing and provider failover — background memory formation, summarization, deduplication, and cleanup keep working when a single upstream model provider is slow or down.
  • Prompt caching — the LLM-heavy formation/cleanup pipeline pays less on repeated context.
  • Usage tracking, budgets, and team access controls — valuable for teams that run Memorix as a shared background/HTTP service across multiple agents.
  • One endpoint for many chat and reasoning models — users can switch the model used for a memory lane without reworking config.

OrcaRouter already has a presence in the open-source ecosystem: projects such as goose, OpenCode (an agent Memorix supports directly), and Dify build against it.

Transparency note: OrcaRouter runs an optional open-source partner program, where approved OSS projects can receive a 5% revenue share from OrcaRouter usage attributed to their integration. Taking part is not a prerequisite for integration, and I will follow whatever disclosure or governance requirements Memorix prefers.

Full provider details are at https://www.orcarouter.ai/built-with. I'm an engineer on the OrcaRouter team — I'd welcome maintainers' thoughts on whether this fits Memorix's provider model, and I'm happy to submit an implementation PR if you'd like one.

nissrin2020ali-ux avatar Sep 09 '26 02:09 nissrin2020ali-ux

Thanks for the detailed proposal. We checked the current provider paths before deciding whether this needs a code change. Memorix already accepts OpenAI-compatible gateways through the existing base_url, model, and api_key settings for [memory.llm], [agent], and [embedding]; the LLM lane uses chat completions and the embedding lane uses /embeddings. That means OrcaRouter should be usable by configuration, without adding a new provider enum or hard-coding a vendor-specific branch.

We are keeping this open as an integration/docs suggestion rather than treating it as a core feature gap. An exact OrcaRouter configuration example and a small smoke matrix for chat, embedding, and fallback behavior would be useful in a follow-up docs PR. Any commercial or revenue-sharing relationship is separate from the technical integration and is not assumed by this issue.

AVIDS2 avatar Sep 09 '26 15:09 AVIDS2

Thanks for checking the provider paths — a config-only integration is the right call, and OrcaRouter's API surface fits it. Verified against docs.orcarouter.ai and the PrivateGPT/Langflow provider notes so the docs example is accurate.

OrcaRouter surface

  • OpenAI-compatible base URL: https://api.orcarouter.ai/v1; keys start with sk-orca-.
  • Chat: POST /v1/chat/completions — matches Memorix's LLM/agent lane.
  • Embeddings: POST /v1/embeddings — matches the embedding lane with provider = "api".
  • Model IDs are namespaced by upstream provider (openai/gpt-4o-mini, anthropic/claude-sonnet-5, deepseek/deepseek-chat, qwen/qwen3-embedding-8b, …). A routing model orcarouter/auto selects an upstream per request.

Two caveats a docs example needs to cover

  1. When base_url is not OpenRouter, Memorix's embedding default is the bare text-embedding-3-small, which is not a valid OrcaRouter model ID. An OrcaRouter embedding config must set an explicit namespaced model; the OpenRouter-only default special-case does not apply.
  2. For deterministic lanes (embeddings, structured output), prefer a fixed namespaced model over orcarouter/auto, since the auto route picks per-request by task type/difficulty.

Example (memorix.toml)

[memory.llm]
provider = "openai"
base_url = "https://api.orcarouter.ai/v1"
model = "openai/gpt-4o-mini"   # or "orcarouter/auto"

[embedding]
provider = "api"
base_url = "https://api.orcarouter.ai/v1"
model = "openai/text-embedding-3-small"

[agent]
provider = "openai"
base_url = "https://api.orcarouter.ai/v1"
model = "openai/gpt-4o-mini"

Secrets via env: MEMORIX_LLM_API_KEY=sk-orca-…, MEMORIX_EMBEDDING_API_KEY=sk-orca-…. Since the base URL already carries /v1, Memorix uses it as-is. memcode's /model and /login still own interactive auth/switching for the agent lane.

Smoke matrix for the docs PR (each row = behavior to verify against the above config before merging):

  • LLM lane: memory formation/dedup succeeds via /v1/chat/completions with a fixed namespaced model, and with orcarouter/auto.
  • Embedding lane: /v1/embeddings returns vectors; memorix status reflects the namespaced model; dimension auto-detection is exercised (no manual dimensions override needed).
  • Memorix-side fallback: with OrcaRouter unreachable, LLM formation degrades to heuristic mode and embedding falls back to BM25/full-text as documented — confirm no crash or partial state.
  • Agent lane: memcode interactive completion against the same base URL.

I can prepare this as the follow-up docs PR.

nissrin2020ali-ux avatar Sep 09 '26 18:09 nissrin2020ali-ux