Skip to content

feat(opencode): add LiteLLM plugin integration - #29937

Open
RheagalFire wants to merge 6 commits into
anomalyco:devfrom
RheagalFire:feat/litellm-provider
Open

feat(opencode): add LiteLLM plugin integration#29937
RheagalFire wants to merge 6 commits into
anomalyco:devfrom
RheagalFire:feat/litellm-provider

Conversation

@RheagalFire

@RheagalFireRheagalFire commented May 29, 2026

Copy link
Copy Markdown

Issue for this PR

Closes#29935

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Adds LiteLLM as a plugin. Sets LITELLM_BASE_URL (and optionally LITELLM_API_KEY) to connect. Models are synced from the proxy's /v1/models endpoint and enriched with per-model metadata from /model/info.

Files changed:

  • src/plugin/litellm/litellm.ts: Plugin with provider.models hook (model sync) and auth hook (API key)
  • src/plugin/litellm/models.ts: Model fetching from /v1/models + /model/info metadata enrichment
  • src/plugin/index.ts: Registered LiteLLM in internal plugins
  • src/provider/provider.ts: Removed built-in provider code, added generic plugin provider seeding
  • packages/core/src/provider.ts: litellm provider ID
  • sprite.svg / types.ts: Provider icon
  • en.ts / settings-providers.tsx / dialog-select-provider.tsx: UI strings and notes
Env varDescription
LITELLM_BASE_URLBase URL of the LiteLLM proxy (e.g. http://localhost:4000)
LITELLM_API_KEYAPI key / master key for the proxy (optional if proxy has no auth)

Related: #29308, #6231, #14468

How did you verify your code works?

  1. Started LiteLLM proxy with config (claude-sonnet-4-6 + claude-opus-4-6 via Azure AI Foundry)
  2. Set LITELLM_BASE_URL=http://localhost:4000 env var
  3. Ran TUI (bun dev), LiteLLM models auto-discovered from /v1/models and appear in model picker
  4. Verified /model/info metadata enrichment (token limits, costs)
  5. Sent messages with streaming, works
  6. Switched between models (sonnet/opus), works
  7. Full test suite passes (2979 pass, 0 fail)
  8. Typecheck passes across all 21 packages

Screenshots / recordings

ceb2-3aa7-47fd-b86f-e27af97bfe24-2.mp4

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Potential Duplicate/Related PRs Found:

  1. PR feat(opencode): add LiteLLM provider with auto model discovery #14468 - feat(opencode): add LiteLLM provider with auto model discovery

  2. PR fix: inject cache_control on content blocks for openai-compatible proxies to Anthropic backends (Bifrost, LiteLLM, Databricks) #25985 - fix: inject cache_control on content blocks for openai-compatible proxies to Anthropic backends (Bifrost, LiteLLM, Databricks)

  3. PR feat(opencode): add LLM provider fallback chain #26292 - feat(opencode): add LLM provider fallback chain

The most significant is PR #14468 - verify if it's the predecessor/duplicate of the current work or if it's a separate issue being addressed by PR #29937.

@RheagalFire
RheagalFireforce-pushed the feat/litellm-provider branch from 0cfea4d to 0bb63baCompareJune 1, 2026 16:38
@RheagalFire

Copy link
Copy Markdown
Author

cc @adamdotdevin would love your review on this one.

@RheagalFire
RheagalFireforce-pushed the feat/litellm-provider branch from 0bb63ba to 432d8d1CompareJune 3, 2026 19:23
@RheagalFire
RheagalFireforce-pushed the feat/litellm-provider branch from 432d8d1 to d370c1dCompareJune 3, 2026 19:49
@RheagalFireRheagalFire changed the title feat(opencode): add LiteLLM provider integrationfeat(opencode): add LiteLLM plugin integrationJun 3, 2026
@RheagalFire

Copy link
Copy Markdown
Author

Hey folks, any update here
cc @Hona@Brendonovich

@KMontag42

Copy link
Copy Markdown

would be great to have this merged into a release

Sign up for freeto 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.

[FEATURE]: Add LiteLLM proxy as a built-in provider

2 participants

@RheagalFire@KMontag42