CLAUDE.md — Legnext API Docs
Guidance for working in this repository.What this is
The public API documentation for Legnext (the Midjourney API platform).- Tooling: Mintlify — config in
docs.json(thememint), content in.mdx. - Published to:
https://docs.legnext.ai - Repo:
github.com/legnext-ai/docs(origin/main). Mintlify auto-deploys on push tomain. - ⚠️ This is the only live docs repo.
github.com/leggiemint/docs(local~/projects/API/docs) is a stale abandoned clone — do not edit it.
Structure
getting-started/— overview, quickstart, models, image-parameters, video-parameters, output-storage, noticeapi-reference/— one.mdxper endpoint (image-generation, video-generation, enhancement, task-management, account-management)sdk/— per-language guides (csharp, go, java, javascript, php, python, ruby, rust)integrations/— make, n8n, postmanchangelog.mdx,docs.json(navigation — nav is explicit; a file not listed here is not linked)
Preview & deploy
main (Mintlify picks it up). Per global rules: don’t auto-push; prefer a new commit over amend.
Sources of truth (do not guess — verify)
- Parameter / version / model behavior → the backend:
~/projects/API/Legnext-backend/internal/task/mj_task/(e.g.version.gofor which flags each MJ version accepts) and the provider code underinternal/standalone_server/mj/provider/. - Midjourney’s own semantics → local scrape of MJ official docs in
docs/midjourney-prompt/(prompt-related articles, markdown +urls.txtmanifest for re-scraping; reference only, never publish as-is). The old mirror at~/projects/saas/midjourney/midjourney-official-docs/no longer exists.
Known gotchas / lessons
-
API Reference fields are generated from
openapi.yaml. Endpoint MDX files should contain only frontmatter plus intent, prerequisites, relationships, and common mistakes. Do not re-add hand-written headers, request/response tables, full JSON examples, or error-code lists: Mintlify already renders them from OpenAPI, and the duplicate layer previously drifted on Get Task auth, required fields, enums, and task IDs. -
The Topaz-backed Enhancement API is suspended. Keep
/v1/enhance-upscalein OpenAPI with its503maintenance response for existing callers, but do not add it back to public navigation or describe it as available. Midjourney/v1/upscaleand/v1/enhanceare different follow-up actions. -
The image-parameters table is GENERATED. In
getting-started/image-parameters.mdx, everything between the{/* BEGIN GENERATED:image-parameters-table */}and{/* END ... */}markers comes fromspec/mj-image-params.yamlinlegnext-ai/Legnext-backend— a backend CI job opens a sync PR here when the spec changes (KEH-286). Never hand-edit inside the markers (keep them intact); fix the YAML upstream instead.schemas/mj-image-params.v1.jsonis synced the same way and served at https://docs.legnext.ai/schemas/mj-image-params.v1.json — the public contract, additive-only within v1. Do not re-add hand-written parameter lists anywhere (incl.openapi.yaml); link to the schema URL. -
--crefis NOT a v7+ parameter. It only works on v6 / v6.1 / niji 6. v7 replaced it with Omni Reference (--oref/--ow); v8.1 drops omni too. Our docs historically mislabeled this (v7 marked ✓ for--cref), which caused a real support ticket — keep the version-support matrix accurate against the backend + MJ official docs. -
The default model version is v7 (no
--v→ runs as v7). A param valid only on v6.x will fail upstream with an opaqueInvalid prompt formatunless the user pins--v 6.1. -
Keep
--orefnaming consistent (MJ calls it Omni Reference); avoid the old “Object Reference” / inconsistent “Universal Reference” labels. -
mint devcan wedge on on-demand compiles (2026-08-10 incident). First hit on a new/changed page triggers a compile; repeated or parallel requests against it queue up and snowball until the node process pins at ~100% CPU and the whole server stops responding (all pages, not just the new one). Discipline:- One request at a time against the dev server, with a generous
--max-time— never re-fire or parallelize curls when one is hanging; each extra request makes the wedge worse. - A hang → check before retrying:
lsof -nP -iTCP:3000 -sTCP:LISTEN+psfor CPU. ~100% CPU = wedged →Ctrl+Cand restartnpx mint dev; do not keep poking a wedged server. - To rule out content errors without the dev server, run
npx mint validate(static full-build validation). Only suspect MDX syntax if validate fails. - After restart, re-verify with a single curl per page (
curl -s -o /dev/null -w "%{http_code}").
- One request at a time against the dev server, with a generous