> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gizmo.antimlabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Reference images

> Upload original photos, attach multiple views, and choose reference intent.

Works with **Personal and Team keys**. Reference photos give Gizmo the exact shape, proportions and look of a real object. You can link public images or upload local files, and label each one with the view it shows.

## Upload local files and supply multiple views

Upload local files as `multipart/form-data`; you do not need to host images yourself.
Use the repeated field name `files`. Let your HTTP client set the multipart boundary
(do not manually set a JSON Content-Type for this request).

```bash theme={null}
curl --fail-with-body "https://api.gizmo.antimlabs.com/v1/images" \
  -H "Authorization: Bearer $GIZMO_API_KEY" \
  -F "files=@./front.jpg" \
  -F "files=@./back.png"
```

The `201 Created` response contains `images` in upload order. Each item has `id`,
`content_type`, `size_bytes`, `width`, `height`, and `sha256`. Save the returned IDs:

```json theme={null}
{
  "prompt": "Recreate this object with working moving parts",
  "reference_images": [
    {"image_id": "IMAGE_ID_FROM_UPLOAD_1", "view": "front"},
    {"image_id": "IMAGE_ID_FROM_UPLOAD_2", "view": "back"},
    {"url": "https://example.com/object-top.jpg", "view": "top"}
  ]
}
```

Send that JSON to `POST /v1/assets`. Replace the placeholder IDs with real upload IDs.
Each reference has **exactly one** of `image_id` or `url`. Accepted view labels are
`front`, `back`, `left`, `right`, `top`, `bottom`, `perspective`, and `detail`.
Labels are optional hints, not calibrated camera poses. You can supply several
details or perspectives. If you send both reference fields, `reference_image_urls`
come first, followed by `reference_images` in order.

Limits: **8 files per upload; 8 references per generation; 20 MiB and 40 million
pixels per file; 80 MiB per upload request**. Supported formats are non-animated
PNG, JPEG and WebP. Gizmo keeps your original files unchanged. Uploading the same
file twice returns the same ID. Image IDs are private to the account (Personal or
Team) that uploaded them, so upload and generate with the same key.

`GET /v1/images/{id}` reads metadata. `GET /v1/images/{id}/content` downloads the exact
original bytes. Uploaded images stay available while a job waits in the queue.
External URLs must still be reachable when the job starts, so upload the file if
you are not sure the link will last.

## Reference fidelity

By default Gizmo reconstructs the object in your photos as closely as it can. It
works from your original images; it does not redraw them first.

Set `reference_intent.mode` to change that: `reconstruct` copies the pictured
object, `extract` pulls one object out of a busy photo (name it in
`reference_intent.target`), `modify` applies the changes in your prompt to the
pictured object, and `design` treats the photos as inspiration for something new.
The default, `auto`, chooses from your prompt and references.

```json theme={null}
{
  "prompt": "The kettle on the counter",
  "reference_image_urls": ["https://example.com/kitchen.jpg"],
  "reference_intent": {"mode": "extract", "target": "electric kettle"}
}
```

Gizmo cannot see surfaces that none of your photos show, so add views of any side that matters.

### Python: local files and URL references

```python theme={null}
import os
import uuid
import httpx

with httpx.Client(
    base_url="https://api.gizmo.antimlabs.com/v1/",
    headers={"Authorization": f"Bearer {os.environ['GIZMO_API_KEY']}"},
    timeout=120,
) as client:
    with open("front.jpg", "rb") as front, open("back.png", "rb") as back:
        upload = client.post("images", files=[
            ("files", ("front.jpg", front, "image/jpeg")),
            ("files", ("back.png", back, "image/png")),
        ])
    upload.raise_for_status()
    images = upload.json()["images"]
    # Save the key before sending; reuse it if this POST needs to be retried.
    key = str(uuid.uuid4())
    response = client.post("assets", headers={"Idempotency-Key": key}, json={
        "prompt": "Recreate this object with working joints",
        "reference_images": [
            {"image_id": images[0]["id"], "view": "front"},
            {"image_id": images[1]["id"], "view": "back"},
            {"url": "https://example.com/object-top.jpg", "view": "top"},
        ],
    })
    response.raise_for_status()
    print(response.json()["job_id"])
```

For URL-only generation, omit the upload and use `reference_image_urls` or
`reference_images: [{"url": "https://your-host/your-image.jpg", "view": "front"}]`.
Replace all example URLs with accessible images. API keys belong on your server, not in browser bundles.

Reference URLs must serve image bytes directly. Redirect responses are not followed; use the final image URL or upload the local file with `POST /v1/images`.

[Upload reference images](https://docs.gizmo.antimlabs.com/api-reference/images/upload-reference-images.md) · [Generate one asset](https://docs.gizmo.antimlabs.com/api-generate.md) · [Generate a batch](https://docs.gizmo.antimlabs.com/api-batches.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.