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