Inputs
How to pass images, audio and video to a media job, and what each input name means.
A media request is a JSON body of named inputs. The names are shared across models of a modality,
so prompt, width or duration_seconds mean the same thing on every model that accepts them.
Which inputs a model accepts, which are required, and their ranges, enums and defaults are listed
on that model's page under Models.
An input the modality does not define is refused with 400 invalid_request, and param names it:
{
"error": {
"code": "invalid_request",
"message": "...",
"param": "colour"
}
}Files are https URLs
Inputs that carry media (image, images, mask, first_frame, audio, video,
reference_images and the like) take an https URL, or a list of them. The file is fetched from
that URL when the job runs.
- The URL must be absolute and use
https.http,data:and other schemes are refused with400 invalid_request. - It must be reachable from the public internet without cookies or extra headers. A presigned link from your own storage works; give it an expiry long enough for the job to start.
- There is no upload endpoint. Put the file in your own storage first.
- The whole request body, URLs included, is capped at 25 MB.
curl https://api.opinference.com/v1/audio/transcriptions \
-H "Authorization: Bearer $OP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "cohere/transcribe",
"audio": "https://example.com/interview.mp3",
"language": "en"
}'Input names
Each table lists every name the modality defines. A model accepts a subset.
Image
| Input | Meaning |
|---|---|
prompt | What the image should show |
negative_prompt | What the image should not show |
n | How many images to generate |
width | Output width in pixels |
height | Output height in pixels |
aspect_ratio | Output shape as width:height |
resolution | Output size tier |
seed | Fixes the random seed, so the same request can reproduce an image |
steps | Number of denoising steps. More steps trade speed for detail |
guidance | How closely the image follows the prompt |
output_format | File format of the generated image |
quality | Rendering quality tier |
image | An image to edit or transform |
images | Images to edit or combine |
mask | Marks the area of the input image to change |
reference_images | Images that guide style, subject or composition |
Video
| Input | Meaning |
|---|---|
prompt | What the video should show |
negative_prompt | What the video should not show |
n | How many videos to generate |
width | Output width in pixels |
height | Output height in pixels |
aspect_ratio | Output shape as width:height |
resolution | Output size tier |
duration_seconds | Length of the video in seconds |
fps | Frames per second of the output |
seed | Fixes the random seed, so the same request can reproduce a video |
generate_audio | Whether the video gets a generated soundtrack |
camera_fixed | Keeps the camera still |
first_frame | An image the video starts from |
last_frame | An image the video ends on |
reference_images | Images that guide subject or style |
reference_videos | Videos that guide motion or style |
reference_audios | Audio that guides the soundtrack or a voice |
character_orientation | Whether the character faces as in the reference image or as in the reference video |
video | A video to edit, extend or transform |
audio | The audio track the video is made to |
Speech
| Input | Meaning |
|---|---|
prompt | The text to speak |
voice | The voice that speaks |
language | The language of the speech |
speed | Speaking rate, where 1 is normal |
output_format | File format of the generated audio |
reference_audios | Recordings of a voice to clone or a style to follow |
Transcription
| Input | Meaning |
|---|---|
audio | The recording to transcribe |
language | The language spoken in the audio. Omit to detect it |
prompt | Context that helps transcription, such as names or terms |
Music
| Input | Meaning |
|---|---|
prompt | Style, mood and instruments of the track |
lyrics | Words to sing |
duration_seconds | Length of the track in seconds |
instrumental | Generates the track without vocals |
output_format | File format of the generated audio |
audio | A track to cover, extend or repaint |
image | An image that sets the mood of the track |
reference_audios | Tracks that guide style |