Skip to main content

Generate images, speech and video

Proxium serves three media APIs with your virtual key. Each one calls one vendor, with no failover.

RouteMakesAnswer
POST /v1/images/generationsOne imageJSON, with the image as base64 in data[0].b64_json
POST /v1/audio/speechSpeech from textThe audio bytes, audio/mpeg by default
POST /video/generationsA video, in three stepsAn operation to poll

The video routes have no /v1. Their URL is https://proxium.tech/video/….

Before you start​

Your project needs a vendor of the right request type: Images, Speech or Video. To add one, select that Request type when you add a server. See Add vendors and your own keys.

In model, send a model id of that vendor, such as t.acme.my-images/flux.1-schnell. A tier name also works, if Routing has a chain for it.

Generate an image​

Terminal
curl https://proxium.tech/v1/images/generations \
-H "Authorization: Bearer $PROXIUM_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "t.acme.my-images/flux.1-schnell", "prompt": "a lighthouse at dawn", "size": "1024x1024"}' \
| jq -r '.data[0].b64_json' | base64 -d > lighthouse.png
FieldDefault
prompt—
size1024x1024
n1

Proxium returns the image in this shape for each vendor.

Generate speech​

Terminal
curl https://proxium.tech/v1/audio/speech \
-H "Authorization: Bearer $PROXIUM_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "t.acme.my-voice/tts-1", "input": "Your order has shipped.", "voice": "alloy"}' \
--output order.mp3

voice is alloy when you leave it out.

Generate a video​

A video takes minutes, so it has three steps:

1POST /video/generationsProxium starts the video. You get operation and provider
2POST /video/operationsSend it again until done is true. Then you get video_uri
3POST /video/downloadYou get the video bytes
  1. Start the video:
Terminal
curl https://proxium.tech/video/generations \
-H "Authorization: Bearer $PROXIUM_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "video", "prompt": "waves on a rocky shore", "aspect_ratio": "16:9", "duration": "8"}'

The answer has operation and provider.

  1. Poll the operation with both values, until it is done:
Terminal
curl https://proxium.tech/video/operations \
-H "Authorization: Bearer $PROXIUM_KEY" \
-H "Content-Type: application/json" \
-d '{"operation": "<operation>", "provider": "<provider>"}'

When done is true, the answer has video_uri.

  1. Download the video:
Terminal
curl https://proxium.tech/video/download \
-H "Authorization: Bearer $PROXIUM_KEY" \
-H "Content-Type: application/json" \
-d '{"uri": "<video_uri>", "provider": "<provider>"}' \
--output waves.mp4
warning

Each poll and each download uses one call of your ceilings. Do not poll more often than you need.

The video routes call the Google video API. Proxium refuses an operation or a uri that is not on a Google API host, with 400 forbidden_target.

What these routes do not do​

Media routes
Failover to another modelNo. A failure goes to your app. Retry it in your app
x-proxium-timeout-msNot read
Response cacheNo
Row in the Attempt log of RequestsYes, one row for each call. A failed call also shows in What failed. The drill-down stores the request and an error text, never the image, the audio or the video
CostFrom the usage block of the vendor, when it sends one. Else the call is recorded at $0
  • API reference: every field of the three routes.
  • Errors: no_route, bad_model and the other media errors.