Explicit HTTPS and API authentication
Configure a permitted hostname, trusted TLS files, an opaque inbound bearer reference and request bounds for an external listener.
Download .aner source// Prepare iris.anermodel with api_train_checkpoint.aner first.
// Configure a dedicated token: aner secrets set inference-api
// Provide a trusted server.pem chain for models.example.org and owner-only server-key.pem.
// This explicit external listener requires native TLS and authentication.
import aner.api
import aner.ml
import aner.secrets
let model = ml.load_classifier("iris.anermodel")
let app = api.app("Iris inference")
.model("/predict", model)
.auth(secrets.stored("inference-api"))
.tls(certificate: "server.pem", private_key: "server-key.pem")
.bind(host: "0.0.0.0", port: 8443)
.hostname("models.example.org")
.limits(max_rows: 64, timeout_ms: 10000)
app.serve()
Make it your experiment.
With Aner installed, save this program as examples/api_secure.aner inside a folder for your experiment. Open a terminal in that folder, then check and run the program.
aner check examples/api_secure.aner
aner run examples/api_secure.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