ProtectedclientProtectedeip712ProtectedlistenersA copy of the array containing the tracked projects.
Cancel project by id. This will cancel all jobs in the project and mark project as canceled. Client may still receive job events for the canceled jobs as it takes some time, but they will be ignored
Send new project request to the network. Returns project instance which can be used to track progress and get resulting images or videos.
Request a presigned download URL for a stored image asset.
Same shape as
ProjectsApi.uploadUrl; imageId, jobId, and type
must match the values used at upload time.
Presigned GET URL for the image.
Throws if the server response does not include a downloadUrl.
ProtectedemitDispatch an event to all listeners
Estimate the cost of an audio generation job.
The parameters required for audio cost estimation. This includes:
Returns an object containing the estimated costs in different units.
Estimate image project cost
Estimate image enhancement cost
Estimates the cost of generating a video based on the provided parameters.
The parameters required for video cost estimation. This includes:
Returns an object containing the estimated costs for the video in different units:
Get available models and their worker counts. Normally, you would get list once you connect to the server, but you can also call this method to get the list of available models manually.
Get supported size presets for the model and network. Size presets are cached for 10 minutes.
'fast' or 'relaxed'
model id (e.g. 'flux1-schnell-fp8')
force refresh cache
Retrieves the video asset configuration for a given video model identifier. Validates whether the provided model ID corresponds to a video model. If it does, returns the appropriate video asset configuration based on the workflow type.
The identifier of the video model to retrieve the configuration for.
The video asset configuration object where key is asset field and value is
either required, forbidden or optional. Returns null if no rules defined for the model.
Check if a model produces audio output using the cached models list.
Uses the media property from the models API when available,
falls back to model ID prefix check if models aren't loaded yet.
Check if a model produces video output using the cached models list.
Uses the media property from the models API when available,
falls back to model ID prefix check if models aren't loaded yet.
Request a presigned download URL for a stored audio or video asset.
Same shape as
ProjectsApi.mediaUploadUrl; id, jobId, and type
must match the values used at upload time.
Presigned GET URL for the media.
Throws if the server response does not include a downloadUrl.
Request a presigned upload URL for an audio or video asset
(reference audio, reference video, finished media artifacts, etc.).
The caller uploads the media bytes via PUT to the returned URL
before starting a project or workflow that references the asset.
Media asset coordinates:
"media_ref_1"). Optional for some asset roles.'referenceAudio',
'referenceVideo', 'preview', 'complete'.PUT
(e.g. "audio/mp4" or "video/mp4").Presigned PUT URL the caller should
upload the media bytes to.
Remove an event listener
Add an event listener, returns a function that can be called to remove the listener
Add an event listener that will be called only once
Remove all event listeners, optionally for a specific event
Optionalevent: TRequest a presigned upload URL for an image asset (reference image,
starting image, ControlNet image, context image, etc.). The caller
uploads the image bytes via PUT to the returned URL before
starting a project or workflow that references the asset.
Image asset coordinates:
"media_ref_1"). The same id is later used to reference
the asset in workflow inputs."sogni-agent-1735000000-1-abcdef"). Ties the asset to a
specific request.'referenceImage',
'referenceImageEnd', 'startingImage', 'cnImage',
'contextImage1'..'contextImage16', 'preview', 'complete'.PUT (e.g.
"image/png"). Forwarded so the storage layer can pin the
Content-Type on the presigned URL.Presigned PUT URL the caller should
upload the image bytes to. Short-lived; use immediately.
Wait for available models to be received from the network. Useful for scripts that need to run after the models are loaded.
timeout in milliseconds until the promise is rejected
Retrieves a list of projects created and tracked by this SogniClient instance.
Note: When a project is finished, it will be removed from this list after 30 seconds