MLX
mlx-lm は Apple の配列フレームワークを言語モデルに向けたものです。M系列Macでは最速のローカル経路になります。ユニファイドメモリを使い、外付GPUと奪い合わないためです。
mlx-lm は Apple の配列フレームワークを言語モデルに向けたものです。M系列Macでは最速のローカル経路になります。ユニファイドメモリを使い、外付GPUと奪い合わないためです。
Apple Silicon 専用。`mlx_lm.server --model mlx-community/Qwen3-8B-4bit` が localhost:8080/v1 でOpenAI互換を提供します。コンテキストの上限はユニファイドメモリの分量そのものです。
- 最大コンテキスト
- Whatever your unified memory allows
- 無料プラン
- 無制限・プライベート
- 条件
- 不要 — アカウントなし
エンドポイント
ベースURL
http://localhost:8080/v1レート制限
None — it is your machine- OpenAI互換
- 公式SDK:mlx-lm
- テキスト
- ビジョン
コード例
npm install openaiimport OpenAI from 'openai'
const client = new OpenAI({
baseURL: 'http://localhost:8080/v1',
apiKey: 'not-needed'
})
const response = await client.chat.completions.create({
model: 'mlx-community/Qwen3-8B-4bit',
messages: [{ role: 'user', content: 'Explain closures in one paragraph.' }]
})
console.log(response.choices[0].message.content)pip install openaifrom openai import OpenAI
client = OpenAI(
base_url="http://localhost:8080/v1",
api_key="not-needed",
)
response = client.chat.completions.create(
model="mlx-community/Qwen3-8B-4bit",
messages=[{"role": "user", "content": "Explain closures in one paragraph."}],
)
print(response.choices[0].message.content)curl http://localhost:8080/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "mlx-community/Qwen3-8B-4bit",
"messages": [{"role": "user", "content": "Explain closures in one paragraph."}]
}'pip install mlx-lmfrom mlx_lm import load, generate
model, tokenizer = load("mlx-community/Qwen3-8B-4bit")
prompt = tokenizer.apply_chat_template(
[{"role": "user", "content": "Explain closures in one paragraph."}],
add_generation_prompt=True,
)
print(generate(model, tokenizer, prompt=prompt, max_tokens=512))知っておくべきこと
- Apple Silicon 専用です。
- まずサーバーを起動:`mlx_lm.server --model mlx-community/Qwen3-8B-4bit`。
無料で利用できるモデル3
- Qwen 3
qwen3 - Qwen Coder
Qwen2.5-Coder-7B - GPT-OSS 120B
gpt-oss-120b