@decartai/langchain package provides a LangChain Tool that gives any LLM agent the ability to generate and edit images using Decart.
Prerequisites
- A Decart API key
- Node.js 18+
- An LLM provider (Anthropic, OpenAI, etc.) for agent usage
Installation
Install the package along with the required@langchain/core peer dependency:
Setup
Set your Decart API key as an environment variable:Quick start
Text-to-image
Generate an image from a text prompt:Image editing
Edit an existing image by providing animageUrl:
Using with LLM agents
Bind the tool to an LLM to let it generate images on its own:Parameters
Source image URL for image-to-image editing. When provided, the tool uses
lucy-image-2 instead of lucy-pro-t2i.Model selection
The tool selects the model automatically based on your input:Constructor options
Next steps
Models overview
Explore all available Decart models.
JavaScript SDK
Use Decart’s native SDK for full API access.
GitHub
View source code and contribute.