Skip to content

Engine API

To run the engine without the app, use these commands:

Terminal window
cd engine && uv run dmlx serve --port 8642
curl -s localhost:8642/v1/images/generations -H 'content-type: application/json' \
-d '{"prompt":"a rowboat on a lake at dawn","size":"1024x1024"}' | jq '.dmlx'
Method Path Notes
POST /v1/images/generations OpenAI-compatible; stream: true returns server-sent events
POST /v1/images/edits multipart (OpenAI style) or JSON with source_id / reference_ids
POST /v1/workflows workflow with validation and capability checks; supports streaming
POST /v1/workflows/route what to do with a chat message; "plan": true asks the agent
GET /v1/capabilities operations and input limits of each model
POST /v1/prompts/compile prompt enhancement preview
POST /v1/uploads stores an image and gives an id for later references
GET /v1/results/{id} · /meta PNG with the prompt and seed in the file · its metadata
GET/DELETE /v1/jobs/{id} · /events status · cancel · events
POST /v1/jobs/{id}/retry runs a failed workflow again from the failed step
GET /v1/models catalog with downloaded / loaded state
POST /admin/models/{id}/pull · load · unload download, pin, free
GET /admin/memory memory budget, pressure, loaded parts
GET/POST /admin/prompt-assistant · /select · /pull agent models: status, select, download

Events: queued, plan, loading{component}, encoding, step{step,total}, decoding, image{result_id}, done{result_ids, report}, error{code,message}, cancelled.

The app sets these values in Settings → Intelligence. If you use the engine without the app, set these environment variables.

Variable Use
DMLX_PROMPT_ASSISTANT_MODEL Agent model id (for example, ministral-3-3b-instruct-2512-4bit)
DMLX_PROMPT_ASSISTANT=off Sets the agent to off
DMLX_ROUTER_BASE_URL, DMLX_ROUTER_MODEL, DMLX_ROUTER_API_KEY, DMLX_ROUTER_TIMEOUT Routes messages without the agent, through any OpenAI-compatible chat server (HTTPS, or HTTP on loopback)
DMLX_ROUTER_PROVIDER=local-llm, DMLX_LOCAL_LLM_MODEL_PATH, DMLX_LOCAL_LLM_REVISION Routes messages without the agent, through a local Qwen checkpoint (“Local Qwen MLX” in the app)
DMLX_PROMPT_BASE_URL, DMLX_PROMPT_MODEL, DMLX_PROMPT_API_KEY, DMLX_PROMPT_TIMEOUT Prompt enhancement through an OpenAI-compatible server

If you set API keys in the app, the app keeps them in the macOS Keychain. When the agent plans, the engine also does a check of its answer. The images that the answer names must exist. An edit must use 1–3 images. The answer can use only workflows that an installed model can run. If the answer is still not valid after one retry, the app asks the user and does not guess.