---
agent:
  instructions: "Search the site by keyword or question. The search API returns Markdown."
  endpoint: "https://platform.invideo.io/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Generate and edit images

> Submit image jobs, supply reference images and sizes, and track their results and cost.

## Submit an image job

Choose an image model and mode from [Models](/models#models-image). Send your Platform API key and the model's input to `POST /v1/request`.

```bash
curl https://platform-api.invideo.io/v1/request \
  -H "Authorization: Bearer $INVIDEO_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: fox-thumbnail-1" \
  -d '{
    "model": "nano-banana-2-1",
    "mode": "generate",
    "input": {"prompt": "A red fox crossing fresh snow at sunrise"}
  }'
```

Save the returned `id`. Poll `GET /v1/request/{id}` with the same workspace key every 2–5 seconds until `status` is `succeeded` or `failed`. On success, download the files from `output.files[].url`. Each URL is valid for one hour. Read the request again for fresh links. [Requests](/docs/requests)

Keep your provider client’s request and response format by using the matching Platform endpoint. [Image provider formats](/docs/sdks/image)

## Inputs

Use `GET /v1/models/{id}` or the model's page to find its input field names, defaults, and allowed values. Put model inputs inside `input` when using `POST /v1/request`. Depending on the model, inputs can include a prompt, aspect ratio, seed, quality, or output count. Use the mode listed for the operation you want, such as generation, editing, or upscaling. [Catalog](/docs/catalog)

## Edit and reference images

Choose a model that supports the operation and add your source image to the field in its schema. Use an HTTPS URL the API can fetch or a base64 data URI with the image's MIME type. A `file` field takes one string. A `files` field takes an array of strings.

For a model with an `image_url` input, an edit might send `"input": {"image_url": "https://example.com/photo.png", "prompt": "Replace the background with pale blue"}`. Use the exact field names from your model for multiple references, a separate style reference, or a mask. [Files](/docs/files)

## Sizes

Set the aspect ratio or size from the model's allowed values. When the schema exposes both `aspect_ratio` and `resolution`, select both to control the shape and detail. Edit and upscale inputs can have their own pixel bounds and aspect ratio limits. Read the actual dimensions in `output.files[].width` and `output.files[].height` after the run. [Models](/models#models-image)

## Pricing

The [Pricing page](/pricing) lists each model’s billed units and option-specific rates. Each model page shows the same rate table.

Check the model's USD rate in the catalog or Playground. Price can vary with options such as resolution or quality and with how many images are generated. The Platform reserves an estimate when you submit and charges the actual price when the run succeeds. Failed runs are free. The terminal invideo API request includes `cost_usd`. Provider-format endpoints report the customer charge in their native response and the `x-invideo-cost-usd` header once the charge is final. [Billing](/docs/billing)

## Errors

| What you see | What to do |
| --- | --- |
| `422 invalid_input` or a provider field error | Check the named input against the model's schema. |
| `402 insufficient_balance` | Add funds or wait for active requests to release their holds. |
| `429` | Honor `Retry-After` for a rate limit. Check the workspace's Limits page for a spend limit. |
| `status: "failed"` | Read the request's `error` and check `retryable` before starting another run. |

Reuse the same `Idempotency-Key` and body after a network error or an uncertain submit. [Errors](/docs/errors)

## Limits

A JSON request body can be up to 64 MB, including any data URIs. Use HTTPS URLs for larger inputs within the model's file limits. Check your model for supported file types, byte and pixel limits, and maximum reference count. Workspace request and spend limits apply across its API keys and Playground. [Limits](/docs/limits)
