# Studio Ghibli API

> Provider: **Ghibli**
> Source: https://www.pixazo.ai/models/studio-ghibli

Ghibli-style image generation.

## Studio Ghibli v1

### Text to Image

## Base URL

```
https://gateway.pixazo.ai/studio-ghibli/v1
```

## Authentication

All requests require an API key passed via header.

Header

Type

Required

Description

Ocp-Apim-Subscription-Key

string

Yes

Your API subscription key

## Generate Image Request - Studio Ghibli API

## Request Code

HTTP Python JavaScript cURL

```
POST https://gateway.pixazo.ai/studio-ghibli/v1/studio-ghibli/generate
Content-Type: application/json
Cache-Control: no-cache
Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY

{
  "prompt": "A peaceful village in the mountains at sunset, Studio Ghibli style"
}
```

```
import requests

API_KEY = "your-api-key-here"
BASE_URL = "https://gateway.pixazo.ai/studio-ghibli/v1"

response = requests.post(
    f"{BASE_URL}/studio-ghibli/generate",
    headers={
        "Content-Type": "application/json",
        "Ocp-Apim-Subscription-Key": API_KEY
    },
    json={
        "prompt": "A peaceful village in the mountains at sunset, Studio Ghibli style"
    }
)

result = response.json()
print(result)
```

```
async function generateImage() {
  const response = await fetch(
    'https://gateway.pixazo.ai/studio-ghibli/v1/studio-ghibli/generate',
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        'Ocp-Apim-Subscription-Key': process.env.API_KEY
      },
      body: JSON.stringify({
        prompt: 'A peaceful village in the mountains at sunset, Studio Ghibli style'
      })
    }
  );
  
  const result = await response.json();
  console.log(result);
}

generateImage();
```

```
curl -v -X POST "https://gateway.pixazo.ai/studio-ghibli/v1/studio-ghibli/generate" \
  -H "Content-Type: application/json" \
  -H "Cache-Control: no-cache" \
  -H "Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY" \
  --data-raw '{
    "prompt": "A peaceful village in the mountains at sunset, Studio Ghibli style"
  }'
```

## Output

```
{
  "request_id": "studio-ghibli_019dxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
  "status": "QUEUED",
  "polling_url": "https://gateway.pixazo.ai/v2/requests/status/studio-ghibli_019dxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
```

[Try Now](https://api.pixazo.ai/api-details#api=studio-ghibli-api&operation=generate-image-request)

## Webhook (Optional)

Add the `X-Webhook-URL` header to your submit request to receive a `POST` callback when the job completes — no polling required.

### Webhook Headers

Header

Required

Default

Description

`X-Webhook-URL`

Yes (to enable)

—

HTTPS endpoint on your server that will receive the `POST` callback. Must respond `2xx` within a few seconds (process async if needed).

`X-Webhook-Mode`

No

`terminal`

`terminal` — fires once at the final status (`COMPLETED`/`FAILED`/`ERROR`). `sync` — fires on every poll cycle plus the terminal event, and caps the queue’s polling delay at **15s** for tighter progress updates.

### Example: enable webhook

```
X-Webhook-URL: https://your-server.com/webhook/callback
X-Webhook-Mode: terminal
```

### Callback Payload

Your endpoint receives a `POST application/json` with the same shape as the `GET /v2/requests/status/{request_id}` response. Example terminal callback (mode `terminal`):

```
{
  "request_id": "studio-ghibli_019dxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
  "status": "COMPLETED",
  "model_id": "studio-ghibli",
  "error": null,
  "output": {
    "media_url": [
      "https://pub-582b7213209642b9b995c96c95a30381.r2.dev/v1/studio-ghibli_019dxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/output.png"
    ],
    "media_type": "image/png"
  },
  "created_at": "2026-05-22T13:17:32.110Z",
  "updated_at": "2026-05-22 13:19:23",
  "completed_at": "2026-05-22 13:19:23"
}
```

### Failure callback shape

```
{
  "request_id": "studio-ghibli_019dxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
  "status": "ERROR",
  "model_id": "studio-ghibli",
  "error": "Description of the error",
  "output": null,
  "created_at": "...",
  "updated_at": "...",
  "completed_at": "..."
}
```

### Delivery semantics

-   **terminal mode (default)** — exactly one `POST` when the request reaches a terminal status. No callback during `PROCESSING`.
-   **sync mode** — `POST` on every status poll (with delay capped at ~15s) plus a final `POST` at terminal status. Use when you want progress updates.
-   **Idempotency** — use `request_id` as your idempotency key. Network retries can deliver the same callback more than once; your handler must tolerate duplicates.
-   **Response** — respond `200 OK` within a few seconds. The queue does not block on slow handlers, but persistent failures may stop further deliveries.
-   **HTTPS required** — plain `http://` URLs are rejected.

## Request Parameters - Generate Image Request

Parameter

Required

Type

Default

Allowed values / range

Description

prompt

Yes

string

—

—

Text description of the image you want to generate. Be specific and descriptive for best results.

negative\_prompt

No

string

—

—

What to exclude from the image (e.g., "people, modern buildings, text, watermark"). Helps refine output quality.

image

No

string

—

—

Image URL for img2img or inpainting mode. Must be publicly accessible (HTTPS recommended).

mask

No

string

—

—

Mask URL for inpainting mode. White areas = regenerate, black areas = preserve. Requires \`image\` parameter.

aspect\_ratio

No

string

—

—

Output aspect ratio. Valid values: \`1:1\`, \`16:9\`, \`21:9\`, \`3:2\`, \`2:3\`, \`4:5\`, \`5:4\`, \`3:4\`, \`4:3\`, \`9:16\`, \`9:21\`. Cannot be used with \`width\`/\`height\`.

width

No

integer

—

—

Custom output width in pixels (256-2048). Use instead of \`aspect\_ratio\` for precise sizing.

height

No

integer

—

—

Custom output height in pixels (256-2048). Use instead of \`aspect\_ratio\` for precise sizing.

output\_format

No

string

—

—

Output image format. Valid values: \`webp\` (smallest), \`jpg\`, \`png\`.

output\_quality

No

integer

—

—

Output quality (0-100). Higher = better quality but larger file size.

num\_outputs

No

integer

—

—

Number of image variations to generate (1-4). Each variation is unique.

webhook

No

string

—

—

Callback URL for completion notification. POST request sent with generation results when complete.

webhook\_events\_filter

No

array

—

—

Events that trigger webhook. Valid values: \`\["\*"\]\` (all), \`\["completed"\]\` (success/failure only), \`\["start", "output", "completed"\]\`.

## Example Request

```
{
  "prompt": "A peaceful village in the mountains at sunset, Studio Ghibli style",
  "negative_prompt": "people, modern buildings, cars, text, watermark, realistic photo",
  "aspect_ratio": "16:9",
  "output_format": "png",
  "output_quality": 95
}
```

## Response

```
{
  "request_id": "studio-ghibli_019dxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
  "status": "QUEUED",
  "polling_url": "https://gateway.pixazo.ai/v2/requests/status/studio-ghibli_019dxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
```

## Request Headers

Header

Value

Content-Type

application/json

Cache-Control

no-cache

Ocp-Apim-Subscription-Key

YOUR\_SUBSCRIPTION\_KEY

## Response Handling

Common status codes.

Code

Meaning

202

Accepted — Request queued

400

Bad Request

401

Unauthorized

402

Insufficient Balance

403

Forbidden

429

Too Many Requests

500

Internal Server Error

## Error Responses

Queue system errors and model validation errors.

### Queue System Errors

```
// 402 — Insufficient balance
{
  "error": "Insufficient Balance",
  "message": "Your wallet does not have enough balance. Required: $0.01"
}
```

```
// 400 — Model not found
{
  "error": "Model not found",
  "message": "Model 'studio-ghibli' not found or is disabled"
}
```

### Error via Status/Webhook

```
{
  "request_id": "studio-ghibli_019dxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
  "status": "ERROR",
  "model_id": "studio-ghibli",
  "error": "Description of the error",
  "output": null
}
```

## Retrieving Results

Poll the universal status endpoint to check progress and retrieve results.

### Endpoint

```
GET https://gateway.pixazo.ai/v2/requests/status/{request_id}
Ocp-Apim-Subscription-Key: YOUR_API_KEY
```

## cURL Example

```
curl -H "Ocp-Apim-Subscription-Key: YOUR_API_KEY" \
  "https://gateway.pixazo.ai/v2/requests/status/studio-ghibli_019d42ce-946d-7739-f812-6875c434cb790"
```

## Response (Completed)

```
{
  "request_id": "studio-ghibli_019d42ce-946d-7739-f812-6875c434cb790",
  "status": "COMPLETED",
  "model_id": "studio-ghibli",
  "error": null,
  "output": {
    "media_url": [
      "https://pub-582b7213209642b9b995c96c95a30381.r2.dev/v1/studio-ghibli_019d42ce-946d-7739-f812-6875c434cb790/output.png"
    ],
    "media_type": "image/png"
  },
  "created_at": "2026-03-31T07:32:03.749Z",
  "updated_at": "2026-03-31T07:32:20.000Z",
  "completed_at": "2026-03-31T07:32:20.000Z"
}
```

## Response Fields

Field

Type

Description

request\_id

string

Unique request identifier

status

string

QUEUED, PROCESSING, COMPLETED, FAILED, or ERROR

model\_id

string

Model that processed the request

error

string|null

Error message if failed

output.media\_url

array

URLs to generated media (R2 CDN)

output.media\_type

string

MIME type (image/png)

created\_at

string

When request was created

completed\_at

string|null

When request completed

polling\_url

string

Status URL (initial response only)

## Status Values

Status

Description

QUEUED

Request accepted, waiting to be processed

PROCESSING

Being processed by the model

COMPLETED

Done — output contains the result

FAILED

Failed — check error field

ERROR

System error — not charged

## Status Flow

```
QUEUED → PROCESSING → COMPLETED
                    → FAILED
                    → ERROR
```

## Typical Workflow

1.  **Send a generate request** to the API endpoint
2.  **Save the `request_id`** from the response
3.  **Poll** every 5-10 seconds: `GET /v2/requests/status/{request_id}`
4.  **When `status` is `"COMPLETED"`**, download from `output.media_url`

**Tip:** Use `X-Webhook-URL` header to get a callback instead of polling.
