If you are a developer who wants to integrate AI into their application for free, we have a perfect solution for you – Qwen AI. It is an open-source AI model developed by Alibaba and is considered one of the models for natural language processing, coding, and mathematics. In this post, we are going to see how you can use Qwen AI API for free.
Use Qwen AI API for Free
The Qwen AI API is a powerful tool developed by Alibaba Cloud that allows developers to integrate Qwen AI models into their applications. It has various features such as the support for natural language processing, coding, and mathematics, with models ranging from 0.5 billion to 72 billion parameters. It offers extended context windows (up to 128,000 tokens), advanced reasoning capabilities, and multimodal support for text, code, math, and video.
If we integrate Qwen AI API with your application and then hit the provided URL, it will respond back with the requested data that you can use in your app. So, if you want to use Qwen AI API for free, you can follow the steps mentioned below.
- Generate API key
- Get Qwen’s sample code
- Use AI Chatbot
Let us talk about them in detail.
1] Generate API key
First of all, we need to generate the Qwen AI API key that we need to integrate with your application. To do so, follow the steps mentioned below.
- First, you need to go openrouter.ai.
- Next, click on Sign in and then log into your account.
- Since we don’t have an account, we need to click on Sign up or use our Google or MetaMask to do the same.
- Once logged in, you need to click on the Create API key.
- Next, click on the Create key button placed next to API Keys.
- Give your key a name and then click on Create.
- You will get the key, just copy and paste it somewhere.
This is the key that we are going to use to add to our application.
2] Get Qwen’s sample code
Now that we have the API key, let us generate the sample code and where we can mention the API key to add to our actual code. To do so, follow the steps mentioned below.
- Stay on the Open router’s website, after generating the API key, you need to click on Models.
- In the Filter models field, enter “Qwen API”, and you will see multiple results along with their respective tokens. It is always recommended to go with the API with the largest token, at the time of writing this post, Qwen: Qwen2.5 VL 72B Instruct (free) has the highest token count, so, we clicked on its hyperlink.
- Then, go to the API tab and scroll down to check out the sample code.
- You will see codes in various languages, which you them have to copy to a Notepad or any text editor for that matter.
When using the code, you need to make sure to replace all the placeholders. Especially, the <OPENROUTER_API_KEY>.
Talking about the source code given there, it initiates a POST request to the OpenRouter API, which uses the qwen/qwen2.5-vl-72b-instruct:free model. It sends a request containing user input and an image URL for analysis. The headers include the API key for authentication and optional site information for rankings. The JSON body specifies the model, user role, and content, asking the model to describe the image provided. Finally, the fetch request retrieves the AI model’s response, which is then processed and displayed on the web page.
Every model has their own source code, which is evident from the fact that the source code will have a Model variable populated with the actual model name.
3] Use AI chatbot
Now that we have the source, we can integrate it with our application. For this tutorial, I created an HTML file and added the source code after replacing all the placeholders. You can do the same and then trigger the index file.
Once done, I got an online AI chatbot that uses Qwen’s API for source. Depending on the rest of the code changes and customization that you may have done, you will get a chatbot.
We hope that this post gives you an idea of how to integrate Qwen AI API with your application for free.
Read: How to run Qwen AI locally on Windows 11
Is Qwen AI free?
Yes, Qwen AI is free! It’s an AI tool developed by Alibaba that offers many features like chatting, generating images and videos, writing and debugging code, and translating languages. To access it, go to chat.qwenlm.ai to access it.
Read: How to use DeepSeek Coder in Windows 11?
Can I use OpenAI API for free?
Yes, you can use the OpenAI API for free, but there are some limitations. OpenAI offers a free tier that allows a limited number of API requests per month. However, if you exceed the free tier limits, you’ll need to purchase credits to continue using the API.
Also Read: Qwen vs DeepSeek AI – Features, Comparison.
Leave a Reply