Features
- Fast Spec: Generate comprehensive specifications quickly - perfect for MVPs and prototypes
- Deep Spec: Generate ultra-detailed specifications for complex systems with enterprise-grade depth
- Async Spec: Non-blocking async methods for long-running requests
- Status Tracking: Check the status of async specification generation requests
- Credits Management: Check your remaining credits balance
- Full TypeScript Support: Complete type definitions for better IDE support
- Error Handling: Custom exceptions for different error scenarios
- Modern ES Modules: Uses ES6+ import/export syntax
Installation
Install the pre.dev Node SDK using npm:Quick Start
Authentication
The Pre.dev API uses API key authentication. Get your API key from the pre.dev dashboard:API Methods
Synchronous Methods
fastSpec()
Generate a fast specification (~1 minute, ~5-10 credits).options.input(required):string- Description of what you want to buildoptions.currentContext(optional):string- Existing project contextoptions.docURLs(optional):string[]- Documentation URLs to reference
Promise<SpecResponse> object with complete specification data
deepSpec()
Generate a deep specification (~3-5 minutes, ~10-50 credits).fastSpec()
Returns: Promise<SpecResponse> object with comprehensive specification data
Asynchronous Methods
fastSpecAsync()
Generate a fast specification asynchronously (returns immediately).fastSpec()
Returns: Promise<AsyncResponse> object with specId for polling
deepSpecAsync()
Generate a deep specification asynchronously (returns immediately).fastSpec()
Returns: Promise<AsyncResponse> object with specId for polling
Status Checking
getSpecStatus()
Check the status of an async specification generation request.specId(required):string- The specification ID from async methods
Promise<SpecResponse> object with current status and data (when completed)
Credits Management
getCreditsBalance()
Get the remaining credits balance for your API key.Promise<CreditsBalanceResponse> object with credits remaining
Example:
Listing and Searching Specs
listSpecs()
List all specs with optional filtering and pagination.params.limit(optional):number- Results per page (1-100, default: 20)params.skip(optional):number- Offset for pagination (default: 0)params.endpoint(optional):"fast_spec" | "deep_spec"- Filter by endpoint typeparams.status(optional):"pending" | "processing" | "completed" | "failed"- Filter by status
Promise<ListSpecsResponse> object with specs array and pagination metadata
findSpecs()
Search for specs using regex patterns.params.query(required):string- Regex pattern (case-insensitive)params.limit(optional):number- Results per page (1-100, default: 20)params.skip(optional):number- Offset for pagination (default: 0)params.endpoint(optional):"fast_spec" | "deep_spec"- Filter by endpoint typeparams.status(optional):"pending" | "processing" | "completed" | "failed"- Filter by status
Promise<ListSpecsResponse> object with matching specs and pagination metadata
Regex Pattern Examples:
| Pattern | Matches |
||---------|---------|
| payment | “payment”, “Payment”, “make payment” |
| ^Build | Specs starting with “Build” |
| platform$ | Specs ending with “platform” |
| (API\|REST) | Either “API” or “REST” |
| auth.*system | “auth” then anything then “system” |
| \\d{3,} | 3+ digits (budgets, quantities) |
| saas\|sass | SaaS or SASS |
File Upload Support
AllfastSpec, deepSpec, fastSpecAsync, and deepSpecAsync methods support optional file uploads. This allows you to provide architecture documents, requirements files, design mockups, RFPs (Request for Proposals), or other context files to improve specification generation.
Browser/Web Environment
Node.js Environment
Supported File Types
- PDF documents (
*.pdf) - Word documents (
*.doc,*.docx) - Text files (
*.txt) - Images (
*.jpg,*.png,*.jpeg)
Response with File Upload
When you upload a file, the response includes:Response Types
AsyncResponse
SpecResponse
ListSpecsResponse
CreditsBalanceResponse
Examples
Generate Fast Spec
Generate Deep Spec with Context
With Documentation URLs
Async Workflow with Polling
List and Filter Specs
Search Specs with Regex
Check Credits Balance
Error Handling
All SDK errors inherit fromPredevAPIError. Typed subclasses map to HTTP status codes:

