Skip to content

ACP: auto-advertise the model picker from the provider's /models endpoint #195

Closed

Description

@ajianaz

What problem does this solve?

The #176 model picker requires TOLE_MODELS to be set by hand. Every provider tole works with (OpenAI, bifrost, vLLM, LiteLLM, Groq, OpenRouter — anything speaking /chat/completions) also speaks GET /models, so the operator is hand-transcribing information the provider already exposes. A fresh install shows no picker even though the provider would happily list the options — an onboarding gap (surfaced while onboarding a second user to Termul, 2026-10-06).

Proposed solution

Auto-advertise when the env override is absent:

  1. On the first session/new (lazy — agent spawn stays instant), if TOLE_MODELS is unset, probe GET {base_url}/models with the configured credentials. Short timeout (~3 s), single attempt, cached for the process lifetime.
  2. Probe success + non-empty list → advertise the ids as the model config option; TOLE_MODEL is the currentValue (prepended to the options when missing — the existing currentValue ∈ options invariant already covers this).
  3. TOLE_MODELS set → wins as-is (deterministic, no network): the env stays the operator override/filter.
  4. Probe failure or empty list → exactly today's behavior (no picker), one stderr line — the same probe-first contract as uteke/cora ("degrades to a one-line warning, never a phantom").

Design notes:

  • No new trust surface: same base_url, same key, read-only GET that the provider relationship already implies.
  • No wire-shape impact on the provider request body — the Tier-1 cache-friendliness contract is untouched.
  • Scope: tole acp (the only face with a picker UI). serve/CLI unchanged.
  • Parse the standard {"data": [{"id": ...}]} shape; tolerate extra fields. Sort order: provider order (hosts render it as-is); dedupe like parse_model_list already does.

Alternatives considered

  • Hardcoded default list — rejected: vendor-specific, goes stale.
  • File-based config to hold the list — complementary but heavier; the provider already knows the answer.
  • Probing at agent startup instead of first session/new — penalizes spawn latency for a feature only sessions need.

Are you willing to contribute the implementation?

Yes, I can do it

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions