server-inference
它能做什么
这项技能教智能体如何启动和排查 MLX-VLM 服务器,其他工具可以通过兼容 OpenAI 风格的 API 调用它。内容包括健康检查、模型列表和聊天请求。
适用场景
- ✓当用户想启动本地 MLX-VLM 服务器,用于聊天或 API 调用的时候。
- ✓当发送给服务器的请求失败,用户需要查明原因的时候。
- ✓当用户想把兼容 OpenAI 的应用连接到本地服务器的时候。
技能链接
https://github.com/Blaizzy/mlx-vlm/blob/main/skills/skills/server-inference/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请启动我的 MLX-VLM 服务器,并告诉我如何从我的应用发送聊天请求。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会启动服务器,检查其健康状态和模型列表,然后发送一个测试请求。把启动问题与请求问题分开排查,更容易找到原因。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Server Inference
Use this workflow for the FastAPI server and API-compatible inference.
First Checks
- Identify the server command, model, port, request endpoint, request body, and expected response.
- Start with health/model-list checks before debugging generation.
- Separate server startup failures from request-handling failures.
- Keep streaming and non-streaming repros separate.
Startup
uv run mlx_vlm.server \
--model <model-or-path> \
--port 8080
Useful startup flags include --adapter-path, --trust-remote-code, --log-level, --enable-thinking, --thinking-budget, --draft-model, --draft-kind, --kv-bits, --kv-quant-scheme, --max-kv-size, and --vision-cache-size.
Minimal Checks
curl http://127.0.0.1:8080/health
curl http://127.0.0.1:8080/v1/models
curl http://127.0.0.1:8080/metrics
Minimal chat request:
curl -s http://127.0.0.1:8080/v1/chat/completions \
-H 'Content-Type: application/json' \
-d '{
"model": "<model-or-path>",
"messages": [{"role": "user", "content": "Say hello."}],
"max_tokens": 32,
"stream": false
}'
Minimal Responses API request:
curl -s http://127.0.0.1:8080/v1/responses \
-H 'Content-Type: application/json' \
-d '{
"model": "<model-or-path>",
"input": "Say hello.",
"max_output_tokens": 32
}'
Endpoint Surface (beyond chat/responses)
The server exposes more than chat — cover or route to these as needed:
- Anthropic Messages API:
/v1/messages, plus/v1/messages/countfor token counting. - Audio:
/v1/audio/speech(TTS),/v1/audio/transcriptionsand/v1/audio/translations(STT). - Images:
/v1/images/generationsand/v1/images/edits(diffusion image models). - Cache & metrics:
/v1/cache/stats,/v1/cache/reset,/v1/metrics. - Models:
/v1/modelslists loaded models and model candidates in the shared Hugging Face cache, with aloadedboolean indicating which are in memory — seeSkill("mlx-vlm-skills:hf-cache-models").
Match the model kind to the endpoint (an image endpoint needs a diffusion/image model, audio endpoints need an audio model); a mismatch returns a clear 4xx, not a crash.
Debugging Rules
- Capture the server command, server logs, request body, response status, and response body.
- Test
/v1/modelsafter preload/load changes. - For OpenAI client issues, reproduce with
curlbefore blaming the client SDK. - For streaming bugs, save raw event chunks and compare with non-streaming.
- For structured outputs, isolate the JSON schema and confirm whether the same request works without schema constraints.
- For tool calls, inspect native support and the parser inferred from the loaded processor's actual chat template. Follow Tool Calling for parser registration and validation.
Validation
- For route/schema changes, run
uv run pytest mlx_vlm/tests/test_server.py -q. - For structured output changes, include
uv run pytest mlx_vlm/tests/test_generate.py -q -k 'thinking_aware or json_schema'. - For tool parser changes, add compact regressions to
TestProcessToolCallsinmlx_vlm/tests/test_server.pyand run the shared tool streaming tests in that module, plus any existing tests for affected parsers. Reuse consolidated tests instead of creating a new test file. - If the result is a user-facing bug report, switch to
Skill("mlx-vlm-skills:reproducible-github-issues").
常见问题
服务器使用哪个地址?
示例使用本地地址和 8080 端口,用户可以自行修改。
它支持流式输出吗?
支持。这项技能说明,流式和非流式请求应分别测试。
应该先做哪些检查?
这项技能建议在排查生成问题之前,先做健康检查和模型列表检查。
详情
作者的原始描述
Use this skill when the user wants to run or debug MLX-VLM server inference, including uv run mlx_vlm.server, /v1/models, /v1/chat/completions, /v1/responses, streaming, OpenAI-compatible clients, health checks, metrics, model unload/reload, adapters, trust-remote-code, and server request/response failures.
repo: Blaizzy/mlx-vlm
热度
- GitHub 星标
- 5.7k
- 排名
- #14752
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
cli-inference
5.7k帮你的智能体从命令行运行或排查 MLX-VLM 模型推理,支持文本、图像和音频输入,并为每项任务找到正确的参数。
convert-quantize
5.7k帮你的智能体把 Hugging Face 模型转换为 MLX 格式,并通过量化使其变小,同时为本地设备选择位宽、模式和校准方式。
hf-cache-models
5.7k帮你的智能体通过模型发现接口,列出正在运行的 MLX-VLM 服务器可以看到的模型,包括缓存模型、自定义模型和已加载的模型。
reproducible-github-issues
5.7k帮你的智能体为 MLX-VLM 撰写清晰、可复现的 GitHub 问题报告,附上环境信息、准确命令和一个小示例,用于反馈缺陷或速度变慢的问题。