# nexaai/nexa-sdk architecture

> Architecture diagram of the GitHub repository nexaai/nexa-sdk, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nexaai/nexa-sdk
- Repository: https://github.com/nexaai/nexa-sdk

## Overview

GenieX is an on-device LLM/VLM inference runtime for Qualcomm Snapdragon devices, with model discovery and download alongside local generation. Users can enter through the CLI, Python, Android, or the C SDK; the CLI also exposes an OpenAI-compatible server. The model manager plans models from supported hubs, downloads and tracks them, and resolves local paths. Inference then dispatches through the SDK to llama.cpp or Qualcomm AI Engine Direct. README documents these interface and backend capabilities; several connections below are based on that documentation because their source was not sampled.

Main entry points: [`sdk/src/registry.cpp`](https://github.com/nexaai/nexa-sdk/blob/main/sdk/src/registry.cpp) (Plugin Registry), [`sdk/model-manager/crates/ffi/src/lib.rs`](https://github.com/nexaai/nexa-sdk/blob/main/sdk/model-manager/crates/ffi/src/lib.rs) (Model FFI), [`cli/cmd/geniex/main.go`](https://github.com/nexaai/nexa-sdk/blob/main/cli/cmd/geniex/main.go) (CLI Commands), [`sdk/include/geniex.h`](https://github.com/nexaai/nexa-sdk/blob/main/sdk/include/geniex.h) (C API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User Interfaces"]
  node_cli["CLI Commands<br/>[main.go]"]
  node_python["Python API<br/>[auto.py]"]
  node_android["Android API<br/>[GenieXSdk.kt]"]
  node_capi["C API<br/>[geniex.h]"]
  node_go["Go Binding<br/>[common.go]"]
  node_pyffi["Python FFI<br/>[_api.py]"]
  node_androidwrap["Model Wrapper"]
  node_jni["JNI Bridge"]
end

subgraph group_management["Model Management"]
  node_ffi["Model FFI<br/>[lib.rs]"]
  node_core["Model Manager Core<br/>[lib.rs]"]
  node_query["Model Query<br/>[query.rs]"]
  node_pull["Model Pull<br/>[pull.rs]"]
  node_sources["Hub Sources<br/>[mod.rs]"]
  node_store[("Model Store<br/>[store.rs]")]
end

subgraph group_sdk["Inference SDK"]
  node_llm["LLM API<br/>[llm.cpp]"]
  node_vlm["VLM API<br/>[vlm.cpp]"]
  node_registry["Plugin Registry<br/>[registry.cpp]"]
end

subgraph group_backends["Runtime Backends"]
  node_llama["llama.cpp Backend<br/>[plugin.cpp]"]
  node_qairt["QAIrt Backend<br/>[plugin.cpp]"]
end

subgraph group_server["HTTP Server"]
  node_server["HTTP Server<br/>[server.go]"]
  node_routes["API Routes<br/>[route.go]"]
  node_handlers["Chat Handlers<br/>[chat.go]"]
end

node_user(("Developer / User"))
node_client(("OpenAI Client"))

node_user -->|"runs commands"| node_cli
node_user -->|"uses API"| node_python
node_user -->|"uses API"| node_android
node_user -->|"calls"| node_capi
node_cli -->|"uses binding"| node_go
node_python -->|"calls"| node_pyffi
node_android -->|"uses wrapper"| node_androidwrap
node_androidwrap -->|"calls"| node_jni
node_go -->|"calls C FFI"| node_ffi
node_pyffi -->|"calls C FFI"| node_ffi
node_jni -->|"calls C FFI"| node_ffi
node_capi -->|"exposes API"| node_llm
node_capi -->|"exposes API"| node_vlm
node_cli -->|"starts"| node_server
node_client -->|"sends requests"| node_server
node_server -->|"registers routes"| node_routes
node_routes -->|"dispatches"| node_handlers
node_handlers -->|"uses SDK binding"| node_go
node_ffi -->|"invokes operations"| node_core
node_core -->|"plans candidates"| node_query
node_core -->|"pulls models"| node_pull
node_query -->|"plans against"| node_sources
node_pull -->|"fetches from"| node_sources
node_pull -->|"writes model data"| node_store
node_llm -->|"selects plugin"| node_registry
node_vlm -->|"selects plugin"| node_registry
node_registry -->|"dispatches"| node_llama
node_registry -->|"dispatches"| node_qairt

click node_cli "https://github.com/nexaai/nexa-sdk/blob/main/cli/cmd/geniex/main.go"
click node_python "https://github.com/nexaai/nexa-sdk/blob/main/bindings/python/geniex/auto.py"
click node_android "https://github.com/nexaai/nexa-sdk/blob/main/bindings/android/app/src/main/java/com/geniex/sdk/GenieXSdk.kt"
click node_capi "https://github.com/nexaai/nexa-sdk/blob/main/sdk/include/geniex.h"
click node_go "https://github.com/nexaai/nexa-sdk/blob/main/bindings/go/common.go"
click node_pyffi "https://github.com/nexaai/nexa-sdk/blob/main/bindings/python/geniex/_ffi/_api.py"
click node_androidwrap "https://github.com/nexaai/nexa-sdk/blob/main/bindings/android/app/src/main/java/com/geniex/sdk/ModelManagerWrapper.kt"
click node_jni "https://github.com/nexaai/nexa-sdk/blob/main/bindings/android/app/src/main/cpp/model_manager_jni.cpp"
click node_server "https://github.com/nexaai/nexa-sdk/blob/main/cli/server/server.go"
click node_routes "https://github.com/nexaai/nexa-sdk/blob/main/cli/server/route.go"
click node_handlers "https://github.com/nexaai/nexa-sdk/blob/main/cli/server/handler/chat.go"
click node_ffi "https://github.com/nexaai/nexa-sdk/blob/main/sdk/model-manager/crates/ffi/src/lib.rs"
click node_core "https://github.com/nexaai/nexa-sdk/blob/main/sdk/model-manager/crates/core/src/lib.rs"
click node_query "https://github.com/nexaai/nexa-sdk/blob/main/sdk/model-manager/crates/core/src/query.rs"
click node_pull "https://github.com/nexaai/nexa-sdk/blob/main/sdk/model-manager/crates/core/src/pull.rs"
click node_sources "https://github.com/nexaai/nexa-sdk/blob/main/sdk/model-manager/crates/core/src/source/mod.rs"
click node_store "https://github.com/nexaai/nexa-sdk/blob/main/sdk/model-manager/crates/core/src/store.rs"
click node_llm "https://github.com/nexaai/nexa-sdk/blob/main/sdk/src/llm.cpp"
click node_vlm "https://github.com/nexaai/nexa-sdk/blob/main/sdk/src/vlm.cpp"
click node_registry "https://github.com/nexaai/nexa-sdk/blob/main/sdk/src/registry.cpp"
click node_llama "https://github.com/nexaai/nexa-sdk/blob/main/sdk/plugins/llama_cpp/src/plugin.cpp"
click node_qairt "https://github.com/nexaai/nexa-sdk/blob/main/sdk/plugins/qairt/src/plugin.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_python,node_android,node_capi,node_go,node_pyffi,node_androidwrap,node_jni,node_user,node_client toneBlue
class node_ffi,node_core,node_query,node_pull,node_sources,node_store toneAmber
class node_llm,node_vlm,node_registry toneMint
class node_llama,node_qairt toneRose
class node_server,node_routes,node_handlers toneIndigo
```

## Components

### User Interfaces

- [CLI Commands](https://github.com/nexaai/nexa-sdk/blob/main/cli/cmd/geniex/main.go): `cli/cmd/geniex/main.go`
- [Python API](https://github.com/nexaai/nexa-sdk/blob/main/bindings/python/geniex/auto.py): `bindings/python/geniex/auto.py`
- [Android API](https://github.com/nexaai/nexa-sdk/blob/main/bindings/android/app/src/main/java/com/geniex/sdk/GenieXSdk.kt): `bindings/android/app/src/main/java/com/geniex/sdk/GenieXSdk.kt`
- [C API](https://github.com/nexaai/nexa-sdk/blob/main/sdk/include/geniex.h): `sdk/include/geniex.h`
- [Go Binding](https://github.com/nexaai/nexa-sdk/blob/main/bindings/go/common.go): `bindings/go/common.go`
- [Python FFI](https://github.com/nexaai/nexa-sdk/blob/main/bindings/python/geniex/_ffi/_api.py): `bindings/python/geniex/_ffi/_api.py`
- [Model Wrapper](https://github.com/nexaai/nexa-sdk/blob/main/bindings/android/app/src/main/java/com/geniex/sdk/ModelManagerWrapper.kt): `bindings/android/app/src/main/java/com/geniex/sdk/ModelManagerWrapper.kt`
- [JNI Bridge](https://github.com/nexaai/nexa-sdk/blob/main/bindings/android/app/src/main/cpp/model_manager_jni.cpp): `bindings/android/app/src/main/cpp/model_manager_jni.cpp`

### Model Management

- [Model FFI](https://github.com/nexaai/nexa-sdk/blob/main/sdk/model-manager/crates/ffi/src/lib.rs): `sdk/model-manager/crates/ffi/src/lib.rs`
- [Model Manager Core](https://github.com/nexaai/nexa-sdk/blob/main/sdk/model-manager/crates/core/src/lib.rs): `sdk/model-manager/crates/core/src/lib.rs`
- [Model Query](https://github.com/nexaai/nexa-sdk/blob/main/sdk/model-manager/crates/core/src/query.rs): `sdk/model-manager/crates/core/src/query.rs`
- [Model Pull](https://github.com/nexaai/nexa-sdk/blob/main/sdk/model-manager/crates/core/src/pull.rs): `sdk/model-manager/crates/core/src/pull.rs`
- [Hub Sources](https://github.com/nexaai/nexa-sdk/blob/main/sdk/model-manager/crates/core/src/source/mod.rs): `sdk/model-manager/crates/core/src/source/mod.rs`
- [Model Store](https://github.com/nexaai/nexa-sdk/blob/main/sdk/model-manager/crates/core/src/store.rs): `sdk/model-manager/crates/core/src/store.rs`

### Inference SDK

- [LLM API](https://github.com/nexaai/nexa-sdk/blob/main/sdk/src/llm.cpp): `sdk/src/llm.cpp`
- [VLM API](https://github.com/nexaai/nexa-sdk/blob/main/sdk/src/vlm.cpp): `sdk/src/vlm.cpp`
- [Plugin Registry](https://github.com/nexaai/nexa-sdk/blob/main/sdk/src/registry.cpp): `sdk/src/registry.cpp`

### Runtime Backends

- [llama.cpp Backend](https://github.com/nexaai/nexa-sdk/blob/main/sdk/plugins/llama_cpp/src/plugin.cpp): `sdk/plugins/llama_cpp/src/plugin.cpp`
- [QAIrt Backend](https://github.com/nexaai/nexa-sdk/blob/main/sdk/plugins/qairt/src/plugin.cpp): `sdk/plugins/qairt/src/plugin.cpp`

### HTTP Server

- [HTTP Server](https://github.com/nexaai/nexa-sdk/blob/main/cli/server/server.go): `cli/server/server.go`
- [API Routes](https://github.com/nexaai/nexa-sdk/blob/main/cli/server/route.go): `cli/server/route.go`
- [Chat Handlers](https://github.com/nexaai/nexa-sdk/blob/main/cli/server/handler/chat.go): `cli/server/handler/chat.go`

### Other components

- **Developer / User**
- **OpenAI Client**

## Connections

- Developer / User → CLI Commands: runs commands
- Developer / User → Python API: uses API
- Developer / User → Android API: uses API
- Developer / User → C API: calls
- CLI Commands → Go Binding: uses binding
- Python API → Python FFI: calls
- Android API → Model Wrapper: uses wrapper
- Model Wrapper → JNI Bridge: calls
- Go Binding → Model FFI: calls C FFI
- Python FFI → Model FFI: calls C FFI
- JNI Bridge → Model FFI: calls C FFI
- C API → LLM API: exposes API
- C API → VLM API: exposes API
- CLI Commands → HTTP Server: starts
- OpenAI Client → HTTP Server: sends requests
- HTTP Server → API Routes: registers routes
- API Routes → Chat Handlers: dispatches
- Chat Handlers → Go Binding: uses SDK binding
- Model FFI → Model Manager Core: invokes operations
- Model Manager Core → Model Query: plans candidates
- Model Manager Core → Model Pull: pulls models
- Model Query → Hub Sources: plans against
- Model Pull → Hub Sources: fetches from
- Model Pull → Model Store: writes model data
- LLM API → Plugin Registry: selects plugin
- VLM API → Plugin Registry: selects plugin
- Plugin Registry → llama.cpp Backend: dispatches
- Plugin Registry → QAIrt Backend: dispatches
