API Signup & Environment Setup
1. Create an account
- Sign up for a SiliconFlow account. Register here
- Go to the console to retrieve your API key.
2. Environment setup
See docs: Quick Start – LazyLLMAPI Usage Test
###0. Set Environment Variables You can use the following command to set the corresponding environment variable, or explicitly pass it in code:1. Implement chat and image recognition
Text Q&A demo
After filling in the api_key, run the code below to quickly call the model and generate a Q&A-style front-end interface:

Multimodal Q&A demo
Pass an image through the lazyllm_files parameter in the input and ask about the image content to achieve multimodal question answering.

2. Implement text-to-image and text-to-speech
UseOnlineMultiModalModulefor text-to-image and text-to-speech. After running, it will output the path of the generated files.

| tmpck44zfds.mp3 | 55.13 KB | 2025-10-27 23:13 |
|---|
3. Knowledge-base Q&A in 10+ lines of code
Implement Embed and Rerank functions
Run the code below to perform vector embeddings withOnlineEmbeddingModule; settype='rerank'to call a reranking model.
Knowledge-base import
We use Chinese classical texts as an example knowledge base. After downloading, place them in the database folder. Sample dataset download link: Sample Dataset Download
Knowledge-base retrieval
Now that we have an external knowledge base, we can use the Retriever component in LazyLLM to retrieve the knowledge base and recall relevant content. Usage example:Knowledge-base Q&A
Combining the above model, document management, and retrieval modules, we can build a complete dataflow using LazyLLM’s built-in Flow component. The full code is as follows: