Skip to main content

Overview

MachGen serves video and image models (MiniMax H3, Kling, Seedance, Wan, FLUX and more) behind one task-based API. Every request is a task: Bifrost submits it to POST /api/v0/generate, then reads its status and output through the task and asset endpoints.

Supported Operations

Model IDs are MachGen’s own, for example machgen/MiniMax-H3 or machgen/Kling-v3. GET /v1/models lists the models your MachGen key can use, with each one’s task types (T2V, I2V, T2I, …) in supported_methods. See MachGen models for what each model accepts.

1. Video Generation

Generate (POST /v1/videos)

Request Parameters The width in size must match one of MachGen’s aspect ratios (16:9, 9:16, 1:1, 4:3, 3:4, 4:5, 3:2, 2:3, 21:9), give or take a pixel of rounding. Most models need a height, so send size unless you set video_config yourself. Allowed durations and sizes differ per model; a value the model does not support is rejected with a 400 that names the allowed values. Extra Params These MachGen fields have no unified equivalent, so Bifrost reads them from extra params: Any other MachGen field (for example video_config.fps or reference_video_operation) is forwarded when extra-params passthrough is enabled. Generation Modes (auto-detected from inputs)
  • Text-to-video (T2V): prompt only
  • Image-to-video (I2V): prompt + input_reference (or src_image_urls: a start frame and optional end frame)
  • Reference-to-video (R2V): any reference video or audio, or any subject_to_*_ids map
Response: BifrostVideoGenerationResponse with id, status, videos[] Bifrost statuses (normalized): queued -> in_progress -> completed / failed MachGen’s native statuses are PENDING, RUNNING, COMPLETED and FAILED. A failed task carries MachGen’s error_msg in error.message. A few MachGen models have a second name. For those, model on a retrieved video is MachGen’s internal id, for example MiniMax-H3-MultiMax for a video requested as MiniMax-H3-Turbo. Image responses always carry the model you asked for, without the machgen/ prefix: a request for machgen/FLUX.2-dev returns FLUX.2-dev.

Retrieve / Download

MachGen asset URLs need your MachGen API key, so download through Bifrost rather than from videos[].url directly.

2. Image Generation and Edit

POST /v1/images/generations runs a T2I task, or I2I when input_images are given. POST /v1/images/edits runs I2I. Images for I2I must be public http(s) URLs. Uploaded image bytes and inline data: URLs are rejected with a 400, and the same applies to every image, video and audio source on video requests. Bifrost waits for the task to finish and returns the image as b64_json. The wait is bounded by the provider’s request timeout, so raise network_config.default_request_timeout_in_seconds for slower models.

Setup & Configuration

Get an API key (it starts with MGA_) from your MachGen profile.
  1. Navigate to Models > Model Providers. Look for MachGen under Configured Providers. If it is missing, click on Add New Provider and select MachGen.
  2. Click Add Key or edit an existing key.
  3. Set a name for your key.
  4. Paste your API key directly or use an environment variable (for example, env.MACHGEN_API_KEY).
  5. Set Allowed Models to All Models (default) or the specific model allowlist you want this key to serve.
  6. Save the provider configuration.