Skip to content

Custom inference endpoints should import models from OpenAI-compatible /models #11586

Closed

Description

@thesammykins

Problem

Custom Inference endpoint setup currently requires users to manually type every model name and optional alias, even when the provider exposes an OpenAI-compatible GET /models catalog. This makes setup slower and error-prone, especially for providers that expose many model IDs or rotate models often.

Repo-grounded contract summary

The current saved request contract can remain unchanged:

  • CustomEndpoint persists name, url, api_key, and models.
  • CustomEndpointModel persists the provider model name, optional alias, and stable config_key.
  • Saved custom models become synthetic LLMInfo entries keyed by config_key; labels already use alias when present and fall back to the raw model name.
  • Agent requests serialize custom_model_providers.providers[].models[] as { slug, config_key }.

That means model discovery only needs to help fill the modal rows. It does not need to change how endpoints are saved or how agent requests are built.

Prototype approach

A local prototype on branch codex/custom-inference-model-probe adds a secondary Fetch models action to the Custom Endpoint modal:

  • Enabled only when URL and API key are present and the URL passes existing validation.
  • Builds {base_url.trim_end_matches('/')}/models.
  • Sends Authorization: Bearer <api_key> when a key is present.
  • Parses OpenAI-style responses shaped like { "object": "list", "data": [{ "id": "..." }] }.
  • Preserves provider ordering, de-dupes model IDs, ignores blank IDs, and returns explicit errors for non-2xx, invalid JSON, and empty lists.
  • Merges discovered models into modal rows:
    • preserve existing model rows, aliases, and config_keys by matching model name
    • replace the initial blank row for new endpoints
    • append new discovered models with blank aliases
    • keep aliases optional because CustomEndpointModel::display_label() already falls back to model name
  • Shows inline loading, success, and error status in the modal.

OpenCode endpoint evidence

Tested against https://opencode.ai/zen/go/v1/ without including credentials in logs or this issue.

GET https://opencode.ai/zen/go/v1/models returned HTTP 200 with 15 model IDs:

  • minimax-m2.7
  • minimax-m2.5
  • kimi-k2.6
  • kimi-k2.5
  • glm-5.1
  • glm-5
  • deepseek-v4-pro
  • deepseek-v4-flash
  • qwen3.6-plus
  • qwen3.5-plus
  • mimo-v2-pro
  • mimo-v2-omni
  • mimo-v2.5-pro
  • mimo-v2.5
  • hy3-preview

GET https://opencode.ai/zen/go/v1//models returned HTTP 404, so trimming trailing slashes before appending /models is required.

Acceptance criteria

  • Users can add a Custom Inference endpoint and click Fetch models to populate model rows from an OpenAI-compatible /models endpoint.
  • Existing manually-entered rows are not overwritten.
  • Existing aliases and stable config_keys survive repeated fetches.
  • The initial blank model row is replaced on first successful fetch.
  • Newly discovered models are appended with blank aliases.
  • The button is disabled for invalid URL, missing API key, and in-flight fetch states.
  • Non-2xx, invalid JSON, and empty lists surface clear inline errors.
  • Saved endpoint and request contracts remain unchanged.

Local validation

Prototype validation run locally:

  • cargo test -p warp custom_inference_modal --lib passed: 17 tests.
  • cargo test -p warp custom_inference_model_probe --lib passed: 7 tests.
  • cargo test -p warp llms --lib passed: 16 tests.
  • cargo test -p ai api_keys passed: 24 tests.
  • cargo fmt --check passed.
  • git diff --check passed.

The Cargo target emitted repeated incremental-cache hard-link warnings because the local target directory is on a filesystem that does not support hard links; tests still passed.

Related follow-up

DeepSeek thinking-mode failures observed through this endpoint appear to be a separate provider conversation/history issue, not part of model autofill. Tracking separately in a follow-up issue.

Activity

  1. warp-for-oss commented on May 23, 2026

    @warp-for-oss
    Contributor

    @thesammykins

    Here's what I found while triaging this issue:

    The current Custom Inference setup appears to require manually entering model IDs. Importing models from an OpenAI-compatible /models response would be an enhancement to that setup rather than a regression in the saved endpoint/request contract.

    Maintainer details

    I concluded that custom inference endpoint setup currently lacks a model-discovery action, so users must manually enter provider model IDs even when the provider exposes an OpenAI-compatible /models catalog..

    Triage summary

    This is an enhancement request for the Custom Inference endpoint setup flow. The current implementation lets users persist endpoint URL/API key plus manually-entered model rows, and those rows already flow into custom model picker/request data, but the modal does not currently expose a way to query an OpenAI-compatible GET /models catalog and merge discovered IDs into the form.

    Reproducibility

    High for the feature gap. The behavior is visible from the current settings modal implementation: the model list is populated from saved CustomEndpointModel entries or blank manual rows, and the only model-list action is adding another blank row.

    Likely implementation area

    • app/src/settings_view/custom_inference_modal.rs owns the endpoint modal UI, manual model rows, URL validation, and save events.
    • app/src/settings_view/ai_page.rs wires modal events into ApiKeyManager.
    • crates/ai/src/api_keys.rs, app/src/ai/llms.rs, and app/src/ai/agent/api.rs confirm that the saved/request contracts can remain model-row based: discovered model IDs can be used to fill rows without changing the wire shape.

    A closely related existing issue is #11514, which requests auto-discovering models from /v1/models. Under the current duplicate-detection workflow, I found only that one likely duplicate, so I am not applying the duplicate label.

    Follow-up needed

    No reporter follow-up is needed for initial routing; the desired behavior and acceptance criteria are already specific.

    This is my automated analysis and may be incorrect. A maintainer will verify the details.

    Powered by Oz

  2. thesammykins commented on May 23, 2026

    @thesammykins
    Author

    DeepSeek thinking-mode follow-up: #11587

  3. added
    area:agent
    area:settings-keybindings
    enhancement
    repro:high
    triaged
    on May 23, 2026
  4. david-engelmann commented on May 27, 2026

    @david-engelmann
    Contributor

    This overlaps directly with #11514, which I filed on the same /models auto-discovery idea. To avoid two people building it twice: I've written up the product + tech spec and opened a draft PR with a working implementation — #11731.

    It does what you describe here: a "Fetch from endpoint" button in the custom inference modal that calls the provider's OpenAI-compatible GET /models, parses data[].id, and merges the results into the model rows (case-insensitive dedup, existing rows/aliases untouched). The saved CustomEndpoint / CustomEndpointModel contract you outlined stays unchanged — discovery only fills in the same rows a user would type. Failure modes (401/404/network/non-JSON/empty) each surface an inline status.

    The DeepSeek thinking-mode point in your follow-up (#11587) is out of scope for this — it's model-capability metadata, whereas this is just ID discovery.

    Happy to fold any specifics from this issue into the spec. Suggest we converge on #11514 + #11731 as the implementation track for the /models import itself.

  5. danielpeng2 commented on Jul 30, 2026

    @danielpeng2
    Member

    Thanks for the feature request! I'm going to close out this issue as a duplicate of #11514.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:agentarea:settings-keybindingsenhancementrepro:hightriagedwarp:auto-triage-review

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions