All examples
Model APIs

A configured language model API

Expose one fixed local language model client through a bounded completion route without accepting request supplied provider configuration.

Download .aner source
api_llm.aner
// Requires an already served Ollama model named llama3.2:3b.
// Requests cannot change the provider, model, endpoint or credential.
// Ctrl+C stops the foreground API.
import aner.api
import aner.llm

let model = llm.client("ollama", "llama3.2:3b")
let app = api.app("Local completion").llm("/generate", model)
    .output_limit(max_tokens: 256).rate_limit(requests_per_minute: 30)
print(app.openapi())
app.serve()

Make it your experiment.

With Aner installed, save this program as examples/api_llm.aner inside a folder for your experiment. Open a terminal in that folder, then check and run the program.

Terminal
aner check examples/api_llm.aner
aner run examples/api_llm.aner

The 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
Install Aner