feat: add support for custom OpenAI endpoints (OPENAI_BASE_URL)#5
feat: add support for custom OpenAI endpoints (OPENAI_BASE_URL)#5anaxsouza wants to merge 2 commits into
Conversation
This commit adds support for custom OpenAI-compatible endpoints, allowing users to use providers like OpenCode Zen, Azure OpenAI, or self-hosted models with Memory Bank. Changes: - Add DEFAULT_OPENAI_URL constant in memory-bank-app - Add openai_url field to ServerSettings struct - Add base_url field to LlmProviderConfig::OpenAi variant - Support OPENAI_BASE_URL environment variable - Update OpenAI client builder to use custom base_url when provided - Update tests to include base_url field - Add documentation to README.md Example usage: export OPENAI_BASE_URL=https://opencode.ai/zen/v1 export OPENAI_API_KEY=your-key mb service restart Closes: feelingsonice/MemoryBank#<issue_number>
|
Thanks for the PR. There's a compiler error: Looking at it I'm guessing you want custom OpenAI endpoints? If you want to open a feature request issue I'm happy to add it. |
Rust pattern matching requires all struct fields to be mentioned or explicitly ignored with '..' or '_'. Added '..' to ignore api_key in the OpenAi variant pattern.
|
Thank you for catching the compilation error! I appreciate the quick feedback. You're correct - this PR adds support for custom OpenAI endpoints. The implementation allows:
This enables users to use OpenAI-compatible providers like OpenCode Zen, Azure OpenAI, or self-hosted models. The compilation error has been fixed in commit 4badc81 - I added the missing All tests should pass now. Thank you for this amazing tool!!!!!! |
|
I don't have permission to push to your fork so I opened a new PR here -- #6 |
Summary
Adds support for custom OpenAI-compatible endpoints, allowing users to use providers like OpenCode Zen, Azure OpenAI, or self-hosted models with Memory Bank.
Changes
DEFAULT_OPENAI_URLconstant in memory-bank-appopenai_urlfield in ServerSettings structbase_urlfield in LlmProviderConfig::OpenAi variantOPENAI_BASE_URLenvironment variableUsage
Environment variables:
settings.toml:
Testing
When a custom endpoint is configured, it appears in logs as
OpenAi::model@urlfor easy identification.