SketchUp and Rhino plugins
The shape of a modelling-tool plugin: export the view, render it, bring the image back.
A plugin does three things, in this order. The same pattern fits SketchUp, Rhino, Revit and Blender.
Step 1: Export the viewport
Save the view as a PNG or JPEG at the size you want back.
Step 2: Render it
Call POST /v2/renders with the image in the same call: the file as the
imagepart of a multipart form, or base64 in JSON. Add anIdempotency-Keymade when the user pressed the button, so a retry after a dropped connection never charges twice.Step 3: Bring the image back
Poll GET /v2/jobs/{id} every few seconds, then download
outputs[0].urlbefore itsexpires_atand place it in the model or a gallery.
Where the key lives
Each user pastes their own key from the console into the plugin’s settings, and the plugin keeps it in the operating system’s keychain. Never ship a key inside the plugin: anyone could read it and spend on your account. A key used from a desktop plugin needs no allowed origins.
Showing progress and cost
- Show the price before the user renders: GET /v2/engines lists each engine’s price.
charged_usdon the answer is what the render cost, in dollars; GET /v2/account is the balance left.- A
402 INSUFFICIENT_CREDITSshould open the user’s top-up page, not a generic error. - Respect
Retry-Afteron a429, and see Rate limits for the numbers.