Video generation is moving fast, and developers now have more choice than ever in how they bring ideas to life. With fal models on Microsoft Foundry, you can go from a simple prompt to cinematic video, animate an existing image, or use reference content to guide the result. In this walkthrough, we’ll turn a single creative concept into a video campaign and show how to choose the right model at each step.
Building a compelling video experience rarely comes down to finding one model that does everything. Early in the creative process, you may want fast text-to-video generation to explore several directions. Once a composition is established, image-to-video can preserve the starting visual while adding motion. For more directed work, reference inputs can provide additional context from images, video, or audio.
Fal on Microsoft Foundry brings these workflows together through a family of video generation models available from the Foundry model catalog. In this tutorial, we build a practical product-campaign workflow that starts with a creative brief and moves through text-to-video, image-to-video, and reference-to-video modalities. Along the way, we show how to select a model for each step, submit asynchronous generation jobs, monitor their status, retrieve the completed video, and structure the code so that it can be reused across models.
The scenario: turn one creative brief into a coordinated campaign
Imagine that a creative team is introducing a compact premium travel speaker called Northstar. The team needs three short assets:
- A concept clip to test the campaign mood and visual language quickly.
- A polished hero clip that animates an approved product image.
- A campaign variation that uses reference material to reinforce the established product and audio direction.
The creative brief is intentionally specific enough to guide generation while leaving room for model interpretation:
Creative brief: A matte black portable speaker sits on a weathered stone ledge above a misty alpine lake at sunrise. The camera moves slowly toward the product. Soft wind moves nearby grass. The visual style is premium, cinematic, restrained, and realistic, with cool blues and warm sunrise highlights. Avoid text, logos, extra products, distorted geometry, and abrupt camera movement.
This is a useful application pattern because model choice follows the creative task instead of forcing every task through the same endpoint.
Choose the model and modality for the job
At the time of writing, fal on Microsoft Foundry includes five video models in public preview. All five support text-to-video and image-to-video. MiniMax H3 Max additionally supports reference-to-video. For comprehensive model details, please review the documentation.
|
Model |
Modalities |
Best fit in the scenario |
Deployment offering |
|
LTX 2.5 Fast |
Text-to-video; image-to-video |
Rapid concept exploration and iteration |
Global Standard PayGo |
|
LTX 2.5 Pro |
Text-to-video; image-to-video |
Higher-quality hero output after direction is approved |
Global Standard PayGo |
|
Kling v3 Pro |
Text-to-video; image-to-video |
Cinematic or multi-shot alternatives; native audio is available |
US Data Zone |
|
MiniMax H3 Max |
Text-to-video; image-to-video; reference-to-video |
Reference-guided campaign variation |
Global Standard PayGo |
|
MiniMax H3 Max Turbo |
Text-to-video; image-to-video |
Alternative fast generation path |
Global Standard PayGo |
How the asynchronous API workflow works
Video generation is asynchronous. A production-oriented client should treat submission, status polling, result retrieval, and download as distinct operations:
- Authenticate to the Foundry resource with a Microsoft Entra bearer token.
- Submit a generation request to the selected model and modality route.
- Capture the request_id returned by the service.
- Poll the status route until the job reaches a terminal state.
- Retrieve the completed result and extract the video URL.
- Download or securely process the generated asset before the result URL expires.
Prerequisites
- An Azure subscription.
- A Microsoft Foundry resource and project.
- Subscription Owner or Subscription Contributor access to enable the preview (Fal.EnableDeploy) feature.
- Foundry Owner access on the project to deploy models.
- Azure CLI installed and authenticated with az login.
- Python 3.10 or later with the requests package.
- Model deployments for the fal models used by the walkthrough.
- A publicly reachable HTTPS image URL for image-to-video examples, plus reference URLs for the reference-to-video example.
Enable fal and deploy the models
An administrator first enables the Fal.EnableDeploy preview feature for the Azure subscription. In the Azure portal, open the subscription, select Preview features, search for Fal.EnableDeploy, review the terms and data-handling disclosure, and register the feature. Registration can take up to 30 minutes.
After registration, open the Foundry model catalog, select each required fal model, choose Deploy, configure the deployment name and supported deployment offering, and wait until the deployment status is Succeeded.
Data handling: fal services are operated outside Microsoft facilities. Review the fal terms, data-egress implications, privacy requirements, and your organization’s compliance obligations before sending prompts or assets.
Note: All code samples in this walkthrough use Python and are intended to run in a Jupyter Notebook.
Set up the notebook environment
The companion notebook can be organized around a shared client so each scenario changes only the endpoint suffix and request payload.
%pip install -q requests
import json
import os
import subprocess
import time
from pathlib import Path
from typing import Any, Dict
import requests
Configure the resource and model deployment names. The deployment names must match the deployments in your Foundry project.
FOUNDRY_RESOURCE_NAME = os.environ.get(
"FOUNDRY_RESOURCE_NAME", "your-foundry-resource"
)
FOUNDRY_HOST = (
f"https://{FOUNDRY_RESOURCE_NAME}.services.ai.azure.com"
)
DEPLOYMENTS = {
"ltx_fast": os.environ.get("LTX_FAST_DEPLOYMENT", "ltx-2-5-fast"),
"ltx_pro": os.environ.get("LTX_PRO_DEPLOYMENT", "ltx-2-5-pro"),
"kling_pro": os.environ.get("KLING_PRO_DEPLOYMENT", "kling-v3-pro"),
"minimax_h3": os.environ.get("MINIMAX_H3_DEPLOYMENT", "minimax-h3-max"),
}
Authenticate for local development
This Python helper invokes Azure CLI as a subprocess. It is still Python, not a Bash sample.
def get_bearer_token() -> str:
command = [
"az", "account", "get-access-token",
"--scope", "https://cognitiveservices.azure.com/.default",
"--query", "accessToken",
"--output", "tsv",
]
token = subprocess.check_output(command, text=True).strip()
if not token:
raise RuntimeError("Azure CLI did not return an access token.")
return token
def auth_headers() -> Dict[str, str]:
return {
"Authorization": f"Bearer {get_bearer_token()}",
"Content-Type": "application/json",
}
Create the asynchronous generation client
Video generation is asynchronous. The client submits a job, polls its status, retrieves the result, and downloads the completed video.
FAILURE_STATES = {"FAILED", "CANCELED", "CANCELLED"}
def submit_generation(route: str, payload: Dict[str, Any]) -> str:
response = requests.post(
f"{FOUNDRY_HOST}{route}",
headers=auth_headers(),
json=payload,
timeout=120,
)
response.raise_for_status()
request_id = response.json().get("request_id")
if not request_id:
raise RuntimeError(f"No request_id returned: {response.text}")
return request_id
def wait_for_completion(request_root: str, request_id: str) -> None:
started = time.monotonic()
while True:
response = requests.get(
f"{FOUNDRY_HOST}{request_root}/requests/{request_id}/status",
headers=auth_headers(),
timeout=60,
)
response.raise_for_status()
body = response.json()
status = body.get("status", "UNKNOWN")
print(f"{request_id}: {status}")
if status == "COMPLETED":
return
if status in FAILURE_STATES:
raise RuntimeError(f"Generation ended with {status}: {body}")
if time.monotonic() - started > 1800:
raise TimeoutError(f"Timed out waiting for {request_id}")
time.sleep(5)
def get_result(request_root: str, request_id: str) -> Dict[str, Any]:
response = requests.get(
f"{FOUNDRY_HOST}{request_root}/requests/{request_id}",
headers=auth_headers(),
timeout=60,
)
response.raise_for_status()
return response.json()
def download_video(video_url: str, output_path: str) -> Path:
output = Path(output_path)
with requests.get(
video_url, headers=auth_headers(), stream=True, timeout=180
) as response:
response.raise_for_status()
with output.open("wb") as file:
for chunk in response.iter_content(1024 * 1024):
if chunk:
file.write(chunk)
return output
def run_generation(route, request_root, payload, output_path):
request_id = submit_generation(route, payload)
wait_for_completion(request_root, request_id)
result = get_result(request_root, request_id)
video_url = result.get("video", {}).get("url")
if not video_url:
raise RuntimeError(f"No video URL in result: {result}")
download_video(video_url, output_path)
return result
Step 1: Explore the concept with LTX 2.5 Fast
campaign_prompt = """
A premium matte black portable speaker on a weathered stone ledge
above a misty alpine lake at sunrise. Slow cinematic push-in.
Subtle wind moves the grass. Realistic premium advertising style.
No text, logos, duplicate products, warped geometry, or abrupt motion.
""".strip()
ltx_root = "/providers/falai/lightricks/ltx-2.5"
concept_result = run_generation(
route=f"{ltx_root}/text-to-video/fast",
request_root=ltx_root,
payload={
"model": DEPLOYMENTS["ltx_fast"],
"prompt": campaign_prompt,
"duration": 6,
"resolution": "720p",
"aspect_ratio": "16:9",
},
output_path="northstar_concept_ltx_fast.mp4",
)
Step 2: Animate the approved hero image
HERO_IMAGE_URL = "https://your-domain.example/northstar-hero.png"
hero_result = run_generation(
route=f"{ltx_root}/image-to-video/pro",
request_root=ltx_root,
payload={
"model": DEPLOYMENTS["ltx_pro"],
"prompt": (
"Preserve the product design. Add a slow stable camera push, "
"subtle drifting mist, and gentle grass movement. No text or cuts."
),
"image_url": HERO_IMAGE_URL,
"duration": 8,
"resolution": "1080p",
"aspect_ratio": "16:9",
},
output_path="northstar_hero_ltx_pro.mp4",
)
Step 3: Test a cinematic alternative with Kling v3 Pro
kling_root = "/providers/falai/kling/v3/pro"
kling_result = run_generation(
route=f"{kling_root}/text-to-video",
request_root=kling_root,
payload={
"model": DEPLOYMENTS["kling_pro"],
"prompt": campaign_prompt,
"duration": 6,
"aspect_ratio": "16:9",
},
output_path="northstar_kling_v3_pro.mp4",
)
Step 4: Add reference context with MiniMax H3 Max
minimax_root = "/providers/falai/minimax/h3-max"
reference_result = run_generation(
route=f"{minimax_root}/reference-to-video",
request_root=minimax_root,
payload={
"model": DEPLOYMENTS["minimax_h3"],
"prompt": (
"Preserve the product appearance and follow the visual pacing "
"and audio mood of the supplied references. No text or logos."
),
"references": [
{"type": "image", "url": "https://your-domain.example/hero.png"},
{"type": "video", "url": "https://your-domain.example/motion.mp4"},
{"type": "audio", "url": "https://your-domain.example/audio.wav"},
],
"duration": 8,
"resolution": "768P",
},
output_path="northstar_reference_minimax_h3.mp4",
)
Display outputs in the notebook
from IPython.display import Video, display
for path in [
"northstar_concept_ltx_fast.mp4",
"northstar_hero_ltx_pro.mp4",
"northstar_kling_v3_pro.mp4",
"northstar_reference_minimax_h3.mp4",
]:
print(path)
display(Video(path, embed=True, width=720))
Evaluate and operationalize the workflow
- Prompt adherence: subject, setting, camera direction, and exclusions.
- Identity and geometry: product consistency and physical plausibility.
- Temporal consistency: stable motion, lighting, reflections, and boundaries.
- Aesthetic fit: alignment with the intended campaign style.
- Operational fit: latency, supported resolution, duration, region, quota, and cost.
Production considerations
- Use bounded retries with exponential backoff for transient failures.
- Persist the request ID and last-known job state so polling can resume.
- Do not log tokens, signed URLs, or sensitive prompts.
- Move completed outputs to application-controlled storage before temporary links expire.
- Keep payload construction in model-specific adapters because schemas differ.
Managed identity for hosted applications
Language: Python
from azure.identity import DefaultAzureCredential
credential = DefaultAzureCredential()
token = credential.get_token(
"https://cognitiveservices.azure.com/.default"
).token
Troubleshooting
- 401 or 403: verify token scope, project role, and preview registration.
- 404: verify the provider, version, model, and modality path.
- 400: validate every payload field against the selected model schema.
- Queued job: continue bounded polling and confirm quota and capacity.
- Unreadable input: verify that the HTTPS asset URL is reachable and unexpired.
- Missing video URL: inspect the sanitized result and update model-specific parsing.
Build around the creative goal
The application does not need to be designed around one model. Start with fast text-to-video exploration, move to image-to-video when the composition is approved, and add references when the creative direction needs more context. The companion notebook provides a practical starting point for adapting the prompts, assets, routes, and generation parameters to your own scenario.
Conclusion
Generative video workflows don't need to be built around a single model or generation technique. With fal models on Microsoft Foundry, you can choose the model and modality that best fit each stage of your application, from quickly exploring ideas with text-to-video to bringing existing visuals to life with image-to-video and adding greater creative direction with reference inputs.
In this walkthrough, we showed how those capabilities can come together in a practical, multi-model workflow using Python and Jupyter Notebook. Use the companion notebook to try the examples yourself, experiment with different models and prompts, and adapt the workflow to your own creative scenarios.
Appendix
API routes for fal video models
Each fal model exposes a route for its supported video generation modalities. Replace {FOUNDRY_RESOURCE_NAME} with the name of your Microsoft Foundry resource.
Asynchronous request routes
After submitting a generation request, the service returns a request_id. Use that identifier to monitor and retrieve the generation job.
| Operation | HTTP method | Route pattern |
|---|---|---|
| Submit a generation request | POST | {BASE_URL}/{MODALITY} |
| Check request status | GET | {BASE_URL}/requests/{REQUEST_ID}/status |
| Retrieve the completed result | GET | {BASE_URL}/requests/{REQUEST_ID} |
| Download the generated video | GET | Use the URL returned in video.url |
For example, a MiniMax H3 Max text-to-video request uses the following URLs:
- Submit: {BASE_URL}/text-to-video
- Check status: {BASE_URL}/requests/{REQUEST_ID}/status
- Retrieve result: {BASE_URL}/requests/{REQUEST_ID}
Where BASE_URL is:
https://{FOUNDRY_RESOURCE_NAME}.services.ai.azure.com/providers/falai/minimax/h3-max
Video generation is asynchronous, so the initial request does not return the completed video. Retrieve the completed result, extract the generated video location from the response, and download or process the asset using the authorization requirements returned or documented for that model.
Resources
Microsoft Learn: Fal models on Microsoft Foundry (preview)
GitHub Samples: https://aka.ms/model-releases