Skip to main content

LlamaIndex Tools Integration: WaveSpeed

PyPI

WaveSpeedToolSpec gives a LlamaIndex agent access to the WaveSpeed AI inference platform: text-to-image and text-to-video generation, running any model in the catalog by id, and recovering a long-running job from its prediction id.

It is built on the official wavespeed Python SDK, so it inherits the SDK's submission semantics — a submission POST is never retried, terminal statuses (failed / cancelled / timeout) are handled explicitly, and every request carries channel attribution.

Installation

pip install llama-index-tools-wavespeed
export WAVESPEED_API_KEY="your-api-key"   # https://wavespeed.ai

Tools

Tool What it does
generate_image Text to image. Default model bytedance/seedream-v5.0-pro. Accepts resolution and aspect_ratio.
generate_video Text to video. Default model bytedance/seedance-2.5/text-to-video. Accepts duration.
run_model Runs any model id with an arbitrary input dict — image editing, upscaling, image-to-video, speech, and so on. See https://wavespeed.ai/models.
get_prediction Fetches an earlier prediction by id. Video jobs routinely outlive a single tool call; when one times out the error carries a task_id the agent can pass here.

Each tool returns the output URL(s), one per line, or a string starting with Error: that carries the prediction id and the platform's own error text.

Usage

import asyncio

from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI
from llama_index.tools.wavespeed import WaveSpeedToolSpec

tool_spec = WaveSpeedToolSpec()  # reads WAVESPEED_API_KEY
# or: WaveSpeedToolSpec(api_key="...")

agent = FunctionAgent(
    tools=tool_spec.to_tool_list(),
    llm=OpenAI(model="gpt-4.1"),
)

response = asyncio.run(
    agent.run("Generate a 16:9 image of a red panda drinking boba tea.")
)
print(response)

ReActAgent works the same way:

from llama_index.core.agent.workflow import ReActAgent

agent = ReActAgent(tools=tool_spec.to_tool_list(), llm=OpenAI(model="gpt-4.1"))

You can also call the tools directly, without an agent:

tool_spec = WaveSpeedToolSpec()
print(tool_spec.generate_image("a lighthouse at dusk", aspect_ratio="16:9"))
print(tool_spec.run_model("wavespeed-ai/z-image/turbo", {"prompt": "a fox"}))

Configuration

WaveSpeedToolSpec(
    api_key=None,  # else WAVESPEED_API_KEY
    image_model="bytedance/seedream-v5.0-pro",
    video_model="bytedance/seedance-2.5/text-to-video",
    timeout=600.0,  # None waits forever
    poll_interval=2.0,
)

The default 600s timeout is deliberate: an unbounded wait would strand the calling agent. When a video job exceeds it, the task keeps running server-side — take the task_id out of the error and call get_prediction.

The underlying SDK client is created with max_retries=0 so a single tool call can never turn into a second, separately billed submission.

Why size and seed are not exposed

The platform's input whitelist silently drops parameters the default models do not declare. Advertising them in an LLM-facing schema would invite the agent to set values that are then ignored, so generate_image and generate_video expose only parameters that actually take effect. If a specific model you pick does support them, pass them through run_model.

A note on discovery

llamahub.ai is generated from metadata in the run-llama/llama_index monorepo, which no longer accepts new integration packages. This package is therefore not listed on LlamaHub. It is a normal PyPI distribution that installs into the llama_index.tools namespace package and works exactly like the official tool specs.

Development

uv sync --all-groups   # or: pip install -e . pytest ruff
pytest tests
ruff check .

The test suite mocks the SDK client and never calls the live API.

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llama_index_tools_wavespeed-0.1.0.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llama_index_tools_wavespeed-0.1.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file llama_index_tools_wavespeed-0.1.0.tar.gz.

File metadata

File hashes

Hashes for llama_index_tools_wavespeed-0.1.0.tar.gz
Algorithm Hash digest
SHA256 554f637d314788b33f3743a02d149f95b06aecc879bff4c6a43f7d355e521a80
MD5 064ad9a65c07787aa48d609ac6da7506
BLAKE2b-256 6067b9ac89f927790a5a29b0c580c90f3741af5cc66804bacba5cda24015e3da

See more details on using hashes here.

Provenance

The following attestation bundles were made for llama_index_tools_wavespeed-0.1.0.tar.gz:

Publisher: python-publish.yml on WaveSpeedAI/llama-index-tools-wavespeed

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file llama_index_tools_wavespeed-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_tools_wavespeed-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cf00467d805734e3f5ed2180b346322957cd55f866fbd32453fc21c748fd56fa
MD5 0933f56e425bc43bc15542057a7d5215
BLAKE2b-256 c4338c7496bd4f898e1795600ae23d29f9fe8cc2c88164d334628898884e78b8

See more details on using hashes here.

Provenance

The following attestation bundles were made for llama_index_tools_wavespeed-0.1.0-py3-none-any.whl:

Publisher: python-publish.yml on WaveSpeedAI/llama-index-tools-wavespeed

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page