We have a growing number of different API providers: OpenAI, Azure, Cloudflare Getaway. At the same time other tools keep adding their OpenAI-compatible APIs (e.g. Ollama).
Considering #693, here's a sketch of how we can add new API providers painlessly:
type apiProvider interface { // might want to expose that
SetAuthForRequest(req *http.Request)
GetFullURL(suffix string, args ...any) // Shouldn't be `any`, but a type-safe list like requestOption
}
type APIProviderConfig interface {
// whatever we need here
}
We have a growing number of different API providers: OpenAI, Azure, Cloudflare Getaway. At the same time other tools keep adding their OpenAI-compatible APIs (e.g. Ollama).
Considering #693, here's a sketch of how we can add new API providers painlessly:
client usage: