POST /api/v1/diagrams. Making one takes about a minute, sometimes two.
Write the prompt the way you would brief an illustrator: what the figure must show, who it is for, the labels and numbers it needs, and the size it will be seen at (“for a phone screen”, “a full textbook page”). The API never stops to ask questions: when something is ambiguous it makes a reasonable choice and says so in
description.
Wait for it
Sendwait to hold the request open, up to 300 seconds. If the diagram is not done by then you get 202 with the job; call GET /api/v1/diagrams/:id?wait=60 until status is succeeded or failed. Set your HTTP client’s timeout above wait (wait plus 30 seconds). A job that runs longer than 15 minutes fails; a set of pages has more time, about 6 minutes for every 4 pages after the first 4. A failed request leaves the diagram as it was (a new one has no version); send it again with a new Idempotency-Key.
A finished job: