meigen@2.0.0 or later (npx -y meigen@2.0.0), or the updated remote endpoint https://www.meigen.ai/api/mcp. npm 1.4.0 does not implement this contract. Release order is backend deployment, npm publication, then public installation guides; until 2.0.0 is published, validate a locally built package. Reconnect and inspect the installed schemas for requestId, wait and request lookup. Backend rollbacks must preserve recovery endpoints and the durable POST contract; users do not need to withdraw already installed npm packages.
Ordinary task contract
The recoverable cloud-task contract above is for MeiGen. Optional local OpenAI-compatible/ComfyUI providers may expose different asynchronous support; inspect their tool schema and returned errors rather than assuming a MeiGen receipt exists for those jobs. Preserve explicitly supplied model/provider and generation settings.
list_models is available whenever a workflow needs current capabilities or prices; video requires a model.
Read structuredContent, not a human-readable sentence or a local filename, to advance a workflow. Ordinary results share these fields when available:
success,status:processing,completed,failed,errororunknown.requestId,generationId, actualmediaType, optional originalrequestedMediaType,modelId,deduped.urls(always an array), plusimageUrlorvideoUrlwhen returned.creditsUsed,creditsStatus; a refund is confirmed only by the returned ledger state.pollAfterSeconds,observationEnded;nextActioncan carrytype,tool,arguments,afterSeconds,message.error:code,message,retryable, and optionalhttpStatus,retryAfterSeconds,required,available.- Local npm may also return
provider,savedPath,downloadWarning(generation succeeded but local saving failed) andreceiptWarning(private durable storage unavailable; keep request IDs and exact inputs in the caller).
unknown is an observation/recovery state, not permission to generate a replacement. Ordinary tasks use check_generation; the five dedicated Skills use their own check_skill, original Skill/request ID and exact retryParameters. Skill receipts require the original API key; ordinary request lookup supports another active API key of the same owning account. Do not transfer Web-session free-credit jobs into API-token billing.
Minimal call
With an authenticated connected MCPclient, this complete step has no external plan variables. Persist input before calling; the UUID below is for this one example only. Use a new UUID for a different intended image, and reuse the saved one when resuming.
Example: N scripts → N frames → N videos
The upstream workflow first resolves the scripts, image/video settings, requested output count, maximum approved budget and any replacement policy. It can uselist_models for current choices. No fixed model, price, duration or quality is assumed here.
- Create and durably save one frame UUID and one video UUID per script, alongside the exact inputs. Do this once when creating the workflow, not on every run or retry.
- Before a new submission, reserve its expected charge against the remaining approved budget, including all other in-flight reservations. Use the selected live model/tier/duration/reference pricing; reconcile actual
creditsUsedand confirmed refunds as results arrive. An unknown charge stays reserved until resolved. - Submit independent frame steps with bounded concurrency. Persist each response immediately. After a frame completes, preserve its selected URL in that script’s video input before submitting the video step. This maintains a stable dependency even if the frame model returns multiple candidates.
- Poll/recover accepted steps by their existing handles. A host restart reloads the saved plan and checks pending steps; it does not recreate UUIDs or re-upload unchanged references.
- Return completed clips and any failed/unresolved steps to the caller. The caller decides intermediate previews, visual inspection, downloads, final presentation and whether an authorized replacement is appropriate.
script, settings and persisted IDs come from that caller’s durable plan; client is its connected MCP client. These are call examples, not a scheduler or a new API SDK.
Retry-After; there is no universal ten-image workflow cap or blanket ban on parallel video jobs.
The budget is a caller-managed limit, not an atomic server-enforced batch cap. Estimates can change; stop for a newly required price/resize decision outside existing authorization. Independent steps can partially succeed, and a failure does not roll back completed frames or clips.
Local wait: true retries transient status-query errors within bounds: stop after three consecutive errors and reset the count on a valid status. Honor a larger Retry-After; queries and backoff share the total observation budget. Cancellation and terminal errors stop immediately. This retries queries only, never generation POSTs, and does not prove cancellation, failure or refund.
Resume without creating duplicate jobs
For ordinary tasks, remote
attemptId remains a legacy compatibility handle. Prefer UUID requestId in new integrations. Older receipts may lack the normalized input data needed to verify all past parameter mismatches; do not assume the new protection can retroactively validate every old task.
Legacy key rotation: when an old attemptId submission lost its response, recover it using the original key before revoking that key. The old handle incorporates the key; a new key cannot reconstruct an unrecorded old identity. Keep a returned generationId when available, and do not automatically resubmit an unresolved legacy attempt with a new key.