feat(settings): link provider connection during bulk-add of LLM profiles
Context
PR #16426 landed a bulk-add modal (add-models-modal.tsx) that creates multiple LLM profiles from a provider's model list in one pass. As merged, it creates every profile keyless — the submit payload is a bare { model } with include_secrets: false, no api_key, and no provider_connection_id:
await saveProfile.mutateAsync({
name: row.name,
request: {
llm: { model: row.model } as SaveProfileRequest["llm"],
include_secrets: false,
},
});A credential is only attached afterwards, by editing each profile one at a time. That is consistent with the existing keyless-creation pattern, but it bypasses provider connections — the preferred credential mechanism for providers that support them — which undercuts the "bulk" premise: a cloud user with provider connections set up still has to open every created row to link one.
Proposal
Add an optional provider-connection picker to the bulk-add modal:
- When a provider is selected, surface existing provider connections whose
providermatches the selected provider (viauseProviderConnections()), the same source the settings UI already uses. - When a connection is chosen, stamp
llm.provider_connection_id = connectionId(and drop any inlineapi_key) on each row'sSaveProfileRequest— mirroring the existingconnectionIdbranch inllm-settings-local-view.tsx. - When no connection is chosen, keep today's keyless behavior. This preserves the modal's "nothing pre-selected" design and keeps it usable on providers/backends with no connection created yet.
Out of scope
- Creating a new provider connection from within the modal (credential entry + validation) is deliberately excluded; that is a larger feature. This issue only covers linking an existing connection.
- Cloud OpenHands-provider models should remain keyless — the backend mints its own key, so forcing a
provider_connection_idthere would be wrong. The picker should be hidden / not apply for those.
Why separate from #16426
The merged PR's modal, row-state model, and 409/profile-limit handling are deliberately separable and already tested. Linking connections is purely additive on the submit path, so it lands cleanly as a follow-up without re-litigating that logic.
Related
- Merged PR: #16426
- Related issue: #15492
This issue was created by an AI agent (OpenHands) on behalf of the user.
Source: OpenHands/OpenHands