server-inference
できること
このスキルは、OpenAI形式のAPIを通じて他のツールから呼び出される、MLX-VLMのサーバーを起動してトラブルシュートする方法をエージェントに教えます。ヘルスチェック、モデル一覧、チャットのリクエストを扱います。
使う場面
- ✓チャットやAPIの呼び出しのために、ローカルのMLX-VLMサーバーを起動したいとき。
- ✓サーバーへのリクエストが失敗し、その理由を調べる必要があるとき。
- ✓OpenAI互換のアプリを、ローカルのサーバーにつなぎたいとき。
スキルのリンク
https://github.com/Blaizzy/mlx-vlm/blob/main/skills/skills/server-inference/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。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のIssueを書けるよう支援します。
似ているスキル
api-connector-builder
280kエージェントが既存のパターンに従って、新しいAPI連携を構築します。新しい方式を作らずに、もう一つ連携を追加したいときに使います。
api-design
280kエージェントがベストプラクティスに沿ってREST APIを設計できるようにします。APIの通信方法、エラーの表示方法、データの整理方法を決めるのに役立ちます。
backend-patterns
280kエージェントのサーバーサイドのアーキテクチャパターンとデータベースの最適化を支援します。サーバー上で動くコードを作成またはレビューするときに役立ちます。