Architecture
AI Providers is a provider-asset abstraction plus a shared request service. The design stays intentionally independent of Dialogue Graph System and AI Extension so other tools can reuse the same provider and transport layer.
High-level architecture
Caller
-> AiProvidersService
-> LlmProviderDefinitionBase
-> LlmHttpRequest
-> UnityWebRequest
-> Provider API
-> provider-specific response extraction
Division of ownership
- Provider asset builds the concrete HTTP request and parses the provider-specific response.
- Service layer owns transport execution, timeout/retry behavior, and normalized HTTP error handling.
- DTO layer carries chat messages, model overrides, and the built request definition.
Base class contract
public abstract class LlmProviderDefinitionBase : ScriptableObject
{
public abstract LlmHttpRequest BuildHttpRequest(LlmChatRequest chat);
public abstract string ExtractTextFromResponse(string responseJson);
}
Why provider assets matter
New providers are added as assets and subclasses rather than as giant switch statements in the service. That keeps endpoint rules, model defaults, and response parsing close to the specific provider implementation.