Skip to content

Accept http and https model provider base_urls on any host - #417

Open
velrith wants to merge 4 commits into
MiniMax-AI:mainfrom
velrith:feat/allow-http-model-provider-base-url
Open

velrith wants to merge 4 commits into
MiniMax-AI:mainfrom
velrith:feat/allow-http-model-provider-base-url

Conversation

@velrith

@velrith velrith commented Oct 4, 2026 •

Copy link
Copy Markdown

Fixes #416.

A deployment default model provider had to use https with a single exception: http on a loopback host. That still blocks a self-hosted provider on another host, which is a normal setup and often only speaks plain HTTP.

This removes the scheme from the admission decision entirely. http and https are both accepted on any host, including private and public ones. Everything else validModelProviderBaseURL already enforced is unchanged: a usable host, a port in range, and no credentials, query, fragment or control characters.

internal/modelprovider/config.go had the same loopback-only rule on the Runtime side; it now admits both schemes too, so a frozen bundle that Core accepts cannot be rejected later by the Harness.

Not weakened by this change

  • Credentials in the URL (https://user:pass@host) are still rejected.
  • ?query and #fragment are still rejected.
  • Unknown or unusable schemes (ftp://, file://, scheme-relative //host) are still rejected.
  • Host and port validation is untouched.

Why no scheme restriction
The operator owns the endpoint. Refusing plain HTTP for an address the operator explicitly configured does not protect the key: they can already serve that same endpoint over TLS if they want, and the choice of transport between Core and their own provider is theirs to make. Keeping the rule meant a local-network provider was simply unusable.

Files

  • contracts/agents-api/v1/model_provider_admission.go: admitted-scheme set replaces the loopback scheme branch
  • internal/modelprovider/config.go: accepts http and https for the frozen bundle
  • contracts/agents-api/v1/model_execution.go, contracts/agents-api/{,zh/}model-execution.md, contracts/agents-api/{,zh/}core-errors.md, console i18n (en, zh-CN) and apps/web/e2e/fixture-console.mjs: the error now names both schemes without a loopback qualifier
  • tests updated across contracts/agents-api/v1, services/core/internal/api, internal/modelprovider, apps/daemon/internal/agent/mcode and apps/daemon/internal/agent/claudesdk: remote http is now an accepted URL, and the invalid-URL cases use an unsupported scheme

Verification

  • go test ./contracts/... ./internal/... ./services/core/internal/api/... ./apps/daemon/... all pass
  • pnpm test:web passes (70 files, 392 tests)
  • A scratch admission check confirmed http://10.0.0.5:8080/v1, http://192.168.1.10/v1, http://172.16.4.4:7351, http://[fd00::1]/v1 and http://model_gateway.internal/v1 are now accepted, while ftp://, file://, //host, embedded credentials, query, fragment and control characters are still rejected

A deployment default model provider had to use https, with no exception:
validModelProviderBaseURL compared the scheme against a single "https"
constant, so PUT /core/v1/harnesses/{harness}/model-configuration rejected a
reachable local endpoint with model_provider_base_url_invalid.

Plain HTTP is already acceptable elsewhere on this path. MiniMax-AI#408 let
OAC_PUBLIC_URL use it on loopback and private ranges, and the credential
gateway added in MiniMax-AI#343 serves the Harness over loopback in plaintext by
design: the Harness never holds the key, so the relay is a local HTTP
service. The provider base_url was the one remaining surface that mapped
http to invalid unconditionally.

Admit http only where the URL cannot leave the host: localhost, or a
loopback IP. A private-network address stays HTTPS because other hosts can
reach it. https keeps working everywhere it did, and credentials, query and
fragment are still rejected on both schemes.

Docs, the console error copy, the e2e fixture that mirrors Core's rule, and
the contract and Core API tests follow.
A deployment default model provider could only use https, with a
loopback-only exception for http. That blocked a legitimate setup: a
self-hosted provider on another host in the same network, reachable only
over plain HTTP.

The scheme now carries no admission decision. Core admits http and https
on any host, and the Runtime-side provider validation in
internal/modelprovider matches. Host, port, credential, query, fragment
and control-character checks are unchanged.

The operator owns the endpoint, so the transport choice is theirs.

- contracts/agents-api/v1/model_provider_admission.go: replace the
  loopback scheme branch with an admitted-scheme set
- contracts/agents-api/v1/model_execution.go, contract docs (EN/ZH),
  console i18n and the e2e fixture: reword the error to name http and
  https without a loopback qualifier
- tests: remote http is now an accepted URL; the invalid-URL cases use an
  unsupported scheme instead
@velrith velrith changed the title Allow an HTTP model provider base_url on a loopback host Accept http and https model provider base_urls on any host Oct 4, 2026
The admission rule widened to http in the previous commits, but the console
client still rejected any stored base URL that was not https. Core accepted an
http configuration while /core/v1/harnesses failed projection, so the console
showed "Core returned an invalid administration response" for the whole
harness list and the deployment default model configuration could not load.

Widen the client-side pattern to http/https, mirroring the Core write rule, and
update the tests that encoded the https-only contract.
The console's write form still enforced the old HTTPS-only rule in
isProviderUrl, so saving an operator-chosen http endpoint was blocked before
the request reached Core. The rejection text also still told the administrator
to use HTTPS, and the example was a public host.

Widen the form check to http/https, update the guidance text and example, and
cover the accepted and rejected shapes.

This branch has not been deployed

No deployments
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.

Allow an HTTP base_url for model providers, like OAC_PUBLIC_URL already does

1 participant