@bitbybit-dev/cad-cloud-sdk
v1.1.1
Published
Type-safe SDK for the Bitbybit CAD Cloud API — parametric models, CAD operations, file conversion, and task management
Maintainers
Readme
@bitbybit-dev/cad-cloud-sdk
Type-safe TypeScript SDK for the Bitbybit CAD Cloud API. Generate parametric 3D models, run CAD operations, convert STEP files, and manage async tasks - all with full intellisense.
Server-side only. Never expose your API key in frontend code.
Scaffold a full project
The fastest way to get started is with our CLI - it scaffolds a complete backend + React frontend with this SDK pre-configured:
npx @bitbybit-dev/create-app my-cloud-project --type cloudChoose from 5 backend templates: Hono + SDK, Hono + REST, Node.js + SDK, Node.js + REST, or .NET + REST. Each includes ready-to-run examples with model generation, batch operations, and CAD pipelines.
Install
npm install @bitbybit-dev/cad-cloud-sdkQuick start
import { BitbybitClient } from "@bitbybit-dev/cad-cloud-sdk";
const client = new BitbybitClient({
apiKey: process.env.BITBYBIT_API_KEY!,
});
// Generate a dragon cup - polls automatically, returns all download URLs
const { downloads } = await client.models.run("dragon-cup", {
params: { height: 10, radiusBottom: 5 },
outputs: { formats: ["gltf"] },
});
// downloads: [{ format: "glb", downloadUrl, filename }, { format: "metadata", ... }]
const glb = downloads.find(d => d.format === "glb");
console.log("GLB download:", glb?.downloadUrl);What's included
| Endpoint | What it does |
|----------|-------------|
| client.models | Generate parametric 3D models (single + batch) |
| client.cad | Execute operations, pipelines, and compound tasks |
| client.convert | STEP → glTF conversion (simple + advanced) |
| client.tasks | Poll, list, cancel, retry, and download results |
| client.files | Upload and manage files for conversion |
All high-level methods (models.run, cad.executeAndPoll, convert.stepToGltfAndPoll) handle polling automatically and return all download URLs (including metadata) in a single downloads array.
Error handling
import { BitbybitApiError } from "@bitbybit-dev/cad-cloud-sdk";
try {
await client.models.run("dragon-cup", { outputs: { formats: ["gltf"] } });
} catch (err) {
if (err instanceof BitbybitApiError) {
console.error(err.code, err.message, err.statusCode);
}
}Documentation
Full guides with examples for every endpoint:
- SDK Overview - setup, polling, error handling, type imports
- Models - parametric model generation and batch runs
- CAD Operations - execute, pipeline, compound
- Conversion - STEP → glTF with simple and advanced options
- Tasks - task lifecycle management
- Files - file upload and management
- API Reference - full OpenAPI endpoint reference
Working examples
- Node.js + SDK - Express server with Three.js frontend
- Hono + SDK - Cloudflare Workers with Three.js frontend
Requirements
- Node.js 18+ (or any runtime with native
fetch) - A Bitbybit API key - get one at bitbybit.dev/auth/pick-plan
This package is part of the Bitbybit monorepo.
License
MIT
