Skip to content

Many services cannot be configured via env variables #1008

@ligix

Description

@ligix

What's happening?

Many llm providers cannot be configured via env variables even though all of them should have authentication and base url exposed to the config.

OpenAI is an example of a correctly configurable service via the two env variables OPENAI_API_KEY and OPENAI_API_HOST.
Gemini allows configuration of the api key only via GEMINI_API_KEY but there is no GEMINI_API_HOST.
Z.AI supports no configuration whatsoever.

Where does this happen?

Docker deployment

Impact on your workflow

Medium - Workaround exists

Environment (if applicable)

No response

Additional context

The offending code is in src/modules/llms/server.
This is correct:

      let alibabaOaiKey = access.oaiKey || env.ALIBABA_API_KEY || '';
      const alibabaOaiHost = llmsFixupHost(access.oaiHost || env.ALIBABA_API_HOST || DEFAULT_ALIBABA_HOST, apiPath);

This is only partially correct (does not support configuration of the host):

  const geminiHost = llmsFixupHost(access.geminiHost || DEFAULT_GEMINI_HOST, apiPath);
  let geminiKey = access.geminiKey || env.GEMINI_API_KEY || '';

it should instead be:

  const geminiHost = llmsFixupHost(access.geminiHost || env.GEMINI_API_HOST || DEFAULT_GEMINI_HOST, apiPath);
  let geminiKey = access.geminiKey || env.GEMINI_API_KEY || '';

This is a completely incorrect:

      let zaiKey = access.oaiKey || '';
      const zaiHost = llmsFixupHost(access.oaiHost || DEFAULT_ZAI_HOST, apiPath);

Make sure to find all occurrences of this, these aren't the only wrong ones!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions