Overview¶
The media domain is now intentionally small.
Module authors should not have to reason about provider internals, temporary paths, raw storage paths, or a zoo of helper methods that expose storage mechanics instead of solving the actual problem.
The public SDK surface for module_sdk.media is:
add(...)add_model(...)add_model_from_source(...)view(...)get_path(...)move(...)delete(...)get_public_url(...)
That is the contract a module author should learn.
The democrai.sdk.media module also exports media_type_from_content_type(...)
as a small helper for code that needs to convert a MIME type such as
image/png into the media family image.
What This Domain Is For¶
Use module_sdk.media when your module needs to do one of these things:
- persist bytes into media storage
- persist a shared model artifact into the canonical model namespace
- download and persist a remote model artifact through the managed model path
- read bytes back from media storage
- obtain a local filesystem path for path-only libraries
- move a stored asset to a different path
- delete a stored asset
- obtain the HTTP URL that a UI component should consume
That is all.
If a module has to do something more specialized than this, the right next step is usually to improve the domain model or the SDK, not to push low-level storage concerns back onto every module author.
The Mental Model To Keep¶
The correct mental model is:
- your module works with persisted media paths
- the active media provider hides whether storage is local or distributed
- the UI consumes HTTP URLs generated by the runtime, not provider URLs and not local filesystem paths
This is why get_public_url(...) matters so much.
It keeps UI code aligned with the runtime rule that every media resource shown to users should pass through the application HTTP layer, where access control and policy checks can happen in one place.
What Changed¶
Older versions of this domain exposed many more methods.
Those methods were not making module code clearer. They were leaking storage and runtime complexity into the public SDK surface. The old implementation still exists in democrai/sdk/media_deprecated.py as migration reference, but it is no longer part of the public module_sdk.media contract.
This documentation covers only the supported public API.
How To Read The Subpages¶
- Uploads and Stored Files covers
add(...),add_model(...),add_model_from_source(...),view(...),get_path(...),move(...), anddelete(...) - Public URLs and UI Consumption covers
get_public_url(...)
If you keep those two areas separate, the domain becomes straightforward:
- storage operations deal with persisted bytes and storage paths
- UI operations deal with the final runtime URL the client should render