README_zh.md
<p style="font-size: 1.3em; font-weight: 600; margin-bottom: 20px;">
<a href="README_zh.md"> 简体中文 </a>
|
<a href="README.md"> English </a>
</p>
<p style="font-size: 1.3em; font-weight: 600; margin-bottom: 20px;">🤝 支持的芯片厂商 </p>
<picture>
<source srcset="assets/chipmakers-dark.png" media="(prefers-color-scheme: dark)">
<source srcset="assets/chipmakers.png" media="(prefers-color-scheme: light)">
</picture>
</p>
<p>
<a href="https://www.producthunt.com/products/nexasdk-for-mobile?embed=true&utm_source=badge-top-post-badge&utm_medium=badge&utm_campaign=badge-nexasdk-for-mobile" target="_blank" rel="noopener noreferrer">
</a>
<a href="https://trendshift.io/repositories/12239" target="_blank" rel="noopener noreferrer">
</a>
</p>
<p>
<a href="https://docs.nexa.ai">
</a>
<a href="https://sdk.nexa.ai/wishlist">
</a>
<a href="https://x.com/nexa_ai"></a>
<a href="https://discord.com/invite/nexa-ai">
</a>
<a href="https://join.slack.com/t/nexa-ai-community/shared_invite/zt-3837k9xpe-LEty0disTTUnTUQ4O3uuNw">
</a>
</p>
NexaSDK 让你用极低能耗打造最快、最聪明的本地 AI。 它是一套高性能本地推理框架,只需几行代码即可在 Android、Windows、Linux、macOS 与 iOS 的 NPU、GPU、CPU 上运行最新的多模态 AI 模型。
NexaSDK 往往能比其他人提前数周甚至数月支持最新模型 —— Qwen3-VL、DeepSeek-OCR、Gemma3n(视觉版)等。
⭐ star本仓库,及时获取最新的本地 AI 能力更新与发布。
| 平台 | 链接 |
|---|---|
| 🖥️ CLI | 快速开始 | 文档 |
| 🐍 Python | 快速开始 | 文档 |
| 🤖 Android | 快速开始 | 文档 |
| 🐳 Linux Docker | 快速开始 | 文档 |
| 🍎 iOS | 快速开始 | 文档 |
下载:
| Windows | macOS | Linux |
|---|---|---|
| arm64 (Qualcomm NPU) | arm64 (Apple Silicon) | arm64 |
| x64 (Intel/AMD NPU) | x64 | x64 |
运行你的第一个模型:
# 与 Qwen3 对话
nexa infer ggml-org/Qwen3-1.7B-GGUF
# 多模态:在 CLI 中拖入图片
nexa infer NexaAI/Qwen3-VL-4B-Instruct-GGUF
# NPU(Windows arm64,Snapdragon X Elite)
nexa infer NexaAI/OmniNeural-4B
pip install nexaai
from nexaai import LLM, GenerationConfig, ModelConfig, LlmChatMessage
llm = LLM.from_(model="NexaAI/Qwen3-0.6B-GGUF", config=ModelConfig())
conversation = [
LlmChatMessage(role="user", content="Hello, tell me a joke")
]
prompt = llm.apply_chat_template(conversation)
for token in llm.generate_stream(prompt, GenerationConfig(max_tokens=100)):
print(token, end="", flush=True)
在 app/AndroidManifest.xml 中添加:
<application android:extractNativeLibs="true">
在 build.gradle.kts 中添加:
dependencies {
implementation("ai.nexa:core:0.0.19")
}
// 初始化 SDK
NexaSdk.getInstance().init(this)
// 加载并运行模型
VlmWrapper.builder()
.vlmCreateInput(VlmCreateInput(
model_name = "omni-neural",
model_path = "/data/data/your.app/files/models/OmniNeural-4B/files-1-1.nexa",
plugin_id = "npu",
config = ModelConfig()
))
.build()
.onSuccess { vlm ->
vlm.generateStreamFlow("Hello!", GenerationConfig()).collect { print(it) }
}
docker pull nexa4ai/nexasdk:latest
export NEXA_TOKEN="your_token_here"
docker run --rm -it --privileged \
-e NEXA_TOKEN \
nexa4ai/nexasdk:latest infer NexaAI/Granite-4.0-h-350M-NPU
下载 NexaSdk.xcframework 并添加到 Xcode 项目。
import NexaSdk
// 示例:语音识别
let asr = try Asr(plugin: .ane)
try await asr.load(from: modelURL)
let result = try await asr.transcribe(options: .init(audioPath: "audio.wav"))
print(result.asrResult.transcript)
| 功能 | NexaSDK | Ollama | llama.cpp | LM Studio |
|---|---|---|---|---|
| NPU 支持 | ✅ NPU 优先 | ❌ | ❌ | ❌ |
| Android/iOS SDK 支持 | ✅ NPU/GPU/CPU 支持 | ⚠️ | ⚠️ | ❌ |
| Linux 支持(Docker 镜像) | ✅ | ✅ | ✅ | ❌ |
| Day-0 支持 GGUF、MLX、NEXA | ✅ | ❌ | ⚠️ | ❌ |
| 完整多模态支持 | ✅ 图像、音频、文本、Embedding、Rerank、ASR、TTS | ⚠️ | ⚠️ | ⚠️ |
| 跨平台支持 | ✅ 桌面、移动(Android、iOS)、车载、IoT(Linux) | ⚠️ | ⚠️ | ⚠️ |
| 一行代码即可运行 | ✅ | ✅ | ⚠️ | ✅ |
| OpenAI 兼容 API + Function calling | ✅ | ✅ | ✅ | ✅ |
我们感谢以下项目:
NexaSDK 采用双重许可模式:
如需模型发布合作、商务洽谈或其他问题,请在此处安排会议。
想要更多模型支持、后端支持、设备支持或新功能?我们很乐意听到你的声音!
欢迎在 GitHub 提交 issue,提出你的需求、建议或反馈。你的意见帮助我们确定优先级。
加入社区: