Skip to content

Support full URLs in API host configuration - #185

Open
CharlesYXW wants to merge 1 commit into
lmstudio-ai:mainfrom
CharlesYXW:fix-api-host-url
Open

CharlesYXW wants to merge 1 commit into
lmstudio-ai:mainfrom
CharlesYXW:fix-api-host-url

Conversation

@CharlesYXW

Copy link
Copy Markdown

Summary

Support full URLs in api_host, following the behavior discussed in #157:

  • Map HTTP/WS inputs to HTTP probes and WS sessions, and HTTPS/WSS inputs to HTTPS probes and WSS sessions.
  • Preserve existing host:port inputs, IPv6 addresses, encoded reverse-proxy path prefixes and query strings.
  • Reject unsupported URL schemes before network I/O and add a TLS-configuration hint to secure connection failures.
  • Use the same URL construction in the synchronous and asynchronous session paths.

Validation

  • pytest tests -m 'not lmstudio' -q: 207 passed, 202 deselected, including 30 new offline cases.
  • ruff check --config pyproject.toml src/lmstudio/json_api.py src/lmstudio/sync_api.py src/lmstudio/async_api.py tests/test_api_host_urls.py: passed.
  • ruff format --config pyproject.toml --check on the same four files: passed.
  • mypy --strict on the same four files: passed.

Checked on macOS with Python 3.12.13 and the locked pytest 8.4.1 / Ruff 0.12.10 versions. No live LM Studio server or TLS reverse proxy was used; those integration tests remain unverified locally. No custom TLS configuration is introduced.

Prepared with Codex assistance and independently reviewed, including the actual sync/async HTTPX transport paths with network access blocked.

Fixes #157

@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

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.

Improve behaviour when API host is given as a full URL

1 participant