automem icon indicating copy to clipboard operation
automem copied to clipboard

Feature request: Support configurable OpenAI-compatible providers (e.g., custom base URL like OpenRouter)

Open BasuruK opened this issue 9 months ago • 3 comments

Hi, and thanks for the great work on this project.

I’d like to request support for configurable OpenAI-compatible API providers. At the moment, the implementation appears to default to the OpenAI base URL, which makes it difficult to use other providers that expose OpenAI-compatible endpoints.

Use case Many providers (for example, OpenAI-compatible gateways) offer the same API format but require a different base URL and API key. Allowing a configurable endpoint would make the project more flexible and usable across multiple providers.

Suggested enhancement

Add a configurable base_url (or provider endpoint) setting

Allow OpenAI-compatible API keys from other providers

Optionally expose this via config/env/UI setting

Keep OpenAI as the default for backward compatibility

Example Being able to switch from:

default OpenAI endpoint to:

custom OpenAI-compatible endpoint (via config)

I’m happy to help test if this is added or happy to do it myself and open a PR :) . Thanks for considering this improvement.

BasuruK avatar Feb 14 '26 11:02 BasuruK

⚠️ Possible Duplicate Issue(s)
  • https://github.com/verygoodplugins/automem/issues/53

📝 Issue Planner

Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.

  • [ ] Create Plan

🧪 Issue enrichment is currently in open beta.

You can configure auto-planning by selecting labels in the issue_enrichment configuration.

To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

issue_enrichment:
  auto_enrich:
    enabled: false

💬 Have feedback or questions? Drop into our discord!

coderabbitai[bot] avatar Feb 14 '26 11:02 coderabbitai[bot]

Hey @BasuruK, thanks for opening this — great suggestion.

So the good news is this actually partially worked already because the OpenAI Python SDK respects the OPENAI_BASE_URL environment variable under the hood. But it wasn't documented anywhere, and there was a real gotcha: we were unconditionally sending the dimensions parameter in the embeddings request, which most OpenAI-compatible providers don't support and would choke on.

We've just landed proper support for this in #76:

  • OPENAI_BASE_URL is now an explicit, documented configuration option
  • The dimensions parameter is automatically omitted when talking to non-OpenAI endpoints (detected by checking if the base URL points to api.openai.com)
  • Provider name in logs/health reflects whether you're using native OpenAI or a compatible provider
  • Docs updated across the board (env vars reference, README, installation guide, .env.example)

Usage is straightforward:

EMBEDDING_PROVIDER=openai
OPENAI_API_KEY=sk-or-v1-your-key
OPENAI_BASE_URL=https://openrouter.ai/api/v1
EMBEDDING_MODEL=openai/text-embedding-3-small
VECTOR_SIZE=768

One thing to note: since we can't use OpenAI's dimension truncation with third-party providers, you'll need to set VECTOR_SIZE to match the model's native output dimension.

This will be included in the next tagged release (after v0.10.1), but if you're running from source you can pull main now to use it. Thanks again for the nudge to get this properly supported and documented!

jack-arturo avatar Feb 16 '26 10:02 jack-arturo

Wow! Thanks for the reply and information! I will check this out.

BasuruK avatar Feb 16 '26 10:02 BasuruK