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):

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 600.0 Max seconds to wait for a prediction (None waits forever)
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

Download files

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

Source Distribution

langchain_wavespeed-0.1.1.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

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

langchain_wavespeed-0.1.1-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file langchain_wavespeed-0.1.1.tar.gz.

File metadata

  • Download URL: langchain_wavespeed-0.1.1.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for langchain_wavespeed-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7f12a932da026f5256d0a6a20b4d8470332976af422ddfb7656a94e8ff78b2c8
MD5 c067d13df10d46b70dc2b80d7f5b8089
BLAKE2b-256 5929d34d15c51fbd0bb9c68880dcad2af617e084a262a9605c9eb5b08d0a58e2

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_wavespeed-0.1.1.tar.gz:

Publisher: python-publish.yml on WaveSpeedAI/langchain-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 langchain_wavespeed-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_wavespeed-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 da9c89264f2eb76729c69ff4edbc1b66ebf0e7006d08aeee0d141b006f65c0ae
MD5 60658b84fc0f366fb8781badeb2dcdc6
BLAKE2b-256 061823c1405461b73ed6446550f39e4bb91520ef976caa22116645205176c4c9

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_wavespeed-0.1.1-py3-none-any.whl:

Publisher: python-publish.yml on WaveSpeedAI/langchain-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