Skip to content

feat(ai): auto-discover models from /v1/models for custom inference endpoints - #11731

Draft
david-engelmann wants to merge 2 commits into
warpdotdev:masterfrom
david-engelmann:david/local-models-discovery
Draft

david-engelmann wants to merge 2 commits into
warpdotdev:masterfrom
david-engelmann:david/local-models-discovery

Conversation

@david-engelmann

Copy link
Copy Markdown
Contributor

Status: DRAFT — spec-first, awaiting ready-to-implement on #11514

Opening as a draft deliberately so it doesn't kick off review before the
linked issue is promoted. #11514
is currently ready-to-spec; this PR supplies that spec (and the
implementation it describes) for review. Please don't treat it as
ready-to-review until #11514 carries ready-to-implement.

What this adds

A "Fetch from endpoint" button in the custom inference endpoint modal that
calls the provider's OpenAI-compatible GET /models catalog and populates the
model rows, so users don't type every model ID by hand. Builds on #10781
(custom inference endpoints / BYOK).

This also covers the independently-filed #11586,
which requests the same feature.

Specs

Implementation summary

  • app/src/ai/discover_models.rs — discover_models(client, base_url, api_key)
    hits <base>/models with bearer auth, parses the OpenAI-compatible
    { "data": [{ "id": … }] } shape, bounds the body at 1 MiB, and filters
    blank IDs. new_model_ids merges results case-insensitively without touching
    existing rows or aliases.
  • app/src/settings_view/custom_inference_modal.rs — the button + inline
    status (Fetching… / Added N models / No new models / Fetch failed: …),
    run as a cancellable background task. Reuses the modal's existing URL
    validation, so discovery inherits the same HTTPS/non-private allow-list as
    Save.

No change to persisted CustomEndpoint data or the request wire format. Gated
by the existing CustomInferenceEndpoints feature flag.

Tests

14 unit tests for discover_models (happy path + 401/404/network/non-JSON/
missing-data/empty/blank-ID/trailing-slash, plus the three merge cases)
against a mockito server. cargo test -p warp --lib ai::discover_models
passes; clippy + fmt clean.

Refs #11514. Refs #11586.

david-engelmann and others added 2 commits May 27, 2026 00:27
Wires a "Fetch from endpoint" button into the custom inference modal so
users no longer have to type model names by hand once they've entered an
endpoint URL and API key. The fetch hits <base>/models with bearer auth,
parses the OpenAI-compatible response shape, and merges new IDs into the
model rows (case-insensitive dedup against what's already configured).

Implements warpdotdev#11514.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
…s discovery

Documents the already-built custom-inference model auto-discovery feature:
PRODUCT.md captures the user-facing behavior, status states, invariants, and
out-of-scope items; TECH.md grounds the discover_models helper, the merge
logic, modal wiring, cancellation, and the security envelope in the current
code.

Refs warpdotdev#11514. Duplicate request tracked in warpdotdev#11586.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed external-contributor Indicates that a PR has been opened by someone outside the Warp team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant