legnext

Installation
SKILL.md

Legnext API Integration

Legnext (https://api.legnext.ai) gives you Midjourney image and video generation through an asynchronous REST API: you submit a task, it runs out of band, and you collect the result by polling or callback. This skill is the integration methodology — exact fields and responses live in the generated reference at https://docs.legnext.ai. Read the files in references/ only when their topic is needed.

The integration loop

Every generation is three steps:

  1. SubmitPOST /api/v1/diffusion with { "text": "<prompt>", "callback": "<optional webhook>" } and the x-api-key header. Returns a job object with status: "pending" and a job_id. Credits are frozen (reserved) at submit time — see references/task-lifecycle.md.
  2. Wait — either poll GET /api/v1/job/{job_id} until status is completed or failed, or receive a POST to your callback URL when the job finishes. Persist job_id before waiting.
  3. Fetch & store — on completed, read output.image_url (primary) and output.image_urls (grid). Download to permanent storage immediately — result URLs expire (see references/task-lifecycle.md).

Use x-api-key: $LEGNEXT_API_KEY on submit and account requests. GET /api/v1/job/{job_id} is the exception: it is unauthenticated and its UUID is a capability token. Keep it server-side and out of browser URLs, analytics, and public logs. Base URL: https://api.legnext.ai.

Decisions to make before writing code

Webhook vs polling

  • Webhook (pass callback on submit): lower latency, no polling cost. Respond 2xx fast; fetch the canonical result with GET /api/v1/job/{job_id} rather than trusting only the callback body. Dedupe by job_id and keep polling as recovery. Task callbacks do not currently provide a public signing secret, so use an unguessable endpoint path and validate the method, content type, and body shape.
  • Polling (GET /api/v1/job/{job_id}): use when there is no public endpoint — local dev, CLIs, or batch jobs behind NAT. Use a non-zero interval and a bounded client wait. A client timeout does not cancel the task; persist the state and let a worker resume the same job_id.
Installs
12
First Seen
Jul 28, 2026
legnext — legnext-ai/skills