Repository navigation
feat: add OpenLLM provider - #279
Draft
apewithllm wants to merge 1 commit into
Draft
apewithllm wants to merge 1 commit into
apewithllm wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #279 +/- ##
===========================================
+ Coverage 21.96% 38.90% +16.94%
===========================================
Files 8 42 +34
Lines 346 2421 +2075
===========================================
+ Hits 76 942 +866
- Misses 264 1477 +1213
+ Partials 6 2 -4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Disclosure: I'm a cofounder of OpenLLM.
Summary
go-openaiSDK. No new Go dependencies./v1/API surface and provides an MCP server as a second integration layer. See the OpenLLM documentation.How it works
openai.provider openllmselects the provider.openllm.base_urldefaults to the local daemon athttp://127.0.0.1:8787/v1. For CI or the cloud gateway, setopenllm.base_url https://www.openllm.sh/v1explicitly. There is no switching based on whether a key is present.openllm.api_key(also read fromOPENLLM_API_KEY) is optional for the local daemon, which uses the savedopenllm login. It is required for the cloud gateway. The key is stored in the credential store like the other provider keys.openai.api_keyand its helper are deliberately not a fallback, so an OpenAI key is never sent to an OpenLLM endpoint. This differs from the LiteLLM provider, which falls back to the shared key.openai.modelaccepts the built-in aliasesultra,plusandlite, or provider model IDs. No model list is hardcoded.openai.streamreuse the shared settings.GetSummaryPrefixuses function calling and falls back to plain completion, as the LiteLLM provider does.Changes
provider/openllm/: client, options and tests (modeled onprovider/litellm)core/platform.go:OpenLLMplatformcmd/provider.go:NewOpenLLMandGetClientdispatch, with a test incmd/provider_test.gocmd/config_set.go,cmd/config_list.go,cmd/cmd.go:openllm.api_keyandopenllm.base_urlkeys, andopenllm.api_keyadded to the credential store keysREADME.md: provider list, config table, table of contents and a "Support for OpenLLM" section covering local and cloud/CI setupVerification
go build ./...: passesgo test ./...: all packages pass, including newprovider/openllmtests (completion, streaming, tool-call prefix, fallback, no-choices, 401 hint propagation, keyless client, base URL default) andcmdtests for key precedence (OpenLLM key used, shared OpenAI key not used, keyless)make lint: 0 issuesNewOpenLLMwith modellite: non-streaming completion returnedpong, streaming returnedpong, and the function-call path (GetSummaryPrefix) returnedfeat(main).https://www.openllm.sh/v1withOPENLLM_API_KEY), and an end-to-endcodegpt commitrun with the built binary.