> ## Documentation Index
> Fetch the complete documentation index at: https://www.truefoundry.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Video Generation API (/videos-proxy)

> Forward native video-generation requests from Google Vertex AI, Google Gemini, and ComfyUI through TrueFoundry AI Gateway.

**API Reference:** [`POST /videos-proxy/{providerAccountName}/{nativePath}`](/docs/api-reference/video/generate-video)

## Provider capabilities

The table below summarizes gateway support for video generation by provider.

<Info>
  Legend:

  * **✅** Supported by provider and TrueFoundry
  * <Icon icon="circle-xmark" iconType="regular" color="red" /> Provided by provider, but not supported by TrueFoundry
  * <Icon icon="circle-minus" iconType="regular" /> Provider does not support this feature
</Info>

| Provider            | Native video requests | Tracing | Cost tracking                                   |
| ------------------- | --------------------- | ------- | ----------------------------------------------- |
| Google Vertex AI    | **✅**                 | **✅**   | **✅**                                           |
| Google Gemini       | **✅**                 | **✅**   | **✅**                                           |
| Self-hosted ComfyUI | **✅**                 | **✅**   | <Icon icon="circle-minus" iconType="regular" /> |

## Supported providers

| Provider            | Model setup                                                       | Model identification                                                            | Cost tracking                   |
| ------------------- | ----------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------- |
| Google Vertex AI    | Add the video model to a Google Vertex model account              | Model ID in the native submit URL; `x-tfy-model-name` for polling and downloads | Supported for video submissions |
| Google Gemini       | Add the video model to a Google Gemini model account              | Model ID in the native submit URL; `x-tfy-model-name` for polling and downloads | Supported for video submissions |
| Self-hosted ComfyUI | Add a self-hosted model with **ComfyUI** as the model server type | `x-tfy-model-name` on every request                                             | Not tracked by the AI Gateway   |

The Video Generation API is a provider-native blind proxy. The AI Gateway forwards the request path and body to the provider without translating the request to an OpenAI `/videos` schema.

**Gateway endpoint:** `{GATEWAY_BASE_URL}/videos-proxy/{providerAccountName}/...`

## Before you start

1. Create the provider or self-hosted model account in the TrueFoundry dashboard.
2. Add the video model to the account.
3. Make sure the caller has permission to use the provider account and model.
4. Replace `{GATEWAY_BASE_URL}` and `your-truefoundry-api-key` in the examples.

<Note>
  The gateway forwards the provider's native request and response format. It does not convert requests to the OpenAI video API format.
</Note>

## Google Vertex AI and Google Gemini

For POST submissions, use the provider's official native video-generation URL after the gateway provider-account path. The model ID is part of that URL, not a `model` field in the JSON body.

### Submit a video-generation request

The request body uses the native Vertex AI or Gemini shape:

```bash Vertex AI theme={"dark"}
export GATEWAY_BASE_URL="https://llm.example.com"
export TFY_API_KEY="your-truefoundry-api-key"
export VERTEX_ACCOUNT="vertex-main"
export PROJECT_ID="your-gcp-project"
export LOCATION="us-central1"
export MODEL_ID="veo-3.0-generate-001"

curl --request POST \
  "${GATEWAY_BASE_URL}/videos-proxy/${VERTEX_ACCOUNT}/v1/projects/${PROJECT_ID}/locations/${LOCATION}/publishers/google/models/${MODEL_ID}:predictLongRunning" \
  --header "Authorization: Bearer ${TFY_API_KEY}" \
  --header "Content-Type: application/json" \
  --data '{
    "instances": [
      {
        "prompt": "A slow aerial shot of waves breaking on a rocky coastline at sunrise"
      }
    ],
    "parameters": {
      "aspectRatio": "16:9",
      "durationSeconds": 8,
      "resolution": "1080p",
      "generateAudio": true,
      "sampleCount": 1
    }
  }'
```

```bash Gemini theme={"dark"}
export GATEWAY_BASE_URL="https://llm.example.com"
export TFY_API_KEY="your-truefoundry-api-key"
export GEMINI_ACCOUNT="gemini-main"
export MODEL_ID="veo-3.0-generate-preview"

curl --request POST \
  "${GATEWAY_BASE_URL}/videos-proxy/${GEMINI_ACCOUNT}/v1beta/models/${MODEL_ID}:predictLongRunning" \
  --header "Authorization: Bearer ${TFY_API_KEY}" \
  --header "Content-Type: application/json" \
  --data '{
    "instances": [
      {
        "prompt": "A slow aerial shot of waves breaking on a rocky coastline at sunrise"
      }
    ],
    "parameters": {
      "aspectRatio": "16:9",
      "durationSeconds": 8,
      "resolution": "1080p",
      "generateAudio": true,
      "sampleCount": 1
    }
  }'
```

The provider returns its native long-running operation response. Use the operation path from that response for subsequent polling requests.

### Poll or download the result

For a follow-up request, use the exact native method, path, and body required by the provider. Include the full TrueFoundry model name in `x-tfy-model-name` when the follow-up URL does not identify the model.

```bash theme={"dark"}
export TFY_MODEL_NAME="vertex-main/veo-3.0-generate-001"
export NATIVE_FOLLOW_UP_PATH="the-native-operation-path"

curl --request GET \
  "${GATEWAY_BASE_URL}/videos-proxy/vertex-main/${NATIVE_FOLLOW_UP_PATH}" \
  --header "Authorization: Bearer ${TFY_API_KEY}" \
  --header "x-tfy-model-name: ${TFY_MODEL_NAME}"
```

Use the native path and method required by the provider for polling or retrieving video content. The gateway returns the provider response without transforming it.

## Self-hosted ComfyUI

Register the self-hosted model with **ComfyUI** as its model server type and provide the ComfyUI server URL. ComfyUI requests require the full TrueFoundry model name in `x-tfy-model-name` because native ComfyUI paths such as `/prompt`, `/history/{prompt_id}`, and `/view` do not contain a model ID.

### Submit a ComfyUI workflow

Send the exact request body expected by your ComfyUI server. The gateway does not build, validate, or rewrite the workflow graph.

```bash theme={"dark"}
export GATEWAY_BASE_URL="https://llm.example.com"
export TFY_API_KEY="your-truefoundry-api-key"
export COMFYUI_ACCOUNT="comfyui-main"
export TFY_MODEL_NAME="${COMFYUI_ACCOUNT}/wan-video"

curl --request POST \
  "${GATEWAY_BASE_URL}/videos-proxy/${COMFYUI_ACCOUNT}/prompt" \
  --header "Authorization: Bearer ${TFY_API_KEY}" \
  --header "Content-Type: application/json" \
  --header "x-tfy-model-name: ${TFY_MODEL_NAME}" \
  --data-binary @comfyui-prompt.json
```

The request body and response are passed through in their native ComfyUI format. ComfyUI requests are not cost-tracked or budgeted by the AI Gateway.

### Poll and retrieve video content

Use the native ComfyUI paths and include the same model header:

```bash theme={"dark"}
export PROMPT_ID="your-comfyui-prompt-id"

curl --request GET \
  "${GATEWAY_BASE_URL}/videos-proxy/${COMFYUI_ACCOUNT}/history/${PROMPT_ID}" \
  --header "Authorization: Bearer ${TFY_API_KEY}" \
  --header "x-tfy-model-name: ${TFY_MODEL_NAME}"
```

When the ComfyUI history response identifies an output file, request it through the native `/view` path:

```bash theme={"dark"}
curl --request GET \
  "${GATEWAY_BASE_URL}/videos-proxy/${COMFYUI_ACCOUNT}/view?filename=output.mp4&subfolder=&type=output" \
  --header "Authorization: Bearer ${TFY_API_KEY}" \
  --header "x-tfy-model-name: ${TFY_MODEL_NAME}" \
  --output output.mp4
```

## Request and response handling

* The gateway preserves the provider-native URL suffix, request body, status code, and response body.
* Video responses are returned as streams; the gateway does not parse or buffer large video payloads.
* Vertex AI and Gemini POST submissions use the model ID in the native URL.
* Vertex AI, Gemini, and ComfyUI polling or content-download requests use `x-tfy-model-name` to resolve the registered model.
