bn-router

Image & video API

Generate images and video through the same unified endpoint using the OpenAI-compatible images format.

Endpoint

Image and video generation share a single endpoint. Send a POST request with your prompt, and the gateway routes to the best available upstream account.

Endpoint
POST https://YOUR-BASE-URL/v1/images/generations

Image generation

Generate images from a text description. The request follows the OpenAI images/generations format. Supported models include Flux Pro, DALL·E 3, Stable Diffusion 3, and more — all available through the same endpoint.

Set model to any image model ID from the model plaza. The response contains one or more generated image URLs.

curl
curl https://YOUR-BASE-URL/v1/images/generations \
  -H "Authorization: Bearer sk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "flux-pro",
    "prompt": "A serene mountain lake at sunrise, photorealistic",
    "n": 1,
    "size": "1024x1024"
  }'

Image edits

Edit an existing image by providing a mask and a new prompt. Send a multipart/form-data request with the image, mask, and prompt fields.

Only models that support inpainting accept edits. Check the model plaza for edit-compatible models.

curl
curl https://YOUR-BASE-URL/v1/images/edits \
  -H "Authorization: Bearer sk-your-api-key" \
  -F "image=@./input.png" \
  -F "mask=@./mask.png" \
  -F "prompt=Replace the background with a futuristic cityscape" \
  -F "n=1" \
  -F "size=1024x1024"

Video generation

Generate short-form video from a text or image prompt. The same endpoint and authentication work for video models. Response times are longer due to the computational cost of video generation.

Video support is expanding rapidly. Check the model plaza for the latest available video models.

curl
curl https://YOUR-BASE-URL/v1/images/generations \
  -H "Authorization: Bearer sk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "sora-2",
    "prompt": "A cinematic aerial view of a futuristic city at night",
    "n": 1,
    "size": "1920x1080"
  }'

Usage & billing

Image and video requests are billed per generation at the rates shown in the model plaza. Image dimensions (size), quality (hd/standard), and the number of images requested affect the token cost.

Usage is tracked in the dashboard alongside text completions, so you have a single view of all gateway activity.