Skip to content

Problem with many OpenAI APIs #766

Description

@uukelele

Currently, to use an OpenAI compatible API, user can do something like this:

{
    "api": "openai",
    "url": "https://provider.ai/v1",
    "model": "llm-1-pro"
}

...and store the API key in OPENAI_API_KEY.

This works for now, but it falls apart as soon as we want to use two different OpenAI compatible APIs as we only have one slot for the API key.

There are a couple possible fixes -

  1. Have an API_KEY_ALIAS in the model dict:
{
    "api": "openai",
    "url": "https://provider.ai/v1",
    "model": "llm-1-pro",
    "api_key_alias": "PROVIDER_API_KEY"
}

Then the API key can be added as PROVIDER_API_KEY.

  1. Store the key in the profile JSON. But this isn't really a good idea because obviously security, it cannot be added to git anymore, and also it doesn't allow environment variables.

  2. We could also define a better way to use OpenAI compatible APIs instead of this.

Personally I think the best short-term option would be going with Option 2. But maybe there are other ways?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions