Conversation
Collaborator
|
Hi @prodmanpd! Thank you for the PR! OPENAI_API_KEY=sk-litellm-... OPENAI_API_BASE=http://localhost:4000/v1 gonzo --ai-model gpt-4o-miniI'm closing the PR, however, feel free to submit other PRs! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--ai-provider litellm),OpenAIClientverbatim and only differs in its defaults and environment variables. One provider entry reaches 100+ backends (OpenAI, Anthropic, Gemini, AWS Bedrock, Vertex AI, Azure, Groq, etc.) through a single endpoint with unified auth, routing, cost tracking, and observability.Changes
internal/ai/litellm.go:NewLiteLLMClient(model)reusesOpenAIClient(chat,/modelsdiscovery, validation, retry) with LiteLLM defaults:LITELLM_API_KEY(required),LITELLM_API_BASE(defaulthttp://localhost:4000/v1), ServiceName "LiteLLM".internal/ai/factory.go:ProviderLiteLLMtype,NewClientcase, andValidProviders().cmd/gonzo/main.go:--ai-providerhelp text now listslitellm.internal/ai/litellm_test.go: unit tests.Tests
1. Unit tests (
go test ./internal/ai/ -run 'LiteLLM|ValidProviders|NewClient_LiteLLM' -v):2. Build and vet:
go build ./...andgo vet ./internal/ai/both clean. New files aregofmtclean.3. Live end to end through the real provider (
ai.NewClient(ProviderLiteLLM, model)thenAnalyzeLog(...)) against a running LiteLLM proxy, on two different upstreams routed by the same provider:validated=trueconfirms/v1/modelsdiscovery through the proxy; the analysis output confirms/v1/chat/completions. Full chain: factory toOpenAIClientto the LiteLLM proxy to the upstream provider to a parsed response.Risk / Compatibility
openaiandclaude-codebehavior unchanged,ProviderAutodefault unchanged.OpenAIClient).--ai-provider litellm.Example usage
CLI:
Programmatic (the
internal/aiAPI, the same client the CLI builds):