spine-sdk, creating a run, waiting for it
to finish, and downloading the generated artifacts. For a broader
conceptual tour of the API, see the API quickstart.
1. Install
Requires Node.js 18 or newer. Also works in modern browsers, Deno, Bun,
and Cloudflare Workers without any extra configuration.
2. Get an API key
Create a key in the developer portal. You get $5 of free credits immediately — enough for several test runs end-to-end. Keys look likesk_spine_... and are shown only once.
Export it into your environment so the SDK can pick it up:
3. Run your first request
What happens
runs.createsubmits the prompt and returns aCreatedRunhandle immediately.waitForCompletionpollsGET /v1/run/{run_id}every 5 seconds until the run reaches a terminal state.- On success,
terminal.result.final_outputholds the synthesized markdown andterminal.result.artifactslists downloadable files (docx, xlsx, pptx, html, png — depending on the template).
4. Upload files with a run
File, Blob, ArrayBuffer, Uint8Array, or
{ data, filename, contentType } records. Supported types are documented
on File uploads.
5. Handle errors
Every failure is a subclass ofSpineError. Branch on the specific
types when you need to:
Next steps
Runs and polling
Stream progress, tune poll intervals, use the low-level
runs.retrieve.Canvas introspection
Inspect the block graph and task tree a run produced.