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.pngTips & tricks
For SVG, build a data URL like:data:image/svg+xml;base64,<data>. For PNG, use:data:image/png;base64,<data>.
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
| Feature | Detail |
|---|---|
| Credit cost | 3 credits per request |
| Output formats | SVG, PNG (JSON wrapper by default; raw file mode optional) |
| Themes | light, dark |
| Presets | default, publication, presentation, thumbnail, social-card |
| Overlays | Atom highlighting + per-atom weights heatmap |
Tier Limits
| Limit | Free | Premium |
|---|---|---|
| Max SMILES length | 200 chars | 4 000 chars |
| Max dimensions | 800×800 | 2048×2048 |
| Dark theme | No | Yes |
| Transparent background (SVG) | No | Yes |
| Custom element colors | No | Yes |
Other Endpoints
Render Code
Render syntax-highlighted code snippets as SVG or PNG images.
Render Code Diff
Render before/after code diffs with line-level highlighting.
Render Diagram
Render Mermaid diagrams to SVG, PNG, ASCII, or Unicode.
Render Timeline
Render event timelines and roadmap infographics as SVG or PNG.
Render Chem Reaction
Render chemical reaction schemes (reactants → products) as SVG or PNG.