Overview
mx.serve() starts a local FastAPI server that exposes OpenAI-compatible chat and completion endpoints. This makes it straightforward to use Axionic-hosted or locally loaded models with any tool or library that speaks the OpenAI API format, without changing your existing code.
serve()
string
The model name to serve. Uses the currently loaded local model if omitted, or the default remote model.
string
default:"0.0.0.0"
Host address to bind the server to.
integer
default:"8000"
Port to listen on.
boolean
default:"false"
If
true, uses vLLM as the inference backend instead of the default PyTorch / remote path.list[str]
Behavior names to monitor and auto-correct for all requests handled by this server instance.
Endpoints
Once the server is running:
Both accept standard OpenAI request bodies.
Axionic Extensions
Pass Axionic-specific parameters viaextra_body on the OpenAI Python client, or include them directly in the JSON request body:
mx.serve(corrected_behaviors=[...]) applies those behavior monitors to every request handled by that server instance. The CLI form, mechanex serve, exposes --host, --port, and --use-vllm; use Python when you need process-wide corrected_behaviors.