Images, video, embeddings and speech

These routes use the same product key. They are separate from tiers.

Images#

POST /v1/images generates an image from text or edits input images.

FieldMeaning
promptRequired, up to 8000 characters
imagesUp to 4 data URLs, data:image/<png\|jpeg\|webp\|gif\|heic\|heif>;base64,..., for editing. Omit to generate
subject, request_idAs in Text completion

The body is limited to 30,000,000 bytes. The response has images ([{"mime","data"}], base64 without a prefix), text (accompanying text or null), model, pool, rung, attempts and totalLatencyMs. When nothing answers, the result is 503 all_rungs_failed and, if known, retry_at with the time the quota comes back.

Video#

Video is a task.

  1. POST /v1/video with prompt (up to 8000 characters), an optional image (one data URL, png, jpeg or webp) and subject. It returns 202 {"id","status"}.
  2. GET /v1/video/:id returns {"id","status"}, with error or bytes when known.
  3. GET /v1/video/:id/content streams video/mp4.

A task is visible only to the product that created it; others get 404 not_found. Tasks are remembered for 24 hours. If video is not configured, the answer is 503 not_configured.

Embeddings#

POST /v1/embeddings is OpenAI-compatible.

  • input: a string or a non-empty array of strings, up to 64 texts by default.
  • model is optional, but if you send it, it must equal the pinned model.
  • encoding_format, if present, must be float.

The model is chosen by the gateway and stays the same, because stored vectors only work with the model that made them. The response is {"object":"list","data":[{"object":"embedding","index","embedding":[...]}],"model","usage":{...}}.

Speech transcription#

POST /v1/audio/transcriptions takes multipart/form-data with a file field and the usual OpenAI fields such as model, language and response_format. The gateway streams the file and returns the transcription server's status and body unchanged. The size limit defaults to 300 MiB.

Each product has a queue lane. In the interactive lane a person is waiting; in the batch lane background work waits behind. A request waits for a free slot, and leaving the connection cancels it.

curl -sS "$BLACKGATE_URL"/v1/audio/transcriptions \
  -H "Authorization: Bearer $BLACKGATE_KEY" \
  -F file=@voice.ogg -F model=<speech model> -F response_format=verbose_json

Errors on these routes#

StatuserrorMeaning
400bad_requestMalformed body or field
413too_largeBody over the route's limit
502, 504upstream_error, timeoutThe model or server failed or was too slow
503not_configuredThe route is not set up
503model_unavailableThe embeddings model is not available

Embeddings and speech are not counted against the daily limits.