Skip to content

Python SDK

The official Python SDK for Get3W. Run AI models with just a few lines of code.

Installation

bash
pip install get3w

Quick Start

python
import get3w

output = get3w.run(
    "get3w/z-image/turbo",
    {"prompt": "Cat in space, cinematic lighting"},
)

print(output["outputs"][0])  # Output URL

Authentication

Get your API key from get3w.com/accesskey.

Option 1: Environment variable (recommended)

bash
export GET3W_API_KEY="your-api-key"

Option 2: Pass directly

python
from get3w import Client

client = Client(api_key="your-api-key")
result = client.run("get3w/z-image/turbo", {"prompt": "Cat"})

Configuration

Timeout & Polling

python
output = get3w.run(
    "get3w/z-image/turbo",
    {"prompt": "Cat"},
    timeout=36000.0,      # Max wait time in seconds (default: 36000)
    poll_interval=1.0,    # Status check interval (default: 1.0)
)

Sync Mode

Some models support single-request execution without polling:

python
output = get3w.run(
    "get3w/z-image/turbo",
    {"prompt": "Cat"},
    enable_sync_mode=True,
)

TIP

Not all models support sync mode. Check the model documentation for availability.

Retry Configuration

python
from get3w import Client

client = Client(
    api_key="your-api-key",
    max_retries=3,
    max_connection_retries=5,
    retry_interval=1.0,
)

File Upload

Upload images, videos, or audio files to use as model inputs:

python
import get3w

url = get3w.upload("/path/to/image.png")
print(url)  # Use this URL as input for models

Serverless Workers

Build and deploy custom AI workers on the Get3W platform:

python
import get3w.serverless as serverless

def handler(job):
    prompt = job["input"].get("prompt", "")
    return {"output": prompt.upper()}

serverless.start({"handler": handler})

Environment Variables

VariableDescription
GET3W_API_KEYYour Get3W API key

Released under the MIT License.