How to Build a Free AI-Powered Web Chatbot with MaaS and Dify
This tutorial walks you through using Huawei's MaaS platform to claim a 2‑million‑token free DeepSeek‑R1 API, integrate it with the open‑source Dify Agent platform, configure a knowledge base, customize the chatbot’s behavior, and embed the finished AI assistant into a website.
Why AI Chatbots?
Customer service is a crucial bridge between businesses and consumers, but traditional human agents incur high salary and training costs, are hard to analyze data from, and cannot provide 24/7 service. Leveraging advanced large‑language models to build AI agents offers natural, continuous conversations, higher user satisfaction, and dramatically reduced operational costs.
Overview of the Tutorial
This guide shows how to use the MaaS (ModelArts Studio) platform’s 200 万 free token DeepSeek‑R1 API with the open‑source Dify platform to quickly create an AI chatbot and embed it on a web page.
1.1 ModelArts Studio (MaaS) Introduction
MaaS, a Huawei Cloud service, provides a model‑as‑a‑service platform optimized for Ascend chips. It offers an easy‑to‑use model development toolchain, supports custom large‑model development, and aims to lower AI adoption costs.
1.2 Claiming 2 million Free Tokens
Log in to the MaaS console (Guizhou region) and navigate to Model Deployment . Choose the desired DeepSeek model version and click Claim . After claiming, you receive a free quota of 2 million tokens for that model.
2.1 Preparing Dify
2.1.1 Deploying Dify
Dify is an open‑source AI application development platform that combines Backend‑as‑a‑Service and LLMOps concepts. It provides a UI and APIs to accelerate building scalable generative AI apps. You can quickly deploy a private Dify instance on a Huawei Cloud Flexus X server (see the linked blog for details).
2.1.2 Logging into Dify
After deployment, register an admin account with email, username, and password, then log in to the Dify studio.
2.2 Integrating MaaS Model API into Dify
2.2.1 Create API Key
In the MaaS console, go to Authentication Management and click Create API Key . Save the generated key (only shown once).
2.2.2 Select Persistent Model API
In MaaS, go to Model Deployment , find the model you claimed, and click Invoke . Note the base API endpoint and model name.
2.2.3 Configure Dify Model Provider
In Dify, open Settings → Model Provider , add a new provider of type OpenAI‑API‑compatible , and fill in the model name, API key, and endpoint URL (remove the trailing /chat/completions from the URL).
Only Qwen2_5‑7B‑Instruct‑1128, Qwen2_5‑72B‑Instruct‑1128, and Qwen2_5‑72B‑32K‑1128 support Function Calling as “Tool Call”. Other services do not support this feature yet.
2.3 Building the Customer Service Bot in Dify
2.3.1 Knowledge Base Creation
Create a knowledge base in Dify and upload internal documents. Choose the Economy indexing mode (uses embeddings without reranking) for this demo.
2.3.2 Create and Debug the Bot
In the Dify studio, create a new Agent app, set a prompt to define the AI’s tone (e.g., “You are a friendly AI customer service assistant…”), attach the knowledge base, and configure opening greetings and next‑question suggestions.
2.3.3 Embedding the Bot into a Web Page
After publishing, click Embed in Dify and copy the provided code snippet into your website’s <head> or <body> tag. The platform supports full‑screen, floating‑window, and browser‑extension embedding modes.
Once the code is added and the page refreshed, the AI chatbot is live on the site.
Huawei Cloud Developer Alliance
The Huawei Cloud Developer Alliance creates a tech sharing platform for developers and partners, gathering Huawei Cloud product knowledge, event updates, expert talks, and more. Together we continuously innovate to build the cloud foundation of an intelligent world.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
