Back to LocalAI Home 返回 LocalAI 首页

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);

2. Model File Download 2. 模型文件下载

百度网盘分流(建议中国用户):

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:

欢迎在这里提交问题、建议和功能需求:

https://github.com/nesror/Offline-AI-Assistant/issues