llamafile
llamafile は Mozilla の妙技です:GGUFウェイトとランタイム(llama.cpp + Cosmopolitan Libc)が1ファイルに同居しています。ダウンロード、chmod +x、実行。インストールもPythonもDockerも不要です。
llamafile は Mozilla の妙技です:GGUFウェイトとランタイム(llama.cpp + Cosmopolitan Libc)が1ファイルに同居しています。ダウンロード、chmod +x、実行。インストールもPythonもDockerも不要です。
`--server` でポート8080にOpenAI互換が立ちます。コンテキストは起動時の -c で指定。モデルを実行ファイルのまま人に渡したいときの正解です。
- 最大コンテキスト
- Set with -c at launch
- 無料プラン
- 無制限・プライベート
- 条件
- 不要 — アカウントなし
エンドポイント
ベースURL
http://localhost:8080/v1レート制限
None — it is your machine- OpenAI互換
- テキスト
コード例
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: 'LLaMA_CPP',
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="LLaMA_CPP",
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": "LLaMA_CPP",
"messages": [{"role": "user", "content": "Explain closures in one paragraph."}]
}'知っておくべきこと
- `chmod +x model.llamafile && ./model.llamafile --server` で完了です。
無料で利用できるモデル2
- Llama 3.3 70B
llama-3.3-70b - Mixtral 8x7B
open-mixtral-8x7b