> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ariacompute.com/llms.txt
> Use this file to discover all available pages before exploring further.

# aria-engine runtime and FFI

> Run Aria model bundles on device with the aria-engine binary or link libaria-engine_ffi from C, Rust, Python, or Swift for embedded inference.

`aria-engine` runs Aria model bundles (`weight.bin` + `config.json`) locally for language, vision, and VLA/policy inference. Ship it as a standalone binary or embed the FFI shared library into your application.

## Install

Fetch the latest release for your platform from the [downloads page](/resources/downloads) or programmatically:

```bash theme={null}
curl -s https://ariacompute.com/api/download/engine-latest \
  | jq -r '.assets[] | select(.name | test("linux-x86_64.tar.gz$")) | .url' \
  | xargs curl -L -o aria-engine.tar.gz
tar xf aria-engine.tar.gz
```

<Note>
  On the China site the same endpoint mirrors from Gitee. Use `https://ariacompute.cn/api/download/engine-latest`.
</Note>

## Get a model bundle

Download a bundle with your API key, then unpack it:

```bash theme={null}
curl -L -H "Authorization: Bearer bfvk-XXXXXXXXXXXXXXXX" \
  "https://ariacompute.com/api/models/gemma-4-e2b-it/download?quant=int4&sdk=v1.0" \
  -o gemma-4-e2b-it_q4.zip
unzip gemma-4-e2b-it_q4.zip -d ./models/gemma-4-e2b-it_q4
```

The bundle contains `weight.bin`, `config.json`, and optional tokenizer sidecars. See [Models](/concepts/models) for the full layout and quantization matrix.

## Run inference from the CLI

```bash theme={null}
./aria-engine serve \
  --model ./models/gemma-4-e2b-it_q4 \
  --host 127.0.0.1 --port 8080
```

The server exposes an OpenAI-compatible `/v1/chat/completions` endpoint on the configured port. Point any OpenAI-compatible client at `http://127.0.0.1:8080/v1`.

## Embed with libaria-engine\_ffi

Each release ships a shared library alongside the CLI: `libaria-engine_ffi-linux-x86_64.so`, `libaria_engine_ffi.dylib`, `aria_engine_ffi.dll`. Link it from C, Rust, Python (via `ctypes`/`cffi`), Swift, or any language with a C ABI.

<Tabs>
  <Tab title="C">
    ```c app.c icon=c theme={null}
    #include "aria_engine.h"

    int main(void) {
        AriaEngine *engine = aria_engine_new("./models/gemma-4-e2b-it_q4");
        char *out = aria_engine_generate(engine, "Hello, world.", 256);
        printf("%s\n", out);
        aria_engine_free_string(out);
        aria_engine_free(engine);
        return 0;
    }
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    import ctypes
    lib = ctypes.CDLL("./libaria-engine_ffi-linux-x86_64.so")
    lib.aria_engine_new.restype = ctypes.c_void_p
    lib.aria_engine_generate.restype = ctypes.c_char_p
    engine = lib.aria_engine_new(b"./models/gemma-4-e2b-it_q4")
    out = lib.aria_engine_generate(engine, b"Hello, world.", 256)
    print(out.decode())
    ```
  </Tab>
</Tabs>

<Tip>
  Bundled C headers ship in the release archive under `include/`. Consult them for the full FFI surface: streaming callbacks, KV cache management, tokenizer helpers, and cleanup functions.
</Tip>

## Model fetch inside the engine

The `aria-engine` CLI can also fetch models directly from Hugging Face (international) or ModelScope (China). This is separate from the Dashboard model registry and does not consume your Aria Compute wallet:

```bash theme={null}
./aria-engine pull ariacompute/gemma-4-e2b-it_q4
```


## Related topics

- [aria-router runtime and FFI](/sdks/router-runtime.md)
- [Aria Compute SDKs and client libraries](/sdks/overview.md)
- [Latest engine, router, agent, and memo releases](/resources/downloads.md)
- [GET /api/download/engine-latest — latest aria-engine release](/api-reference/downloads/engine-latest.md)
- [GET /api/download/router-latest — latest aria-router release](/api-reference/downloads/router-latest.md)
