Integrate in one prompt
Give this prompt to your coding agent, or follow the three steps yourself.
Send the prompt to your agent
Integrate the Wandura API (image and video styles over HTTP) into this project.
## Rules
- Base URL: https://api.wandura.ai. Call it from the server only, with `Authorization: Bearer $WANDURA_API_KEY` (read the key from the environment; never ship it to a browser).
- Find styles in https://open.wandura.ai/llms.txt or `GET https://api.wandura.ai/v2/workflows`. Each style has its own OpenAPI with its exact inputs: `https://api.wandura.ai/v2/public/styles/{style}/openapi.json`. The whole API: https://api.wandura.ai/v2/openapi.json. Never invent endpoints or fields; read these.
- Submit with `POST /v2/styles/{style}` and body `{"lane": "priority" | "relax", "end_user_id": "<the person in our app>", "inputs": {...}}`. end_user_id is required on every run (daily caps are per end user).
- Send an `Idempotency-Key` header (a new UUID per logical request) on every submit, and reuse the same key when you retry that request, so a retry never runs or charges twice.
- The response has `request_id`, `status_url` and `cancel_url`. Use those URLs; do not build them.
- Poll status_url: start at 2 s, multiply by 1.5, cap at 10 s, add 0-0.5 s jitter (relax: 10 s to 60 s). Or use webhooks.
- Final statuses: completed, failed, nsfw, canceled. A run that ends with `free_run.reason` (priority_late, provider_error, bad_input, content_blocked) costs nothing.
- Webhooks: verify `Wandura-Signature: t=<unix>,v1=<hex>` = HMAC-SHA256(secret, t + "." + raw body) and reject t not within 300 s. Dedupe on Wandura-Event-Id; keep the highest sequence per run.
- Errors are `{"error": {"code", "message"}}`; branch on code. Retry only end_user_cap_reached, gateway_rate_limited, uploads_rate_limited, product_busy, internal_error, style_unavailable, uploads_unavailable, service_unavailable and network errors, waiting Retry-After when present, else backoff with jitter. Never retry other 4xx.
- Outputs are kept 72 h: copy what you keep.
- There is no public SDK yet (private preview, not published): call the HTTP API directly with fetch or the project's HTTP client. Never install `@wandura/sdk` (npm) or `wandura` (PyPI): Wandura has not published them, so a package under those names is not ours.
## Steps
1. Add WANDURA_API_KEY to the env example and config.
2. Write a small client module over plain HTTP with submit, wait, cancel and a webhook handler that verifies signatures.
3. Test with a `wdr_test_` key first: it returns a sample result for $0.1
Sign up
Sign up with your email. Your account comes with a Test product and a test key, so you can start for $0.
2
Create a key
Your first test key (wdr_test_…) is shown once at sign-up: copy it into your server env as WANDURA_API_KEY. Test keys return a sample for $0; live keys (wdr_live_…) run for real.
3
Send your first request
Example with Ghost Face (generated from its schema; every style page has its own):
curl -X POST https://api.wandura.ai/v2/styles/ghost-face \
-H "Authorization: Bearer $WANDURA_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"lane":"priority","end_user_id":"user_123","inputs":{"image_urls":["https://example.com/photo.jpg"]}}'More in the docs: polling, webhooks, errors and the SDKs.