Metadata-Version: 2.1
Name: arteza
Version: 0.5.0
Summary: Official Arteza SDK: 100+ image, video and audio models through one API.
Home-page: https://arteza.ai/developers/sdks
License: MIT
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# Arteza SDK for Python

The official client for the [Arteza API](https://arteza.ai/developers/docs): 100+ image, video and audio models and 20 image tools behind one key. Standard library only, Python 3.8+.

## Install

```bash
pip install https://arteza.ai/sdk/arteza-0.2.0-py3-none-any.whl
```

Create an API key in the [console](https://arteza.ai/developers/console) and set `ARTEZA_API_KEY`.

## Generate

```python
from arteza import Arteza

arteza = Arteza()  # reads ARTEZA_API_KEY
gen = arteza.run("seedance-2", {"prompt": "a koi pond at dawn, slow dolly in", "duration": 5})
print(gen["output"]["files"][0]["url"], gen["billing"])
```

`run()` starts the generation and waits for it. A failed generation raises `GenerationFailedError` and is refunded in full.

```python
# Let Arteza pick the model
gen = arteza.run("auto", {"prompt": "product shot of a perfume bottle"}, route={"task": "text-to-image", "priority": "quality"})
print(gen["routing"]["chosen"]["model"], gen["routing"]["reason"])

# One of the studio's apps (GET /apps)
app = arteza.apps.retrieve("ai-room-converter")   # preset ids: app["input_schema"]["properties"]["preset"]["enum"]
gen = arteza.run_app("ai-room-converter", {"preset": "library", "image_url": url})

# Fashion Studio: a catalog shoot, one job per shot
model = arteza.studios.fashion.catalog("models")["data"][0]["id"]
top = arteza.studios.fashion.catalog("garments")["data"][0]["id"]
batch = arteza.studios.fashion.shoot("catalog", [{"model": model, "top": top}])
jobs = arteza.studios.jobs.wait_all(batch)

# AI Influencer: a persona (portrait + identity sheet), then a look
p = arteza.studios.influencer.create_persona(name="Mara", prompt="a travel photographer in her thirties")
arteza.studios.jobs.wait_all(p)
look = arteza.studios.influencer.create_look(p["persona_id"], scene="a cafe terrace in Lisbon", platform="portrait")

# Your own files
url = arteza.uploads.upload("cat.png")["url"]
arteza.run("rmbg-birefnet", {"image_url": url})

# Price first
est = arteza.estimate("seedance-2", {"prompt": "...", "duration": 5})
print(est["price"]["credits"]["amount"], est["affordable"])

# Start now, collect later
g = arteza.generations.create("seedance-2", {"prompt": "..."}, webhook_url="https://you.example/hooks/arteza")
done = arteza.generations.wait(g["id"])

# History
for g in arteza.generations.iterate(model="seedance-2"):
    print(g["id"], g["status"])
```

Every `generations.create` sends an `Idempotency-Key` automatically, and transient failures (429, 5xx, network) are retried with backoff, honouring `Retry-After`. API errors raise `ArtezaError` with `status`, `code`, `param` and `request_id`.

## Webhooks

```python
from arteza import verify_webhook

event = verify_webhook(raw_body, request.headers, os.environ["ARTEZA_WEBHOOK_SECRET"])
if event["type"] == "generation.completed":
    print(event["data"]["output"]["files"])
```

## Command line

```bash
python -m arteza models --category video
python -m arteza run seedance-2 -p "a koi pond at dawn" duration=5 -o out
python -m arteza run rmbg-birefnet image_url=@./cat.png
python -m arteza balance --json
python -m arteza catalog fashion models
python -m arteza shoot catalog model=<id> top=<id> --tier draft -o out
python -m arteza persona -p "a travel photographer in her thirties" --name Mara
python -m arteza jobs --studio influencer
```

Links: [API reference](https://arteza.ai/developers/docs) · [prices](https://arteza.ai/developers/pricing) · [MCP for Claude, ChatGPT and Cursor](https://arteza.ai/mcp)
