TypeScript SDK
The official TypeScript/JavaScript SDK for Runcrate. Zero runtime dependencies, nativefetch, full type safety.
Installation
Quick Start
RUNCRATE_API_KEY environment variable instead of passing apiKey.
Configuration
Environments
API keys are workspace-scoped. By default, requests target the workspace’s default environment (usuallymain). Pass environment at client construction to target a different one:
Model Inference
All inference methods hitapi.runcrate.ai.
Chat Completions
Streaming
Image Generation
Model-Specific Parameters
All inference methods accept extra parameters that get passed through to the provider. Different models support different parameters:Video Generation
seed, negative_prompt, image for image-to-video) are passed through:
Text-to-Speech
speed or language are passed through:
Transcription
Infrastructure Management
GPU Instances
SSH Keys
Storage
Storage volumes are environment-scoped. Your workspace’s storage provider (AWS S3, Wasabi, or Backblaze B2) must be configured in the dashboard first — the SDK picks it up automatically.$0.03/GB/month, charged weekly in advance. Deletion refunds the unused portion of the current billing week.
Billing
Templates
Error Handling
All API errors include the actual error message from the server — never a generic fallback.err.message— human-readable error description from the APIerr.statusCode— HTTP status codeerr.code— machine-readable error code (e.g.not_found,rate_limited)err.details— additional details (when available)
Error Hierarchy
| Exception | Status Code | Description |
|---|---|---|
BadRequestError | 400 | Invalid parameters |
AuthenticationError | 401 | Invalid or missing API key |
InsufficientCreditsError | 402 | Not enough credits |
PermissionDeniedError | 403 | Insufficient permissions |
NotFoundError | 404 | Resource not found |
ConflictError | 409 | Resource conflict |
UnprocessableEntityError | 422 | Validation error (e.g. invalid model params) |
RateLimitError | 429 | Rate limit exceeded |
InternalServerError | 500 | Server error |
ConnectionError | — | Network failure |
TimeoutError | — | Request timed out |