Render Chem

POST/visual/v1/render-chem

What it does

Takes a SMILES string and renders a clean 2D structural formula diagram (bonds, rings, atom labels). The response includes the image in the default JSON wrapper as base64 data, so you can embed it directly as a data URL. Set responseFormat: "file" when you want raw SVG or PNG output instead.

Why use it?

  • Reports & docs. Automatically attach structural diagrams to LLM outputs, lab notes, or documentation.
  • Deterministic output. Same SMILES + same options → same image. Works great with caching in CI/CD.
  • Explainability overlays. Highlight mapped atoms and draw per-atom weight heatmaps (e.g. attention / contribution scores).

Examples

Minimal example (SVG)

curl -X POST https://api.creatornode.io/visual/v1/render-chem \ -H "Content-Type: application/json" \ -H "X-API-Key: YOUR_KEY" \ -d '{ "smiles": "CC(=O)Oc1ccccc1C(=O)O", "format": "svg", "theme": "light" }'

Response contains data as base64-encoded SVG (UTF-8).

Highlights + weights overlay

{ "smiles": "[CH3:1][CH2:2][OH:3]", "format": "svg", "theme": "light", "preset": "publication", "options": { "width": 600, "height": 400, "highlightAtoms": [{ "atomClass": 2, "color": "#ff0000" }], "weights": { "values": [0.0, 0.5, 1.0], "normalized": true } } }

Important: weights.values must have the same length as the number of heavy atoms (non-hydrogen atoms) in the molecule.

Raw PNG response

curl -X POST https://api.creatornode.io/visual/v1/render-chem -H "Content-Type: application/json" -H "X-API-Key: YOUR_KEY" -d '{ "smiles": "CC(=O)Oc1ccccc1C(=O)O", "format": "png", "responseFormat": "file", "theme": "light" }' --output aspirin.png

Tips & tricks

For SVG, build a data URL like:data:image/svg+xml;base64,<data>. For PNG, use:data:image/png;base64,<data>.

💡 Tip: For the full request/response schema (including the demo endpoint), use the OpenAPI reference at /api/visual/docs/render-chem.

Default JSON mode is best when you need metadata like molecular formula, dimensions, and recommendations. File mode is best when you want a ready-to-save SVG or PNG body.

Cost & Limits

FeatureDetail
Credit cost3 credits per request
Output formatsSVG, PNG (JSON wrapper by default; raw file mode optional)
Themeslight, dark
Presetsdefault, publication, presentation, thumbnail, social-card
OverlaysAtom highlighting + per-atom weights heatmap

Tier Limits

LimitFreePremium
Max SMILES length200 chars4 000 chars
Max dimensions800×8002048×2048
Dark themeNoYes
Transparent background (SVG)NoYes
Custom element colorsNoYes

Other Endpoints