Skip to content

[FEAT]: Allow Customization of Base URL for OpenAI-Compatible LLM Models #3111

Description

@CaoMeiYouRen

What would you like to see?

Issue Title: Allow Customization of Base URL for OpenAI-Compatible LLM Models

Description:
Currently, when configuring an OpenAI-compatible LLM model (e.g., local/self-hosted models or third-party services that mimic the OpenAI API), the base URL is hardcoded to OpenAI's default endpoint. This limits flexibility for users who want to integrate models hosted on alternative URLs, such as local instances (e.g., Ollama, LocalAI),custom cloud deployments, or other OpenAI-compatible API providers.

Suggested Solution:
Add an optional Base URL field in the LLM configuration settings for OpenAI-compatible models. This field would allow users to override the default base URL (e.g., https://api.openai.com/v1) with a custom endpoint (e.g., http://localhost:11434/v1).

Example Implementation:

In the model configuration UI, include a text input labeled "Custom Base URL" (optional).

If the field is left empty, fall back to the default OpenAI URL.

Ensure the configured base URL is properly validated and used for all API requests to the model.

Why This Matters:

Enables integration with self-hosted or niche OpenAI-compatible models.

Supports local development/testing (e.g., using localhost endpoints).

Increases compatibility with emerging LLM API providers that adopt the OpenAI schema.

Additional Context:
Many developers and organizations now leverage OpenAI-compatible APIs for cost, privacy, or customization reasons. Allowing base URL customization would align Anything-LLM with tools like LiteLLM or LangChain, which prioritize interoperability.

Thank you for considering this feature! 🙌

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions