Uh oh!
There was an error while loading. Please reload this page.
feat: add LiteLLM provider with auto model discovery - #14202
Conversation
The following comment was made by an LLM, it may be inaccurate: Duplicate PR FoundPR #13896: "feat(opencode): add auto loading models for litellm providers" This appears to be a duplicate or closely related PR addressing the same feature — automatic model loading for LiteLLM providers. Both PRs are implementing first-class LiteLLM support with auto-discovery. You should check if #13896 is still open/merged and coordinate with that work to avoid duplication. |
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
Closes#13891
What
Adds native LiteLLM provider support with automatic model discovery from the proxy's
/model/infoendpoint. Previously, users had to manually define every model inopencode.jsonwhen using a LiteLLM proxy. Now, settingLITELLM_API_KEYandLITELLM_HOSTis enough — models are discovered automatically at startup.Changes
litellm.ts: Discovery module that fetches/model/info, maps pricing from per-token to per-million-token, extracts capabilities (reasoning, vision, PDF, audio, video, tool calling), filters wildcards, and infers interleaved thinking for Claude modelsprovider.ts: Seedslitellmprovider when env vars are detected; adds custom loader that resolves host/key, calls discovery, and injects models (user config takes precedence)transform.ts: LiteLLM-specific reasoning variants — Claude/Anthropic models getthinkingbudget variants, others getreasoningEffort. Prevents false-positive reasoning param injection for aliased modelsllm.ts: Adds explicitproviderID === "litellm"toisLiteLLMProxycheckWhy not models.dev?
LiteLLM is a self-hosted proxy where available models are user-configured and vary per deployment. Unlike static providers (OpenRouter, Helicone), the model list can only be known at runtime. A models.dev entry can't represent this — runtime discovery is required.
Env vars
LITELLM_API_KEYLITELLM_HOSThttp://localhost:4000LITELLM_BASE_URLLITELLM_HOSTLITELLM_CUSTOM_HEADERS{}LITELLM_TIMEOUT5000Verification
LITELLM_API_KEY+LITELLM_HOSTpointing to a running proxyopencode— LiteLLM models appear in model pickero3-custom→ Mistral) — reasoning params NOT injected