Delegate a task to the best local model
delegateRoutes a task to a suitable local model by choosing loaded or installed options that fit free VRAM, then runs inference, with optional catalog download or hosted fallback.
Instructions
ONE CALL to offload work locally: pick the best model for a task on THIS machine, make it ready, and run it. Prefers models already loaded (no load cost), then installed models that fit your free VRAM, then (with allowPull) the best catalog model that fits. Task specialists (coder, vision, reasoning) win over general models; larger fitting models win over smaller. Never uses a hosted provider unless allowHosted is true. Returns the completion plus a 'routing' block explaining the choice.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| seed | No | Seed for reproducible sampling | |
| stop | No | Stop sequences | |
| task | Yes | What kind of work this is | |
| topK | No | ||
| topP | No | ||
| prompt | No | Plain prompt text (alternative to messages) | |
| stream | No | Stream tokens (default true). Progress notifications are sent when the client provides a progressToken. | |
| system | No | System instruction | |
| options | No | Provider-specific extras passed through as-is | |
| messages | No | Chat messages; content may be a string or text/image parts (vision models) | |
| provider | No | Restrict to one provider. Omit to let the server choose (local providers only, unless LOCAL_AI_ALLOW_HOSTED_FALLBACK is set). | |
| allowPull | No | Download a catalog model if nothing suitable is installed (default false) | |
| maxTokens | No | Maximum tokens to generate | |
| allowHosted | No | Allow hosted providers (default false) | |
| temperature | No | Sampling temperature | |
| maxSizeBytes | No | Ignore models larger than this | |
| contextLength | No | Context window to run with (Ollama num_ctx). Raise it for long inputs to avoid truncation. | |
| repeatPenalty | No | ||
| responseFormat | No | Constrain output to JSON (json_object) or a JSON Schema (json_schema); the result includes a validated 'parsed' value |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | ||
| model | Yes | ||
| routing | Yes | ||
| provider | Yes |