Offline AI Assistant Help 离线 AI 助手帮助
This page is based on official project issues and summarizes API usage, model downloads, and support links.
本页面基于项目官方 issue,汇总 API 调用示例、模型下载说明和问题反馈入口。
1. OpenAI Compatible API Usage 1. OpenAI 兼容接口调用
Default endpoint: http://<device-ip>:8080/v1/chat/completions
默认端点:http://<设备IP>:8080/v1/chat/completions
cURL (non-streaming):
cURL(非流式):
curl http://<device-ip>:8080/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "gemma",
"messages": [
{"role": "system", "content": "You are an emergency rescue assistant"},
{"role": "user", "content": "How to assess if a building is safe after an earthquake?"}
]
}'
cURL (streaming):
cURL(流式):
curl http://<device-ip>:8080/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "gemma",
"stream": true,
"messages": [
{"role": "user", "content": "Hello"}
]
}'
Node.js (OpenAI SDK):
Node.js(OpenAI SDK):
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "local",
baseURL: "http://<device-ip>:8080/v1",
});
const completion = await client.chat.completions.create({
model: "gemma",
messages: [{ role: "user", content: "How can I purify drinking water during floods?" }],
});
console.log(completion.choices[0].message.content);
- Replace
<device-ip>with your actual device LAN IP. - 请将
<设备IP>替换为你设备的局域网 IP。 - Use
"stream": trueto switch to streaming output. - 通过
"stream": true切换为流式输出。 - Local service does not require a real API key.
- 本地服务无需真实 API Key,可使用占位字符串。
2. Model File Download 2. 模型文件下载
- Recommended model list (task tag and
.litertlmsuffix): https://huggingface.co/litert-community/models - 推荐模型列表(支持 task 标签和
.litertlm后缀):https://huggingface.co/litert-community/models - Multimodal models (Gemma 3n preview): https://huggingface.co/collections/google/gemma-3n-preview
- 多模态模型(Gemma 3n 预览):https://huggingface.co/collections/google/gemma-3n-preview
百度网盘分流(建议中国用户):
- 4B 模型:https://pan.baidu.com/s/1wsuaoiKHPd_u-RTFz6HI3g?pwd=df5j(提取码:df5j)
- 2B 模型:https://pan.baidu.com/s/1ZFLnhDFBzCNpz50zMNhDWg?pwd=4q98(提取码:4q98)
- 旧机型 270m 模型:https://pan.baidu.com/s/17r6Bt6swdFrOgU7kdXIkPg?pwd=xyqv(提取码:xyqv)
For users in Mainland China, Baidu Netdisk mirrors are listed in the Chinese section.
3. Feedback and Suggestions 3. 问题反馈与建议
Please submit bugs, feature requests, and suggestions here:
欢迎在这里提交问题、建议和功能需求: