api.tools

video

tools: { video: api.tools.video }, model: { main, video }

Lets a run generate a short video, starting from an image the run already made when there is one. A declaration resolved against a session named video.

declaration onlyneeds a video sessiondeclared cost 85
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

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

promptstringrequired

What 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

No argument carries it, and none has to

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.

SettingWho decidesWhy
durationthe sessionIt is what the price is per.
resolutionthe sessionIt changes the price.
audiothe sessionOnly some models have it.
promptthe modelIt 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
)