Skip to main content

langchain-wavespeed

LangChain integration for WaveSpeed AI — run state-of-the-art image and video generation models from your LangChain agents and chains.

Installation

pip install -U langchain-wavespeed

Set your API key (get one at wavespeed.ai):

export WAVESPEED_API_KEY="your-api-key"

Tools

WaveSpeedImageGeneration

Generate images from text prompts (defaults to bytedance/seedream-v5.0-pro):

from langchain_wavespeed import WaveSpeedImageGeneration

tool = WaveSpeedImageGeneration()
url = tool.invoke(
    {
        "prompt": "A red panda drinking boba tea, studio lighting",
        "resolution": "2k",      # optional: "1k" | "1.5k" | "2k"
        "aspect_ratio": "16:9",  # optional
    }
)
print(url)  # https://.../output.png

WaveSpeedVideoGeneration

Generate videos from text prompts (defaults to bytedance/seedance-2.5/text-to-video, the same default as the WaveSpeed CLI and MCP server; pass model="wavespeed-ai/minimax-h3/text-to-video" for a lower price):

from langchain_wavespeed import WaveSpeedVideoGeneration

tool = WaveSpeedVideoGeneration()
url = tool.invoke({"prompt": "A drone shot over a glacier at sunrise", "duration": 5})

WaveSpeedRunModel

Run any model on the WaveSpeed platform by id (browse the catalog at wavespeed.ai/models):

from langchain_wavespeed import WaveSpeedRunModel

tool = WaveSpeedRunModel()
url = tool.invoke({
    "model": "wavespeed-ai/z-image/turbo",
    "input": {"prompt": "A lighthouse at dusk"},
})

Use with an agent

from langchain.agents import create_agent
from langchain_wavespeed import WaveSpeedImageGeneration, WaveSpeedVideoGeneration

agent = create_agent(
    "openai:gpt-5",
    tools=[WaveSpeedImageGeneration(), WaveSpeedVideoGeneration()],
)
result = agent.invoke(
    {"messages": [{"role": "user", "content": "Make me a picture of a corgi surfing."}]}
)

Configuration

All tools accept:

Parameter Default Description
api_key WAVESPEED_API_KEY env var WaveSpeed API key
model tool-specific Model id to run (image/video tools)
timeout None Optional max seconds to wait for a prediction (unset: no short cap, long tasks can run for hours)
poll_interval 2.0 Seconds between result polls

When a prediction fails or times out, the tool raises ToolException with the platform's error text and the task id, so a paid task stays traceable (and an agent can read the failure instead of crashing the run). A timeout only stops the waiting - the task keeps running server-side.

await tool.ainvoke(...) works, but note that the underlying WaveSpeed SDK is synchronous: LangChain runs the blocking call in a worker thread, so it will not block your event loop, but it is not natively async I/O.

License

MIT


WaveSpeed AI — AI image & video generation platform. Try it in the browser: Image generator · Video generator

Metadata

Release files for langchain-wavespeed 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langchain-wavespeed 0.1.4
File Size Uploaded Provenance Actions
langchain_wavespeed-0.1.4.tar.gz 8.8 kB With provenance Details for langchain_wavespeed-0.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for langchain-wavespeed 0.1.4
File Interpreter ABI Platform Actions
langchain_wavespeed-0.1.4-py3-none-any.whl Python 3 none any Details for langchain_wavespeed-0.1.4-py3-none-any.whl

Total release size: 15.8 kB

Release files / langchain_wavespeed-0.1.4.tar.gz

Download URL langchain_wavespeed-0.1.4.tar.gz
Size 8.8 kB
Tags Source
SHA-256 checksum
How to use checksums
6a61c0b1faab1c33b20affaf6e06efd4b48b78c21b8cc07bda2a9da0b669af20
BLAKE2b-256 checksum
How to use checksums
dc734ba63ad54b012025c058d78ba79be96fb4e583610e23a7216958a66d053e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

Release files / langchain_wavespeed-0.1.4-py3-none-any.whl

Download URL langchain_wavespeed-0.1.4-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5eb0b953a6049e8b8f730dda1e5be1f8c0420b1999136f921b6642719ce08f83
BLAKE2b-256 checksum
How to use checksums
a3266c226aec34a114b28fbc2b6034da4023d184c033645659af085b20f88acb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

Security for langchain-wavespeed 0.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for langchain_wavespeed-0.1.4.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page