The SDK draws a clear line between a provider — the company or service hosting models — and a model — a specific identifier within that provider. Providers expose factory methods that return typed model objects; those model objects implement theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/phpaisdk/core/llms.txt
Use this file to discover all available pages before exploring further.
Model interface and carry a full capability declaration used by the SDK to validate requests before they hit the network.
The ProviderInterface
Every concrete provider implements ProviderInterface, which defines three responsibilities:
name()returns a stable string identifier for the provider (e.g.'openai','anthropic').textModel($modelId)constructs and returns an object capable of text generation.imageModel($modelId)constructs and returns an object capable of image generation.
NoSuchModelException.
BaseProvider: the default-throw pattern
Rather than forcing every provider to implement every modality, the SDK ships BaseProvider, an abstract class whose default textModel() and imageModel() implementations both throw NoSuchModelException. A concrete provider only overrides the modalities it actually supports:
BaseProvider also holds a ModelRegistry that lets you register custom models at runtime (see Custom Model Registration).
The Model interface
Every model object — text or image — implements Model:
| Method | Returns | Purpose |
|---|---|---|
specificationVersion() | string | SDK contract version the model was built against ('v1'). |
provider() | string | Provider name string. |
modelId() | string | Model identifier (e.g. 'gpt-4o'). |
supports(Capability) | bool | Quick boolean capability check. |
capability(Capability) | CapabilitySupport | Rich check with state, source, and strategy. |
assume(array) | static | Return a clone that treats extra capabilities as supported. |
allowUnknownCapabilities() | static | Return a clone that passes all capability checks. |
capabilities() | Capability[] | Full list of declared capabilities. |
BaseModel: capability resolution
BaseModel provides the full capability resolution pipeline so concrete models only need to declare provider(), modelId(), and capabilities():
supports() or capability() is called, BaseModel checks (in order):
- Whether
allowUnknownCapabilitiesis set — if so, every capability is considered supported. - Whether the capability is in the
assumedCapabilitieslist set viaassume(). - Whether the capability appears in the model’s own
capabilities()array.
ModelDefinition: describing a model statically
ModelDefinition is an immutable value object that describes a model without instantiating it. It is used by ModelRegistry and provider catalog files:
adaptedCapabilities holds capabilities that the provider adapter simulates rather than the model supporting natively. The capabilityNames() helper merges both into a flat string array, which is used during capability lookups.
Opting in to capabilities at the call site
When a provider releases a new model before a package update ships, you can tell the SDK to treat additional capabilities as supported usingassume():
assume() returns a clone — the original model object is unchanged. The assumed capabilities appear in capability() calls with the source string 'user-assumed'.
Bypassing all capability checks
For development or when you are certain the provider supports a feature the package does not yet list,allowUnknownCapabilities() makes every supports() call return true: