Generate images, speech and video
Proxium serves three media APIs with your virtual key. Each one calls one vendor, with no failover.
| Route | Makes | Answer |
|---|---|---|
POST /v1/images/generations | One image | JSON, with the image as base64 in data[0].b64_json |
POST /v1/audio/speech | Speech from text | The audio bytes, audio/mpeg by default |
POST /video/generations | A video, in three steps | An 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
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
| Field | Default |
|---|---|
prompt | — |
size | 1024x1024 |
n | 1 |
Proxium returns the image in this shape for each vendor.
Generate speech
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:
- Start the video:
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.
- Poll the operation with both values, until it is done:
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.
- Download the video:
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
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 model | No. A failure goes to your app. Retry it in your app |
x-proxium-timeout-ms | Not read |
| Response cache | No |
| Row in the Attempt log of Requests | Yes, 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 |
| Cost | From the usage block of the vendor, when it sends one. Else the call is recorded at $0 |
Related pages
- API reference: every field of the three routes.
- Errors:
no_route,bad_modeland the other media errors.