Skip to content

feat: add OpenLLM provider - #279

Draft
apewithllm wants to merge 1 commit into
appleboy:mainfrom
openllmsh:feat/openllm-provider
Draft

apewithllm wants to merge 1 commit into
appleboy:mainfrom
openllmsh:feat/openllm-provider

Conversation

@apewithllm

Copy link
Copy Markdown

Disclosure: I'm a cofounder of OpenLLM.

Summary

  • Adds OpenLLM as a named provider. OpenLLM routes API keys, OAuth subscription accounts and local models through one format-agnostic endpoint. It runs locally and extends to the cloud, so the same setup works on a dev machine, a git hook and in CI.
  • Uses the OpenAI Chat Completions format through the existing go-openai SDK. No new Go dependencies.
  • OpenLLM supports the full /v1/ API surface and provides an MCP server as a second integration layer. See the OpenLLM documentation.

How it works

  • openai.provider openllm selects the provider. openllm.base_url defaults to the local daemon at http://127.0.0.1:8787/v1. For CI or the cloud gateway, set openllm.base_url https://www.openllm.sh/v1 explicitly. There is no switching based on whether a key is present.
  • openllm.api_key (also read from OPENLLM_API_KEY) is optional for the local daemon, which uses the saved openllm login. It is required for the cloud gateway. The key is stored in the credential store like the other provider keys.
  • The shared openai.api_key and 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.model accepts the built-in aliases ultra, plus and lite, or provider model IDs. No model list is hardcoded.
  • Model parameters, proxy, headers and openai.stream reuse the shared settings. GetSummaryPrefix uses function calling and falls back to plain completion, as the LiteLLM provider does.
  • No model discovery is implemented, because CodeGPT takes a single model name from config.

Changes

  • provider/openllm/: client, options and tests (modeled on provider/litellm)
  • core/platform.go: OpenLLM platform
  • cmd/provider.go: NewOpenLLM and GetClient dispatch, with a test in cmd/provider_test.go
  • cmd/config_set.go, cmd/config_list.go, cmd/cmd.go: openllm.api_key and openllm.base_url keys, and openllm.api_key added to the credential store keys
  • README.md: provider list, config table, table of contents and a "Support for OpenLLM" section covering local and cloud/CI setup

Verification

  • go build ./...: passes
  • go test ./...: all packages pass, including new provider/openllm tests (completion, streaming, tool-call prefix, fallback, no-choices, 401 hint propagation, keyless client, base URL default) and cmd tests for key precedence (OpenLLM key used, shared OpenAI key not used, keyless)
  • make lint: 0 issues
  • Live smoke against a local OpenLLM daemon (signed in, no key set, default base URL) through NewOpenLLM with model lite: non-streaming completion returned pong, streaming returned pong, and the function-call path (GetSummaryPrefix) returned feat(main).
  • Not run: the cloud gateway (https://www.openllm.sh/v1 with OPENLLM_API_KEY), and an end-to-end codegpt commit run with the built binary.

@codecov

codecov Bot commented Nov 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 74.56140% with 58 lines in your changes missing coverage. Please review.
✅ Project coverage is 38.90%. Comparing base (0125d86) to head (f05295e).
⚠️ Report is 299 commits behind head on main.

Files with missing lines Patch % Lines
provider/openllm/options.go 38.02% 44 Missing ⚠️
provider/openllm/openllm.go 91.12% 11 Missing ⚠️
cmd/provider.go 95.23% 1 Missing ⚠️
core/platform.go 0.00% 1 Missing ⚠️
provider/openllm/func.go 83.33% 1 Missing ⚠️
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     
Flag Coverage Δ
macos-latest 38.90% <74.56%> (?)
ubuntu-latest 38.90% <74.56%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant