Add server-aware generate and chat CLIs - #1823
Closed
Lazarus-931 wants to merge 1 commit into
Closed
Lazarus-931 wants to merge 1 commit into
Lazarus-931 wants to merge 1 commit into
Conversation
Lazarus-931
marked this pull request as ready for review
August 9, 2026 19:40
Blaizzy
reviewed
Aug 10, 2026
Blaizzy
left a comment
Owner
There was a problem hiding this comment.
I like the direction, let's just increase the quality of the thinking and manual review.
| action="store_true", | ||
| help="Require a running server instead of loading the model locally.", | ||
| ) | ||
| server_mode.add_argument( |
Owner
There was a problem hiding this comment.
We don't need this flag
If server url is not present, it gets skipped
| help="Require the server: send the request over HTTP instead of loading " | ||
| "the model locally (errors if the server is unreachable).", | ||
| ) | ||
| server_mode.add_argument( |
| import urllib.request | ||
|
|
||
| DEFAULT_BASE_URL = "http://127.0.0.1:8080" | ||
| DEFAULT_PREFILL_STEP_SIZE = 2048 |
Owner
There was a problem hiding this comment.
Inherits from generate or server
This is a duplicate
Owner
There was a problem hiding this comment.
This file doesn't seem well thought out.
Let's not let agents handle everything. Careful system planning and thinking should have precedence.
| return False | ||
|
|
||
|
|
||
| def eligible_for_server(args): |
Owner
There was a problem hiding this comment.
This is wrong, the server handles most of it
| return prefill_step_size in (None, DEFAULT_PREFILL_STEP_SIZE) | ||
|
|
||
|
|
||
| def _image_url(path): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
mlx_vlm generateandmlx_vlm chat./v1/chat/completionsAPI instead of cold-loading the model again.--base-url,--api-key,--server, and--local.Behavior
For plain text and vision generation, the CLI probes a running server and
streams its response when available.
--serverrequires remote execution;--localexplicitly bypasses the server.Options that cannot be represented faithfully by the request API remain local.
A reachable server that returns an authentication or HTTP error is surfaced,
rather than silently falling back to a separate local model load.
Validation
uv run --with pytest python -m pytest mlx_vlm/tests/test_cli.py mlx_vlm/tests/test_server.py -qmlx-community/Qwen3-1.7B-4bit.Related
This provides the engine-side server-aware CLI behavior needed by the Nativ CLI:
Blaizzy/nativ#228