All examples
Language models

Serve through an explicitly connected worker

Keep the HTTP listener on the controller while a trusted worker owns the complete model and inference context.

llm_remote_server.aner
// Requires a compatible installed runtime with the selected native capabilities.
// Copy the JSON template to a private configuration and replace its placeholders.
// Replace the GGUF path with a compatible model on this controller computer.
import aner.llm
import aner.api

let device = llm.remote_connect("private.remote-worker.json")
print(device)
print(llm.devices())
// Verify the worker artifact; upload local bytes on a cache miss or with session policy.
print(llm.plan("models/local-instruct-q4.gguf", context: 2048,
    device: device, kv_cache_type: "f16", flash_attention: "auto",
    gpu_budget_mib: 7168, ram_budget_mib: 24576, reserve_mib: 512))
let serving = llm.load_fitted("models/local-instruct-q4.gguf", context: 2048,
    device: device, kv_cache_type: "f16", flash_attention: "auto",
    gpu_budget_mib: 7168, ram_budget_mib: 24576, reserve_mib: 512)
// Rendering, tokenization, inference and sampling execute on the worker.
let warmup = serving.generate("Say hello.", max_tokens: 1)
print(warmup.text())
print(serving.load_summary())
print(serving.memory_summary())

// The HTTP listener and application stay on this controller computer.
let app = api.app("Aner remote-device chat").llm(path: "/chat", model: serving)
    .bind(host: "127.0.0.1", port: 11435)
    .limits(max_rows: 64, timeout_ms: 120000)
    .output_limit(max_tokens: 128)
app.serve()
serving.close()
llm.remote_disconnect(device)

Make it your experiment.

Use Aner 0.1.0 or newer. Save this program as examples/llm_remote_server.aner inside a folder for your experiment. Open a terminal in that folder, then check and run the program.

Terminal
aner check examples/llm_remote_server.aner
aner run examples/llm_remote_server.aner

The aner command must be on your PATH. Follow the installation guide if your terminal cannot find it.

Requires Aner 0.1.0 or newer. Requires Aner 0.0.9 or newer. Requires a matching native inference runtime and a separately supplied compatible local GGUF model. Checking loads no model and opens no listener or connection. Running loads weights, performs a short warmup and serves on loopback until stopped. Adjust context and budgets to the actual machine.

Credential setup
aner check examples/llm_remote_server.aner
aner run examples/llm_remote_server.aner

Client construction and syntax checking send no inference request. Running this program calls its explicit model service. Inspect the returned finish reason and reported usage; unavailable token counts remain unknown and usage does not verify charges.

Read token accounting and provider requirements
Install Aner