A native neural model API
Train a small classifier once, then serve validated feature rows on a native loopback listener.
Download .aner source// Iris: Fisher (1936), UCI, CC BY 4.0. See THIRD_PARTY_DATA.md.
// Trains once before serving; Ctrl+C stops the foreground API.
import aner.api
import aner.dataset
import aner.nn
import aner.ml
let split = dataset.iris().split(test: 0.2, seed: 2026)
let network = nn.sequential(seed: 42)
.dense(inputs: 4, outputs: 8).tanh()
.dense(inputs: 8, outputs: 3)
let model = ml.classifier(network, standardize: true)
.fit(split.train(), epochs: 200, rate: 0.1)
let app = api.app("Iris inference").model("/predict", model)
print(app.openapi())
app.serve()
Make it your experiment.
With Aner installed, save this program as examples/api_local.aner inside a folder for your experiment. Open a terminal in that folder, then check and run the program.
aner check examples/api_local.aner
aner run examples/api_local.anerThe aner command must be on your PATH. Follow the installation guide if your terminal cannot find it.
Use the compatible native Aner development engine with aner.api and VS Code extension 0.1.35 or newer. Checking opens no listener. Serving runs in the foreground until stopped. Checkpoint examples require iris.anermodel prepared by api_train_checkpoint.aner in the working directory. Native HTTPS requires a compatible TLS build, a trusted certificate chain and owner protected private key, an explicit permitted hostname and a dedicated inbound bearer reference. Local completion requires the named model already served by Ollama. See Model inference APIs for schemas, transport, deployment, deadlines and device preservation.
Iris and Wine are teaching datasets with their own attribution. Example outcomes are not comparative benchmarks or evidence of clinical validity.
Dataset sources & attribution