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 -
- 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.
-
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.
-
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?
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 -
API_KEY_ALIASin 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.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.
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?