Nothing to call. The clip is produced by a model session handed to the run under the name video.
Declaring it
const writer = await api.models.create({ model: "gemini-3.5-flash" });
const filmer = await api.models.create({
model: "veo-3.1",
settings: { duration: 4, resolution: "720p", audio: true },
});
const agent = api.agents.create({
model: { main: writer, video: filmer },
tools: { video: api.tools.video },
budget: 400,
});writer = api.models.create(model="gemini-3.5-flash")
filmer = api.models.create(
model="veo-3.1",
settings={"duration": 4, "resolution": "720p", "audio": True},
)
agent = api.agents.create(
model={"main": writer, "video": filmer},
tools={"video": api.tools.video},
budget=400,
)What the model sends
promptstringrequiredWhat to create — the scene, in one argument.
Duration, resolution and audio are the session's settings, not the model's choice: they determine the price, so they are decided where you can see them.
It picks up the last image of the run
If the run has produced an image, the most recent one is passed as the clip's first frame. So « draw the logo, then animate it » works with both tools declared and nothing else — and the model does not have to carry an image through its own context.
tools: {
image: api.tools.image,
video: api.tools.video, // starts from whatever image came before
}tools = {
"image": api.tools.image,
"video": api.tools.video, # starts from whatever image came before
}Where the clip goes
const [clip] = run.artifacts.filter((a) => a.type === "video");
await pc.files.write("Assets/intro.mp4", Buffer.from(clip.content, "base64"));import base64
clip = next(a for a in run["artifacts"] if a["type"] == "video")
pc.files.write("Assets/intro.mp4", base64.b64decode(clip["content"]))The declared cost is 85
Video is the most expensive thing a run can do, and the guard refuses on the declared number before the call. 85 is a deliberate over-estimate: a clip can come back longer than it was asked for, and a figure that merely matched the expected length would let a run pass its budget.
| Setting | Who decides | Why |
|---|---|---|
| duration | the session | It is what the price is per. |
| resolution | the session | It changes the price. |
| audio | the session | Only some models have it. |
| prompt | the model | It is the only creative decision. |
It takes minutes, not seconds
Generation is a long operation, polled to completion. A run with video declared needs a maxSteps and a patience to match — and the call carries no client-side timeout, because abandoning it would pay for a clip you never receive.
Set a budget you mean
const agent = api.agents.create({
model: { main: writer, video: filmer },
tools: { video: { run: api.tools.video, cost: 120 } },
budget: 400, // three clips at most, whatever the model intends
});agent = api.agents.create(
model={"main": writer, "video": filmer},
tools={"video": {"run": api.tools.video, "cost": 120}},
budget=400, # three clips at most, whatever the model intends
)