The problem
If you've ever built anything for classrooms, edtech, or study tools, you know making labeled science and math figures is a pain — a labeled animal cell, a convex-lens ray diagram, a titration curve, a labeled function graph. Stock images are unlabeled or wrong; drawing them by hand doesn't scale.
Figviz is an API that turns a plain text prompt into an accurate, labeled diagram for biology, chemistry, physics, and K-12 math. Here's how to call it from Node, the CLI, or plain HTTP.
1. Get a free key
Create a key at https://figviz.com/settings/api — it's free (3 credits to start), pay-as-you-go, no subscription. Keys look like fvk_....
2. Fastest path: the CLI
# one-off, no install
FIGVIZ_API_KEY=fvk_xxx npx @figviz/figviz-sdk "labeled animal cell cross-section for 7th grade"
# pick resolution + aspect ratio, save to a file
npx @figviz/figviz-sdk "convex lens ray diagram" --quality 2k --aspect 16:9 --out lens.png
3. In Node with the SDK
npm install @figviz/figviz-sdk
import { createFigviz } from '@figviz/figviz-sdk';
const figviz = createFigviz({ apiKey: process.env.FIGVIZ_API_KEY! });
const { images, credits_remaining } = await figviz.generate({
prompt: 'labeled titration curve, strong acid vs strong base',
quality: '2k', // '1k' | '2k' | '4k' (4k costs 1.5 credits)
aspectRatio: '4:3', // optional
});
console.log(images[0]); // URL to the generated PNG
console.log(credits_remaining); // credits left on your key
4. Or just hit the HTTP endpoint
curl -X POST https://figviz.com/api/v1/generate \
-H "Authorization: Bearer $FIGVIZ_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "prompt": "labeled parts of a plant cell", "quality": "2k" }'
You can pass up to 4 prompts in one request via "prompts": ["...", "..."].
5. Using an MCP client (Claude Desktop, Cursor, Cline…)
There's also a Figviz MCP server (@figviz/figviz-mcp), so your AI assistant can generate diagrams as a tool. Add it to your MCP client (npx @figviz/figviz-mcp) with FIGVIZ_API_KEY set — then ask it for "a labeled DNA replication fork" and it returns the image inline.
Where this is handy
- Worksheet / quiz builders that need a labeled figure per question
- Edtech apps generating study material on the fly
- Docs/slides pipelines that want print-ready PNGs from text
Free to start at figviz.com. If you build something with it, I'd love to see it.
Top comments (0)