Skip to content

[Feat] Add self-hosted inference providers#481

Merged
brunobergher merged 17 commits into
developfrom
fix/opencode-compatible-provider-configs
Jul 17, 2026
Merged

[Feat] Add self-hosted inference providers#481
brunobergher merged 17 commits into
developfrom
fix/opencode-compatible-provider-configs

Conversation

@roomote-roomote

@roomote-roomote roomote-roomote Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Opened on behalf of Bruno Bergher. Follow up by mentioning @roomote-roomote, in the web UI, or in Slack.

What changed

Adds Ollama, vLLM, and LiteLLM as endpoint-based inference providers. Roomote discovers and qualifies models server-side, configures OpenCode through the inference gateway, and records LiteLLM-reported request cost without exposing endpoint topology or credentials to task sandboxes.

The setup and model settings surfaces recognize non-secret endpoint URLs, while public operator documentation covers private-network connectivity, security, provider-specific setup, and cost behavior.

Why this change was made

Self-hosted deployments need a supported path to use private inference infrastructure without making sandboxes responsible for upstream network access or credentials.

Impact

Operators can configure one Ollama, vLLM, or LiteLLM deployment and use its discovered OpenAI-compatible models for Roomote tasks. Direct Ollama and vLLM costs remain unknown; LiteLLM costs use the gateway response header when supplied.

@roomote-roomote

roomote-roomote Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

3 issues outstanding. See task

  • High: packages/types/src/model-provider-config.ts:426 registers lmstudio/local-model as the provider default, but generateOpenCodeConfig never creates an lmstudio provider/model entry. A generated config for that default has provider.lmstudio === undefined, so OpenCode cannot resolve the non-catalog local-model; add LM Studio to the worker's compatible-provider configuration and gateway rebase path.
  • Medium: apps/web/src/components/settings/InferenceProviderSection.tsx:691 only includes api-key providers in the add-provider dialog. The new LiteLLM, Ollama, and vLLM descriptors use authKind: 'endpoint', so an existing deployment cannot connect any of them from Settings > Models; include endpoint providers in this filter and render the URL input as non-secret.
  • Medium: packages/types/src/model-provider-config.test.ts:216 still asserts the old setup-provider catalog. pnpm exec dotenvx run -f .env.test -- pnpm --filter @roomote/types exec vitest run src/model-provider-config.test.ts src/task-models.test.ts fails because the three new provider IDs are missing from the expected list; update the assertion so the package test suite passes.
  • High: packages/types/src/inference-gateway.ts:312 declares Ollama with no key env vars, but R_INFERENCE_GATEWAY_KEYS is the worker's gateway-activation signal. A keyless Ollama selection therefore emits no signal, the worker removes R_INFERENCE_GATEWAY_URL, and OpenCode connects directly to the configured endpoint instead of through the gateway; add an endpoint-provider activation signal that does not depend on an API key (and cover optional-key LiteLLM/LM Studio configurations too).
  • High: apps/web/src/app/(onboarding)/setup/StepInferenceProvider.tsx:188 now discovers and persists an endpoint model, but it never calls qualifyProviderModel; that procedure has no UI caller anywhere. A model that lists successfully but lacks streaming tool-call support is accepted as the deployment default, so the first Roomote task fails after onboarding instead of setup rejecting the incompatible model.
  • Medium: apps/web/src/trpc/commands/task-models/index.test.ts:1449 still expects only AWS_REGION to be loaded as a non-secret provider value. The focused task-model command suite now fails because the implementation also requests LITELLM_BASE_URL, OLLAMA_BASE_URL, and VLLM_BASE_URL; update the expectation to cover the new endpoint values.
  • High: apps/web/src/app/(onboarding)/setup/StepInferenceProvider.tsx:368 still requires a newly typed URL to enable Discover models. For a runtime-managed OLLAMA_BASE_URL, VLLM_BASE_URL, or LITELLM_BASE_URL, the URL input is disabled and empty; although the server now resolves process.env, the client never allows the discovery request to run, so onboarding still cannot select a model.
  • Medium: apps/web/src/components/settings/InferenceProviderSection.tsx:691 makes endpoint providers connectable, but the dialog only saves credentials. saveTaskModelProviderCommand deliberately auto-adds no models for dynamic providers and this component never calls discoverProviderModels, so the documented Settings flow cannot present discovered models for selection after connecting LiteLLM, Ollama, or vLLM.
  • Medium: apps/web/src/components/settings/InferenceProviderSection.tsx:604 keeps the parent dialog open for endpoint providers, but the awaited providerSetup invalidation moves the saved provider out of availableProviders. That changes providerDialogProviders, and the dialog's providers effect resets the selected provider and clears discovery state, so the returned models are hidden, shown under another provider, or the dialog becomes empty; preserve the saved provider in the dialog until discovery completes.
  • Medium: apps/web/src/components/settings/InferenceProviderSection.test.tsx:45 adds the missing tRPC mock, so the existing 13 tests pass, but it still adds no endpoint-provider fixture or assertion that save, refetch, discovery, and rendering work together. The production regression above is therefore unexercised; add a focused endpoint discovery-flow test.
  • Medium: packages/types/src/model-provider-config.ts:467 gives each dynamic endpoint provider an empty default model, but getRecommendedModelPresets synthesizes a visible default preset from that value. Settings therefore offers LiteLLM, Ollama, and vLLM a “Recommended” mapping whose preview is entirely “Not set”; applying it leaves coding unchanged and clears every non-env-managed helper, vision, review, explore, and planning mapping. Exclude dynamic providers from the preset picker or return no synthesized preset for them instead of only skipping the catalog assertion.
  • Medium: apps/web/src/trpc/commands/task-models/index.ts:600 only appends newly discovered model IDs to the persisted catalog. If an operator edits an Ollama, vLLM, or LiteLLM URL to point at an endpoint with a different model set, models that the old endpoint advertised remain enabled and selectable, so launches can continue targeting models the new endpoint does not serve. Reconcile or disable provider-scoped models that are absent from a successful discovery result.
  • Medium: apps/web/src/trpc/commands/task-models/index.ts:629 adds every discovery.models entry to allowedModelIds, ignoring discovery.recommendedModels. This automatically enables embeddings, rerankers, tiny models, and other entries that getRecommendedLocalProviderModels explicitly leaves for an operator to enable manually, exposing unsuitable task models in launch options immediately after connection. Persist the discovered catalog but auto-enable only the qualified recommendation set.

Reviewed b19060e

@roomote-roomote roomote-roomote Bot changed the title [Fix] Run selected self-hosted OpenCode models [Feat] Connect local model provider gateways Jul 17, 2026
@roomote-roomote roomote-roomote Bot changed the title [Feat] Connect local model provider gateways [Feat] Add self-hosted inference providers Jul 17, 2026
@roomote-roomote

roomote-roomote Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

Fixed the remaining endpoint-provider model-discovery issue in 974630be: Settings now discovers and displays models after an endpoint provider is connected. Onboarding qualifies selected models and supports runtime-managed endpoint URLs. Pre-push lint, fast type checks, and Knip passed.

@brunobergher
brunobergher marked this pull request as ready for review July 17, 2026 18:09
@brunobergher
brunobergher merged commit 38ddda9 into develop Jul 17, 2026
17 checks passed
@brunobergher
brunobergher deleted the fix/opencode-compatible-provider-configs branch July 17, 2026 18:15
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.

2 participants