PotionUI Docs v0.3.0

Contributing a cloud provider

A provider plugin gives PotionUI one hosted-model service (images, video or audio generated on the provider's servers). It imports only from src.plugin_api.cloud and, in its tests, src.plugin_api.cloud_testing. Its backend.register handler registers the provider, and the driver cloud.<key> becomes a creatable backend type:

python
from src.plugin_api import HookContext
from src.plugin_api.cloud import register_cloud_provider

def register_backend(context: HookContext) -> HookContext:
    from ..provider.acme import AcmeProvider
    register_cloud_provider(context, AcmeProvider)
    return context

The provider subclasses CloudProvider (discover, submit, poll, optionally fetch, cancel, check, map_error) with a CloudBackendConfig subclass for its settings, and does all network I/O through self.http (CloudHttp), which sends credentials only to the API's own origin, refuses private download targets, redacts secrets and maps HTTP errors to the nine CloudError kinds. The plugin ships its own presets through the manifest presets: root, assembled from the shared blocks listed in CLOUD_BLOCKS. cloud_testing provides a scripted FakeCloudProvider and a contract kit (ContractCase, run_contract) to run against recorded fixtures. The full contract, the test kit and a step-by-step example are in Cloud Models.