Reference inputs

An image, speech, transcription or video job can start from reference inputs: images, audio, video and files. Send them in one list, input_references, with a type and an optional role for each entry. Each reference counts as input of the job.

Send the list on POST /v1/images/generations, POST /v1/images/edits, POST /v1/videos, POST /v1/audio/speech and POST /v1/audio/transcriptions. For the names that older clients send, see What changed in the API.

curl https://router.inference.ai.exchange/v1/images/generations \
  -H "Authorization: Bearer sk-liquid-..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-1",
    "prompt": "a logo in the same style",
    "input_references": [
      { "type": "image", "url": "https://example.com/logo.png" },
      { "type": "audio", "data": "<base64>", "media_type": "audio/wav" }
    ]
  }'

Entries

type Fields Notes
image url or data, media_type An https:// URL or a data:image/ URL.
audio url or data, media_type A data:audio/ URL, or base64 bytes with media_type.
video url or data, media_type An https:// URL or a data:video/ URL.
file url or data, media_type, filename A data: URL, such as a PDF.
text text The words of a voice sample. Needs the role voice_transcript.

Roles

role is optional. It is reference by default.

role Entry type Endpoint Meaning
reference any all of them Guidance for the job.
first_frame image POST /v1/videos The first frame of the video.
last_frame image POST /v1/videos The last frame of the video.
voice_sample audio POST /v1/audio/speech A sample of the voice to speak in.
voice_transcript text POST /v1/audio/speech The words that the voice sample speaks.

An endpoint refuses a role that it does not read, with 400. POST /v1/audio/transcriptions takes exactly one audio entry, or a file in a form.

Frame images

On POST /v1/videos, send an image with the role first_frame or last_frame to fix that frame of the video.

"input_references": [
  { "type": "image", "url": "https://example.com/closed.png", "role": "first_frame" },
  { "type": "image", "url": "https://example.com/open.png", "role": "last_frame" }
]

Guidance inputs

An entry with no role, or with the role reference, is guidance.

"input_references": [
  { "type": "image", "url": "https://example.com/character.png" },
  { "type": "video", "url": "https://example.com/motion.mp4" }
]

To continue or extend a finished video, do not send it as a reference. Send previous_job_id. See Video generation.

Voice samples

On POST /v1/audio/speech, send a sample of a voice and, if you have it, the words of the sample.

"input_references": [
  { "type": "audio", "data": "<base64>", "media_type": "audio/wav", "role": "voice_sample" },
  { "type": "text", "text": "The words of the sample.", "role": "voice_transcript" }
]

A voice sample belongs to one voice. Send it with a string or with one turn, not with many turns.

Which offers can win

Only an offer that declared each input kind can win. The kinds are input.image, input.audio, input.video and input.file. The exchange also checks the limits that the offer declared, such as image.max_references and audio.max_bytes.

If no offer takes all of your references:

Charge

See Modalities for the cap.

Edit images and video forms

If no image offer reads your references, the error says so. The Playground then asks a chat model to describe the images, sends the description to the image model, and tells you that it did. The API does not do this.

In the Playground

The Image, Speech, Video and Compare prompt boxes take files. Drag a file onto the box, paste it, or use the paperclip button.

What a box accepts

The Playground sends the prompt as text, so a link to an image in the prompt does not become a reference. If the prompt has a link to a PNG, JPEG, WebP or GIF file, the Playground tells you to download the image and attach it as a file.

When no model reads a file

If no model of a lane reads a file, the Playground marks the file and stops the run. Remove the file, or choose a model that reads it.

The price estimate for an image counts only the offers that read your files. A speech or video job has no estimate.

Video start frame

In a video run, the first image is the start frame. The Size menu sets the size of the video.

If the start frame does not have the shape of the video, the Playground marks it and stops the run. Select Edit on the image to crop it to the shape, or to keep the whole image with black bars. The editor gives a JPEG that is no larger than the size of the video. It works in your browser and sends the image nowhere.

Model page Playground

The Playground on the page of an image model has a Reference images field. Drop, paste or upload images, up to the limit that the offers of the model declare. The field is absent when no offer reads images.

The form also shows each control that an offer declared: the number of images, format, quality, background, compression, seed and streaming. A control that no offer declared is not shown. The JSON view shows the request body.

Saved files

A run keeps its files in this browser. The run header lists them. Run again, Retry and a variation send them again.

Next steps