Contents

Morph Model Router

morph_model_router · Nodes · AI

Routes prompts through Morph classify or multimodel selection.

Morph Model Router#

Classifies prompt difficulty or intent with Morph, then returns routing data for workflow branching or model selection. Use it before expensive AI calls when the workflow needs a low-cost decision about where a prompt should go.

Configuration#

Connection - Morph connection id. Use list_connections; pass the returned ULID id, not the connection name.

Mode - classify or multimodel.

Classes - Intent classes for classify mode. Each item has:

{
  "label": "coding",
  "description": "Requests involving code edits or repository analysis",
  "threshold": 0.8
}

Policy - Multimodel routing policy: balanced or cost_efficient.

Default model - Fallback model for multimodel mode:

{
  "provider_name": "openai",
  "model_id": "gpt-4.1-mini"
}

Allowed providers / allowed models - Limits the model choices Morph can return in multimodel mode.

Inputs & Outputs#

Input: canonical input.

Accepted shapes:

"Prompt text"
{ "prompt": "Prompt text" }

Output: canonical output.

Classify Output#

{
  "mode": "classify",
  "classifications": [
    { "label": "coding", "score": 0.91 }
  ]
}
  • label: one of the configured class labels.
  • score: Morph confidence for that class.

Use classify when the workflow branches by intent, task type, or difficulty bucket.

Multimodel Output#

{
  "mode": "multimodel",
  "provider_name": "openai",
  "model_id": "gpt-4.1-mini",
  "difficulty": "easy",
  "confidence": 0.9
}
  • provider_name: model provider to use.
  • model_id: model identifier to call.
  • difficulty: Morph's prompt difficulty classification.
  • confidence: confidence in the selected route.

Use multimodel when the next AI node should choose between cheaper and stronger model tiers.

Example#

[Prompt]
    ↓
[Morph Model Router: multimodel]
    ↓ output.provider_name / output.model_id
[AI Agent]

Inputs

  • inputRequired

Outputs

  • output

Configuration

FieldTypeRequiredDescription
connectionconnection(morph)YesMorph connection used by the router
modeenum(classify, multimodel)NoRouter mode
classesarray<record>NoClasses used by classify mode
policyenum(balanced, cost_efficient)NoMultimodel routing policy
default_modelnullable<record>NoDefault model used by multimodel mode
allowed_providersarray<string>NoProvider names allowed for multimodel routing
allowed_modelsarray<record>NoProvider/model identities allowed for multimodel routing
base_configrecordNoShared node configuration. failure_mode decides what a failure of this node does to the workflow; leave it at the default stop unless the workflow handles the failure itself on the node's error output (route_to_error) or the node is a rare emergency kill switch (stop_workflow).