Skip to main content
A TypeScript/Node.js client library for the pre.dev Architect API. Generate comprehensive software specifications using AI-powered analysis.

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).
Parameters:
  • options.input (required): string - Description of what you want to build
  • options.currentContext (optional): string - Existing project context
  • options.docURLs (optional): string[] - Documentation URLs to reference
Returns: Promise<SpecResponse> object with complete specification data

deepSpec()

Generate a deep specification (~3-5 minutes, ~10-50 credits).
Parameters: Same as fastSpec() Returns: Promise<SpecResponse> object with comprehensive specification data

Asynchronous Methods

fastSpecAsync()

Generate a fast specification asynchronously (returns immediately).
Parameters: Same as fastSpec() Returns: Promise<AsyncResponse> object with specId for polling

deepSpecAsync()

Generate a deep specification asynchronously (returns immediately).
Parameters: Same as fastSpec() Returns: Promise<AsyncResponse> object with specId for polling

Status Checking

getSpecStatus()

Check the status of an async specification generation request.
Parameters:
  • specId (required): string - The specification ID from async methods
Returns: Promise<SpecResponse> object with current status and data (when completed)

Credits Management

getCreditsBalance()

Get the remaining credits balance for your API key.
Parameters: None Returns: Promise<CreditsBalanceResponse> object with credits remaining Example:

Listing and Searching Specs

listSpecs()

List all specs with optional filtering and pagination.
Parameters:
  • 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 type
  • params.status (optional): "pending" | "processing" | "completed" | "failed" - Filter by status
Returns: Promise<ListSpecsResponse> object with specs array and pagination metadata

findSpecs()

Search for specs using regex patterns.
Parameters:
  • 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 type
  • params.status (optional): "pending" | "processing" | "completed" | "failed" - Filter by status
Returns: 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

All fastSpec, 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 from PredevAPIError. Typed subclasses map to HTTP status codes:

Documentation

For more information about the Pre.dev Architect API, visit:

Support

For issues, questions, or contributions: