Allow multiple API keys for the same provider
Description
Currently, there's no way to set multiple API keys for the same provider. More on why it would be nice to have in 'Use Case' section.
Use Case
I'll take 'Venice' as the use case example, but some may also find it desirable for other providers.
Really quickly, Venice has this unique mechanism (at least, for now) of tokenized inference through their 'DIEM' token, where 1 DIEM = 1$ of inference per day.
The issue is, one user may have multiple wallets (basic security hygiene), each holding their own DIEM, and in turn, each having their own API keys.
Thus the need to support multiple API keys for one provider.
Area
Provider / Model support
Proposed Solution
(Still using Venice as an example, not implying it should be limited to this provider)
Allow multiple keys like: VENICE_API_KEY=key_1:key_2:key_3, where : is just a separator.
Use key_1 until Error 402: INSUFFICIENT_BALANCE is thrown for that key. Then retry using key_2, if successful use it (and keep using it until omp is closed or 402/INSUFFICIENT_BALANCE is returned for that key too), then key_3, etc.
Essentially a simple priority order, "always use the first successful key", it does not need to be more complex than that, nor to "remember" last key used or anything.
Note that i specified the 402/INSUFFICIENT_BALANCE error for the Venice provider, and i don't know how the codebase handle it, but if a common "not enough credit" error exist for all providers, of course this one should be used as the test not to introduce duplicated code. I merely used Venice as an example to explain why and how it could work, but it should be generalizable to all providers, I did not mean it as a "special case" to handle.
Alternatives Considered
I was not able to find alternatives.
Source: can1357/oh-my-pi