A consistent interface gives consumers the same interaction model across different implementations or providers. It keeps application code focused on the operation requested while adapters handle implementation-specific details. Without it, each new workflow or model provider can require custom integration code. section 2.3.1 section 3.2.2
For model inference, applications request a model through the Model Service. The service routes the request and applies configured fallback logic; provider adapters translate messages, responses, and errors. Adding a provider means implementing another adapter rather than changing application calls. section 3.2.2 section 3.10
Listing 3.8 Provider adapter interface
from abc import ABC, abstractmethod
from typing import List, Iterator
class ModelProvider(ABC):
"""Abstract base class that all provider adapters implement"""
@abstractmethod
def chat(self, model: str, messages: List[ChatMessage],
config: ChatConfig) -> ChatResponse: #A
"""Generate a response synchronously"""
pass
@abstractmethod
def chat_stream(self, model: str, messages: List[ChatMessage],
config: ChatConfig) -> Iterator[ChatChunk]: #B
"""Generate a response with streaming tokens"""
pass
@abstractmethod
def get_capabilities(self) -> List[ModelInfo]: #C
"""Report what this provider supports"""
passThe Python ModelProvider contract requires synchronous chat, streaming chat, and capability reporting. Concrete adapters implement those operations for their providers. section 3.2.2
A uniform interface does not imply identical capabilities. The minimal provider contract includes get_capabilities() so the service can discover differences such as vision support, function calling, and context window size. section 3.2.2
Normalizing provider differences
OpenAI places system prompts in the messages array, while Anthropic accepts them as a separate parameter. Their response structures and token-count fields also differ. Adapters translate these conventions so applications can switch providers and aggregate usage without provider-specific parsing in application code. section 3.2.1 section 3.10
The same principle applies to workflow endpoints: workflows within a domain share authentication mechanisms, response formats, and API conventions. A registered custom model likewise remains accessible by name through the Model Service, retaining its consistent response format, logging, and fallback support instead of bypassing the platform. section 2.3.2 section 3.1.4












