Skip to main content

Installation

Nexa AI Android SDK is available from Maven Central, the latest version is 0.0.12. You can also find it from Maven Repository which updates a bit slower than Maven Central.

Add Dependency

Add the following to your app/build.gradle.kts to import NexaSDK:
dependencies {
    implementation("ai.nexa:core:0.0.12")
}
The default repository is mavenCentral(). You can also add github’s raw repository in the settings.gradle.kts:
dependencyResolutionManagement{
    repositories {
        maven {
            url = uri("https://raw.githubusercontent.com/NexaAI/core/main")
        }
    }
}

Run Your First Model

1

Initialize SDK

Initialize the NexaSDK in your Android application:
NexaSdk.getInstance().init(this)
2

Download and Load Model

Create a VLM wrapper and load a model for NPU inference. You can download OmniNeural-4B model from huggingface and place it in the folder that your app has permission to access, for example: /data/data/${your-app-packagename}/files/models/OmniNeural-4B
VlmWrapper.builder()
    .vlmCreateInput(
        VlmCreateInput(
            model_name = "omni-neural",
            model_path = <your-model-file-absolute-path>,
            config = ModelConfig(
                max_tokens = 2048,
                enable_thinking = false
            ),
            plugin_id = "npu"
        )
    )
    .build()
    .onSuccess { vlmWrapper = it }
Your app should have permission to access the model folder. For example, in the demo, the model_path is set to /data/data/com.nexa.demo/files/models/OmniNeural-4B/files-1-1.nexa
3

Generate Content

Use the loaded model to generate responses:
vlmWrapper.generateStreamFlow("Who are you?", GenerationConfig()).collect { result ->
    println(result)
}

Supported Models

We’ve curated collections of compatible models for you to explore:

NPU Models

Optimized models for Qualcomm NPU

GGUF Models

Any GGUF format LLM and VLM models

Device Compatibility

  • Qualcomm Snapdragon 8 Gen 4
  • Qualcomm Adreno GPU
  • ARM64-v8a

Next Steps

API Reference

Explore detailed documentation for all model types and learn their usage.