ImageGenerationResultfor completed workImageRateResultfor completed rating tasksImageAltResultfor completed alt text tasksTaskAsyncfor in-progress work
ImageGenerationResult
ImageGenerationResult is returned from sync generation (generate()) and from TaskAsync.wait() on generation tasks.
Useful properties and helpers:
result.idresult.statusresult.resultresult.urlsresult.getImages()result.getImages({ includeFailed: true })result.getMetadata()
TaskAsync
ImageRateResult and ImageAltResult expose task, taskId, raw results, and filtered helper methods:
TaskAsync
TaskAsync is returned from:
task.idtask.access.publicAccessTokentask.wait()— polls until completion and resolves to the matching result wrapper
Browser-safe access token
publicAccessToken is a task-scoped JWT (prefixed with pat_) designed for client-side polling of:
GET /tasks/:id/statusGET /tasks/:id/result
undefined for task.access.publicAccessToken, so poll those from trusted server code with your API key.
Do not use a Public Access Token as a replacement for your server-side API key.
Polling behavior
wait():
- starts polling lazily — only when first called
- reuses the same promise if called multiple times
- polls every 2.5s for the first 12s, then slows to every 5s
- times out after five minutes
- retries transient fetch failures up to 7 times, resetting the count after any successful poll
Error classes
The SDK exposes dedicated error classes:MynthAPIErrorTaskAsyncTimeoutErrorTaskAsyncUnauthorizedErrorTaskAsyncFetchErrorTaskAsyncTaskFetchErrorTaskAsyncTaskFailedError