llamafile
llamafile 是 Mozilla 的妙招:一個檔案同時是 GGUF 權重和執行環境(llama.cpp 加 Cosmopolitan Libc)。下載、chmod +x、執行。免安裝、免 Python、免 Docker。
llamafile 是 Mozilla 的妙招:一個檔案同時是 GGUF 權重和執行環境(llama.cpp 加 Cosmopolitan Libc)。下載、chmod +x、執行。免安裝、免 Python、免 Docker。
`--server` 會在 8080 埠暴露 OpenAI 相容介面。上下文用啟動參數 -c 設定。想把一個模型當執行檔遞給別人,就用它。
- 最大上下文
- Set with -c at launch
- 免費額度
- 無限且私密
- 註冊要求
- 什麼都不用 —— 無帳號
端點
基底網址
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