Skip to main content

extract-design

Official Python SDK for the extract.design API - AI-powered design extraction for print-on-demand sellers.

Installation

pip install extract-design

Quick Start

from extract_design import ExtractDesign

# Initialize the client
client = ExtractDesign(api_key="sk_live_...")

# Extract a design and wait for completion
result = client.extract_and_wait(
    image_url="https://example.com/product.jpg"
)

print(result.extraction_url)

Usage

Submit an Extraction

from extract_design import ExtractDesign

client = ExtractDesign(api_key="sk_live_...")

# Submit and get extraction ID
response = client.extract(
    image_url="https://example.com/product.jpg"
)

print(f"Extraction ID: {response.extraction_id}")
print(f"Status: {response.status}")
print(f"Estimated time: {response.estimated_time_seconds}s")

Check Extraction Status

result = client.get_extraction(extraction_id)

if result.status == "completed":
    print(f"Design URL: {result.extraction_url}")
elif result.status == "failed":
    print(f"Error: {result.error}")

Wait for Completion

# Simple wait
result = client.wait_for_completion(extraction_id)

# With progress callback
result = client.wait_for_completion(
    extraction_id,
    on_progress=lambda r: print(f"Status: {r.status}"),
)

# Custom timeout and interval
result = client.wait_for_completion(
    extraction_id,
    timeout=120,  # 2 minutes
    interval=3,   # Check every 3 seconds
)

Extract with Options

# With upscaling
result = client.extract_and_wait(
    image_url="https://example.com/product.jpg",
    scale=4,
)

# With remix prompt
result = client.extract_and_wait(
    image_url="https://example.com/product.jpg",
    remix_prompt="Make it a watermelon",
)

# With webhook notification (Pro+ plans)
response = client.extract(
    image_url="https://example.com/product.jpg",
    webhook_url="https://your-api.com/webhook",
    metadata={"order_id": "12345"},
)

Check Usage

usage = client.get_usage()

print(f"Plan: {usage.plan}")
print(f"Credits remaining: {usage.credits.total}")
print(f"Credits used: {usage.credits.used}")

Verify API Key

try:
    client.verify_api_key()
    print("API key is valid")
except AuthenticationError:
    print("Invalid API key")

Error Handling

from extract_design import (
    ExtractDesign,
    AuthenticationError,
    InsufficientCreditsError,
    RateLimitError,
    ValidationError,
    TimeoutError,
    ExtractionFailedError,
)

client = ExtractDesign(api_key="sk_live_...")

try:
    result = client.extract_and_wait(
        image_url="https://example.com/product.jpg"
    )
except AuthenticationError:
    print("Invalid API key")
except InsufficientCreditsError:
    print("Not enough credits")
except RateLimitError as e:
    print(f"Rate limited, retry after {e.retry_after} seconds")
except ValidationError as e:
    print(f"Invalid request: {e.error_message}")
except TimeoutError as e:
    print(f"Extraction {e.extraction_id} timed out")
except ExtractionFailedError as e:
    print(f"Extraction failed: {e.reason}")

Context Manager

The client can be used as a context manager to ensure proper cleanup:

with ExtractDesign(api_key="sk_live_...") as client:
    result = client.extract_and_wait(
        image_url="https://example.com/product.jpg"
    )
    print(result.extraction_url)

Configuration

client = ExtractDesign(
    api_key="sk_live_...",
    base_url="https://extract.design",  # Custom base URL
    timeout=60.0,  # Request timeout in seconds
)

Requirements

  • Python 3.10+
  • httpx

License

MIT License - see LICENSE for details.

Metadata

Release files for extract-design 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for extract-design 0.1.0
File Size Uploaded Provenance Actions
extract_design-0.1.0.tar.gz 8.1 kB Without provenance Details for extract_design-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for extract-design 0.1.0
File Interpreter ABI Platform Actions
extract_design-0.1.0-py3-none-any.whl Python 3 none any Details for extract_design-0.1.0-py3-none-any.whl

Total release size: 17.4 kB

Release files / extract_design-0.1.0.tar.gz

Download URL extract_design-0.1.0.tar.gz
Size 8.1 kB
Tags Source
SHA-256 checksum
How to use checksums
3ad6b177d01f2c049bba75d76647308f23567d167eebdb427b324fe963d91436
BLAKE2b-256 checksum
How to use checksums
d014bc1035af1fcbf32142c164f1077c1f1ad77000707c6b8655e133ee919837
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release files / extract_design-0.1.0-py3-none-any.whl

Download URL extract_design-0.1.0-py3-none-any.whl
Size 9.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5df9569dbc2c8d842b3e00c6f23ea8603d2348ca17df4590c3693fb596f384f6
BLAKE2b-256 checksum
How to use checksums
9c4f4e0bb680e1412b70075d2b80913554466daef3746afac46153d87d79e969
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Security for extract-design 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page