OP Inference

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 with 400 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

InputMeaning
promptWhat the image should show
negative_promptWhat the image should not show
nHow many images to generate
widthOutput width in pixels
heightOutput height in pixels
aspect_ratioOutput shape as width:height
resolutionOutput size tier
seedFixes the random seed, so the same request can reproduce an image
stepsNumber of denoising steps. More steps trade speed for detail
guidanceHow closely the image follows the prompt
output_formatFile format of the generated image
qualityRendering quality tier
imageAn image to edit or transform
imagesImages to edit or combine
maskMarks the area of the input image to change
reference_imagesImages that guide style, subject or composition

Video

InputMeaning
promptWhat the video should show
negative_promptWhat the video should not show
nHow many videos to generate
widthOutput width in pixels
heightOutput height in pixels
aspect_ratioOutput shape as width:height
resolutionOutput size tier
duration_secondsLength of the video in seconds
fpsFrames per second of the output
seedFixes the random seed, so the same request can reproduce a video
generate_audioWhether the video gets a generated soundtrack
camera_fixedKeeps the camera still
first_frameAn image the video starts from
last_frameAn image the video ends on
reference_imagesImages that guide subject or style
reference_videosVideos that guide motion or style
reference_audiosAudio that guides the soundtrack or a voice
character_orientationWhether the character faces as in the reference image or as in the reference video
videoA video to edit, extend or transform
audioThe audio track the video is made to

Speech

InputMeaning
promptThe text to speak
voiceThe voice that speaks
languageThe language of the speech
speedSpeaking rate, where 1 is normal
output_formatFile format of the generated audio
reference_audiosRecordings of a voice to clone or a style to follow

Transcription

InputMeaning
audioThe recording to transcribe
languageThe language spoken in the audio. Omit to detect it
promptContext that helps transcription, such as names or terms

Music

InputMeaning
promptStyle, mood and instruments of the track
lyricsWords to sing
duration_secondsLength of the track in seconds
instrumentalGenerates the track without vocals
output_formatFile format of the generated audio
audioA track to cover, extend or repaint
imageAn image that sets the mood of the track
reference_audiosTracks that guide style