server-inference
Skill này làm gì
Skill này dạy agent cách khởi động và xử lý sự cố server MLX-VLM mà các công cụ khác gọi qua API kiểu OpenAI. Nội dung gồm kiểm tra tình trạng, danh sách model và yêu cầu chat.
Khi nào nên dùng
- ✓Khi người dùng muốn khởi động server MLX-VLM cục bộ để chat hoặc gọi API.
- ✓Khi một yêu cầu gửi tới server bị lỗi và người dùng cần tìm nguyên nhân.
- ✓Khi người dùng muốn kết nối một ứng dụng tương thích OpenAI với server cục bộ.
Liên kết skill
https://github.com/Blaizzy/mlx-vlm/blob/main/skills/skills/server-inference/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Khởi động server MLX-VLM của tôi và chỉ cho tôi cách gửi yêu cầu chat từ ứng dụng của tôi.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent khởi động server, kiểm tra tình trạng và danh sách model, rồi gửi một yêu cầu thử. Tách riêng lỗi khởi động và lỗi yêu cầu giúp tìm nguyên nhân dễ hơn.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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").
Câu hỏi thường gặp
Server dùng địa chỉ nào?
Các ví dụ dùng một địa chỉ cục bộ ở cổng 8080, và người dùng có thể đổi.
Có hỗ trợ streaming không?
Có. Skill nói nên kiểm thử riêng yêu cầu có streaming và không streaming.
Nên kiểm tra gì trước?
Skill khuyên kiểm tra tình trạng và danh sách model trước khi gỡ lỗi việc sinh nội dung.
Chi tiết
Mô tả gốc của tác giả
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
Độ phổ biến
- Sao GitHub
- 5.7k
- Vị trí xếp hạng
- #14752
- Giấy phép
- MIT
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
cli-inference
5.7kGiúp agent chạy hoặc khắc phục suy luận MLX-VLM từ dòng lệnh, với đầu vào văn bản, hình ảnh và âm thanh, và tìm đúng cờ cho từng việc.
convert-quantize
5.7kGiúp agent chuyển mô hình từ Hugging Face sang định dạng MLX và thu nhỏ bằng lượng tử hóa, chọn số bit, chế độ và hiệu chỉnh cho thiết bị cục bộ.
hf-cache-models
5.7kGiúp agent của bạn liệt kê model mà server MLX-VLM đang chạy thấy được, gồm model đã cache, tùy chỉnh và đã tải, qua endpoint khám phá model.
reproducible-github-issues
5.7kGiúp agent của bạn viết issue GitHub rõ ràng, tái hiện được cho MLX-VLM, kèm thông tin môi trường, lệnh chính xác và ví dụ nhỏ, khi gặp lỗi hoặc chạy chậm.
Skill tương tự
api-connector-builder
280kGiúp agent của bạn xây dựng kết nối API mới theo đúng mẫu đã có, dùng khi bạn cần thêm một tích hợp mà không tạo cách làm mới.
api-design
280kGiúp agent của bạn thiết kế REST API theo các thực hành tốt nhất, hữu ích để định nghĩa cách API giao tiếp, hiển thị lỗi và tổ chức dữ liệu.
backend-patterns
280kGiúp agent của bạn với các mẫu kiến trúc phía máy chủ và tối ưu cơ sở dữ liệu, hữu ích khi xây dựng hoặc rà soát code chạy trên máy chủ.