Skip to content

feat: self-hosted providers — connection test + model discovery (#3260)#3409

Closed
theherrovn-sys wants to merge 6 commits into
nesquena:masterfrom
theherrovn-sys:fix/3260-self-hosted-providers-v2
Closed

feat: self-hosted providers — connection test + model discovery (#3260)#3409
theherrovn-sys wants to merge 6 commits into
nesquena:masterfrom
theherrovn-sys:fix/3260-self-hosted-providers-v2

Conversation

@theherrovn-sys
Copy link
Copy Markdown

@theherrovn-sys theherrovn-sys commented Jun 2, 2026

Summary

Layers provider adapter architecture with live connection testing on top of PR #3406 (the maintainer-preferred broader base) to add live connection testing and model discovery for Ollama, LM Studio, and custom OpenAI-compatible endpoints in Settings -> Providers.

Architecture

1. Provider adapter module (api/provider_adapters.py)

  • test_connection(provider_id, base_url) -> probes connectivity, returns {ok, endpoint, error, tested_at}
  • list_models(provider_id, base_url, refresh=False) -> discovers models with 5-min TTL cache
  • Ollama adapter: GET {root}/api/tags (strips /v1 suffix to reach native API)
  • LM Studio adapter: GET {base_url}/v1/models
  • Custom OpenAI-compatible adapter: GET {base_url}/models
  • Thread-safe in-memory LRU cache (32 entries max)

2. New API endpoints (api/routes.py)

  • GET /api/providers/test?provider=ollama&base_url=http://localhost:11434/v1 -> connection test
  • GET /api/providers/models?provider=ollama&base_url=...&refresh=true -> model discovery

3. Enhanced Settings UI (static/panels.js)

  • "Test Connection" button on each self-hosted provider card
  • Per-card status emoji: (check) connected, (x) failed, (hourglass) testing
  • Card border color-coded: green (connected), red (failed), accent (testing)
  • Failed cards gray out name/meta for clear visual signal
  • Model dropdown auto-populated from live provider API after successful test
  • Model refresh button for on-demand re-discovery
  • Graceful fallback: offline servers show clear error, never crash

4. CSS (static/style.css)

  • .provider-card-connected / .provider-card-failed / .provider-card-testing states
  • .provider-card-conn-status - inline emoji indicator
  • .provider-card-refresh-btn - model refresh button styling

Hardware Verified

Tested on real NVIDIA DGX Atom (GB10 Grace Blackwell):

Component Value
GPU NVIDIA GB10
Compute Capability 12.1 (SM121)
Architecture aarch64 (ARM64)
Ollama Version latest
Models 15 (confirmed via GET /api/tags)

Changes from PR #3406

This branch is directly rebased on PR #3406 (4 commits including the self-hosted providers base). Our new commits add:

File Lines Purpose
api/provider_adapters.py +358 Provider adapter layer (NEW)
api/routes.py +24 test + models GET endpoints
static/panels.js +74/-15 Test connection + model discovery UI
static/style.css +16 Status indicator + refresh button CSS

Related

pamnard and others added 5 commits June 2, 2026 16:45
…uena#3260)

Add Settings → Providers cards for Ollama, LM Studio, and custom OpenAI-compatible
endpoints with base URL probe, model selection, and optional API key. Persist via
POST /api/providers/self-hosted without rerunning onboarding; keep local Ollama
independent of OLLAMA_API_KEY used for Ollama Cloud (nesquena#1410).
 tests

LM Studio now uses the self-hosted Settings card (is_self_hosted) instead of
API-key-only configurable=True. Drop unused imports flagged by CI ruff gate.
Fix ja/zh/tr/it/pt/fr/zh-Hant locale parity tests after providers panel keys
were only added to English fallback blocks.
Split self-hosted cards onto a separate filter line so panels.js still
contains filter(p=>p.configurable||p.is_oauth||p.is_custom) (nesquena#1202, nesquena#3260).
…ed cards (nesquena#3260)

Implements GPT 5.5 provider adapter architecture on top of PR nesquena#3406:

- New api/provider_adapters.py with test_connection() and list_models()
  for Ollama (GET /api/tags), LM Studio (GET /v1/models), and custom
  OpenAI-compatible endpoints (GET /models). Includes 5-min TTL cache.

- New API routes: GET /api/providers/test?provider=&base_url= and
  GET /api/providers/models?provider=&base_url=&refresh=true.

- Enhanced Settings → Providers self-hosted cards with:
  * "Test Connection" button → validates connectivity, shows status banner
  * Per-card status indicator (✅ connected / ❌ failed / ⏳ testing)
  * Gray-out + red border when server is unreachable
  * Model discovery dropdown populated from live provider API
  * Model refresh ↻ button for re-discovering models on demand
  * Graceful fallback — offline servers show clear error, never crash

Verified on real NVIDIA DGX Atom (GB10, SM121, aarch64) with Ollama
serving 15 models on port 11434.
@theherrovn-sys theherrovn-sys changed the title [NVIDIA] Self-hosted providers: connection test + model discovery (#3260, GPT 5.5 architecture) [NVIDIA] Self-hosted providers: connection test + model discovery (#3260, Provider adapter architecture) Jun 2, 2026
@theherrovn-sys theherrovn-sys changed the title [NVIDIA] Self-hosted providers: connection test + model discovery (#3260, Provider adapter architecture) feat: self-hosted providers — connection test + model discovery (#3260) Jun 2, 2026
Added _normalize_base_url() helper that strips trailing /v1 suffix
before constructing endpoint URLs, preventing double paths like
/v1/v1/models when user supplies base URL ending in /v1.

Applied to: _lmstudio_test_connection, _lmstudio_list_models,
_custom_test_connection, _custom_list_models

Verified on DGX Atom with Ollama (15 models, /api/tags).
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.

Feature: self-hosted provider setup (Ollama / LM Studio) in Settings → Providers after onboarding

2 participants