Give your LlamaIndex agent images and video

llama-index-tools-treza is a tool spec for LlamaIndex. An agent calls it to make a picture, make a video clip or run one of your Treza pipelines, and gets back the finished file's link and what it cost.

llama-index-tools-treza on PyPI

Free to add. You pay only for what you make.

Set it up in LlamaIndex

Install the package

Python 3.10 or newer, with llama-index-core 0.12 or newer.

  1. 1

    Install it

    Add the package to the environment your agent runs in.

    pip
    pip install -U llama-index-tools-treza
  2. 2

    Add your Treza API key

    Make a key on the Treza API keys page with the pipelines:read, pipelines:write and pipelines:run permissions. It starts with treza_live_. Set it as TREZA_API_KEY, or pass api_key in your code.

    Shell
    export TREZA_API_KEY="treza_live_..."
  3. 3

    Call one tool

    Each tool returns JSON with the file's link, its status, the price and the model.

    Python
    from llama_index.tools.treza import TrezaToolSpec
    
    treza = TrezaToolSpec(max_cost_usd=1.00)
    print(treza.generate_video("A red fox trots through fresh snow", aspect_ratio="9:16", duration_sec=4))
  4. 4

    Or give them all to an agent

    to_tool_list turns the spec into tools. Pass the list to your agent with the model you already use.

    Python
    from llama_index.tools.treza import TrezaToolSpec
    
    tools = TrezaToolSpec(max_cost_usd=1.00).to_tool_list()

What the tools do

  1. 1

    generate_image and generate_video

    The model writes the prompt and picks the shape, and for video the length and whether it has sound. Links to pictures in your Treza library can be references for an image, or the first and last frame of a clip.

  2. 2

    run_pipeline

    Starts a pipeline you built in Treza with the inputs the model passes in, and returns everything it made.

  3. 3

    get_run

    Looks a render up by its IDs. A video that takes longer than the tool waits comes back as still running, not as an error, and this picks it up. Free.

  4. 4

    get_balance

    The credits left on your Treza account. Free.

Agents to start from

Each one is the tool spec plus the model and tools you already use.

A clip from a brief

An agent with generate_video turns "a 4 second vertical clip of a fox in snow" into a finished MP4 link.

A picture, then the clip

The agent makes a picture with generate_image and passes its link as first_frame_url to generate_video.

Illustrate what it retrieved

An agent with a query engine over your documents and generate_image answers a question and makes a picture for the answer.

Only some of the tools

to_tool_list(spec_functions=["generate_image", "get_balance"]) hands over the image tool and the balance check and nothing else.

Questions

What does it cost?

The package is free and MIT licensed. Renders spend prepaid credits from your Treza balance, with no subscription. Set max_cost_usd in your code: Treza prices the render first, and when the price is higher the tool tells the agent so and nothing is spent.

Can the agent raise the price cap?

No. max_cost_usd and the API key are set in your code and are not part of what the model sees or fills in. With no cap set, a render runs at its quoted price as long as your balance covers it, so set one for an agent.

What about videos that take minutes?

Each tool waits up to wait_seconds, 300 by default. A render still going after that comes back with status running and its IDs, and nothing is started twice. The get-run tool returns the file once it is done.

Do I need an API key?

Yes. An agent runs without you signing in, so it uses a key from the API keys page instead of Google. Delete the key there to cut it off.

Do my videos and credits carry over between apps?

Yes. Every app signs in to the same Treza account, so your library, your pipelines and your balance are the same in ChatGPT, Claude, Muse, Gemini, Cursor, Codex, Hermes Agent, Blender, n8n, Zapier, Dify, Gumloop and on trezalabs.com.

LlamaIndex is a trademark of LlamaIndex. Treza is an independent product and is not affiliated with or endorsed by LlamaIndex.

Setup steps from llama-index-tools-treza on GitHub, LlamaIndex Docs: Tools.