Back to Nexa Sdk

README Zh

README_zh.md

0.2.7313.6 KB
Original Source
<div align="center" style="text-decoration: none;">
<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>
</div>

NexaSDK

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快速开始文档

🖥️ CLI

下载:

WindowsmacOSLinux
arm64 (Qualcomm NPU)arm64 (Apple Silicon)arm64
x64 (Intel/AMD NPU)x64x64

运行你的第一个模型:

bash
# 与 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
  • 模型类型: LLM、多模态、ASR、OCR、Rerank、目标检测、图像生成、Embedding
  • 格式: GGUF、MLX、NEXA
  • NPU 模型: Model Hub
  • 📖 CLI 参考文档

🐍 Python SDK

bash
pip install nexaai
python
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)
  • 模型类型: LLM、多模态、ASR、OCR、Rerank、目标检测、图像生成、Embedding
  • 格式: GGUF、MLX、NEXA
  • NPU 模型: Model Hub
  • 📖 Python SDK 文档

🤖 Android SDK

app/AndroidManifest.xml 中添加:

xml
<application android:extractNativeLibs="true">

build.gradle.kts 中添加:

kotlin
dependencies {
		implementation("ai.nexa:core:0.0.19")
}
kotlin
// 初始化 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) }
		}
  • 要求: Android minSdk 27,Qualcomm Snapdragon 8 Gen 4 芯片
  • 模型类型: LLM、多模态、ASR、OCR、Rerank、Embedding
  • NPU 模型: Supported Models
  • 📖 Android SDK 文档

🐳 Linux Docker

bash
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

🍎 iOS SDK

下载 NexaSdk.xcframework 并添加到 Xcode 项目。

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

⚙️ 功能与对比

<div align="center">
功能NexaSDKOllamallama.cppLM 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
<p align="center" style="margin-top:14px"> <i> <b>图例:</b> <span title="Full support">✅ Supported</span> &nbsp; | &nbsp; <span title="Partial or limited support">⚠️ Partial or limited support </span> &nbsp; | &nbsp; <span title="Not Supported">❌ No</span> </i> </p> </div>

🙏 致谢

我们感谢以下项目:

📄 许可证

NexaSDK 采用双重许可模式:

CPU/GPU 组件

基于 Apache License 2.0

NPU 组件

🤝 联系与社区支持

商务合作

如需模型发布合作、商务洽谈或其他问题,请在此处安排会议。

社区与支持

想要更多模型支持、后端支持、设备支持或新功能?我们很乐意听到你的声音!

欢迎在 GitHub 提交 issue,提出你的需求、建议或反馈。你的意见帮助我们确定优先级。

加入社区: