Metadata-Version: 2.5
Name: auray-client
Version: 0.2.0
Summary: The Auray API from Python: run a model at its address, follow the request, download what it made.
Project-URL: Documentation, https://auray.ai/docs/clients/python
Project-URL: Homepage, https://auray.ai
License-Expression: MIT
Keywords: 3d,api,auray,generative,image,music,video
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.10
Requires-Dist: httpx>=0.27
Description-Content-Type: text/markdown

# auray-client

The Auray API from Python. One dependency, `httpx`; Python 3.10+.

```sh
pip install auray-client
```

```python
from auray_client import Client

auray = Client()  # reads AURAY_API_KEY

result = auray.subscribe(
    "auray-ai/krea-2-turbo/text-to-image",
    input={"prompt": "a brass orrery on a walnut desk, morning light", "aspect_ratio": "16:9", "resolution": 1024},
    idempotency_key="my-first-render",
    on_queue_update=lambda s: print(s["status"]),
)
assets = auray.platform.jobs.assets(result["request_id"])
print(assets["assets"][0]["url"])
```

- `run(address, input=..., wait_seconds=..., timeout=...)` — the synchronous host; a
  `504 run_timed_out` is followed by the job it names (`queue_request_id`, never the trace in
  `request_id`), never resubmitted. `wait_seconds` is how long the host holds the connection,
  `timeout` the whole call's deadline; running out raises `subscribe_timed_out` carrying the job.
- `subscribe(address, input=..., idempotency_key=..., on_queue_update=...)` — submit, follow, fetch
  the result, waiting as long as the server's `give_up_after_seconds` says unless `timeout` says otherwise.
- `queue.submit / status / result / cancel / stream_status` — the request lifecycle, fal's shape.
- `storage.upload(address=..., content_type=..., data=...)` and `upload_file(path, address=...)` —
  three calls, a signed URL, and the field it goes in.
- `platform.me / usage / plans / catalogue / status / changelog / jobs / models / webhooks / chat` — the account's side.
- `embeddings.create(model=..., input=...)` — vectors from the OpenAI-compatible route.
- `AsyncClient` — the same surface, awaited: `async with AsyncClient() as auray: ...`

Every refusal raises `AurayError` with `status`, `code`, `error_type`, the API's `message`, `docs` and
`request_id`, and the body's own `retry` and `charged`: a refusal is resent only when that advice says
the identical request may be answered (`same_key`, `after_retry_after`) and no charge stands.

Documentation: https://auray.ai/docs/clients/python
