NexaSDK 让你以最低的能耗构建最智能、最快速的端侧 AI。 它是一个高性能的本地推理框架,只需几行代码,即可在 NPU、GPU 和 CPU 上,跨 Android、Windows、Linux、macOS 和 iOS 设备本地运行最新的多模态 AI 模型。
NexaSDK 支持最新模型的速度领先其他方案数周甚至数月——包括 Qwen3-VL、DeepSeek-OCR、Gemma3n (Vision) 等。
⭐ 为本仓库点星,以获取关于最新端侧 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 with 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 采用双重许可模式:
根据 Apache License 2.0 许可。
如需模型发布合作、业务咨询或其他问题,请通过 此链接 与我们预约通话。
希望获得更多模型支持、后端支持、设备支持或其他功能?我们很乐意听取您的意见!
欢迎在我们的 GitHub