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
- List & Search: Discover, filter, and search through your specification history
- Credits Management: Check your remaining credits balance
- Type Hints: Full type annotations for better IDE support
- Error Handling: Custom exceptions for different error scenarios
Installation
Install the pre.dev Python SDK using pip:Quick Start
Authentication
The pre.dev API uses API key authentication. Get your API key from the pre.dev dashboard:API Methods
Synchronous Methods
Fast Spec Generation
Generate a fast specification (~1 minute, ~5-10 credits).input_text(required):str- Description of what you want to buildcurrent_context(optional):str- Existing project contextdoc_urls(optional):List[str]- Documentation URLs to reference
SpecResponse object with complete specification data
Example:
Deep Spec Generation
Generate a deep specification (~3-5 minutes, ~10-50 credits).fast_spec
Returns: SpecResponse object with comprehensive specification data
Example:
Asynchronous Methods
Fast Spec Async
Generate a fast specification asynchronously (returns immediately).fast_spec
Returns: AsyncResponse object with specId for polling
Deep Spec Async
Generate a deep specification asynchronously (returns immediately).fast_spec
Returns: AsyncResponse object with specId for polling
Status Checking
Get Spec Status
Check the status of an async specification generation request.spec_id(required):str- The specification ID from async methods
SpecResponse object with current status and data (when completed)
Example:
Credits Management
Get Credits Balance
Get the remaining credits balance for your API key.CreditsBalanceResponse object with credits remaining
Example:
Listing and Searching Specs
List Specifications
List all specs with optional filtering and pagination.limit(optional):int- Results per page (1-100, default: 20)skip(optional):int- Offset for pagination (default: 0)endpoint(optional):"fast_spec" | "deep_spec"- Filter by endpoint typestatus(optional):"pending" | "processing" | "completed" | "failed"- Filter by status
ListSpecsResponse object with specs array and pagination metadata
Search Specifications
Search for specs using regex patterns (case-insensitive).query(required):str- Regex pattern (case-insensitive)limit(optional):int- Results per page (1-100, default: 20)skip(optional):int- Offset for pagination (default: 0)endpoint(optional):"fast_spec" | "deep_spec"- Filter by endpoint typestatus(optional):"pending" | "processing" | "completed" | "failed"- Filter by status
ListSpecsResponse object with matching specs and pagination metadata
Regex Pattern Examples:
File Upload Support
Allfast_spec, deep_spec, fast_spec_async, and deep_spec_async 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.
Using File Path (Simplest)
Using File-like Objects
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
Search Specs with Regex
Check Credits Balance
Error Handling
All SDK errors inherit fromPredevAPIError. Typed subclasses map to HTTP status codes so you can handle billing and rate-limit cases explicitly:
Typed exceptions require
predev-api >= 1.1.0.
