Model Adapters and Routing

Model Adapters and Routing

Key jargon

Term Plain-language meaning
Model adapter Code translating a common application request into one provider's API format.
Router Logic that selects a model or provider for a request.
Fallback A planned alternative used when the preferred route is unavailable or unsuitable.
Capability matrix A dated record of supported modalities, tools, limits, privacy, latency, and cost.

Key concepts

Concept map

flowchart LR
    A["Classify request needs"] --> B["Apply policy and capability matrix"]
    B --> C["Call selected adapter"]
    C --> D["Measure and revise routing"]

A model adapter normalizes messages, multimodal inputs, structured outputs, tool calls, streaming, errors, usage, and model identity. It should not hide meaningful capability differences.

Routing inputs

Dangerous fallback

A cheaper or available fallback may lack the privacy, context, tool, or reasoning properties assumed by the workflow. Fallback is a policy decision, not merely an exception handler.

Exercise

Define one normalized request/response schema and a route table for extraction, drafting, research, and high-risk approval. Include a “no eligible model” outcome.

Checklist