It supports high-speed streaming output, multiple rounds of dialogue, watermark-free AI drawing, long document interpretation, image analysis, zero-configuration deployment, multi-channel token support, and automatic cleaning of session traces.
Fully compatible with ChatGPT interface.
There are also the following eight free-api welcome to pay attention to:
Moonshot AI (Kimi.ai) interface to API kimi-free-api
StepChat interface to API step-free-api
Zhipu AI (Zhipu Qingyan) interface to API glm-free-api
Metaso AI (Metaso) interface to API metaso-free-api
iFlytek Spark interface to API spark-free-api
MiniMax (Conch AI) interface to API hailuo-free-api
DeepSeek interface to API deepseek-free-api
Listening Intelligence (Emohaa) interface to API emohaa-free-api
The reverse API is unstable. It is recommended to go to the official Alibaba Cloud https://dashscope.console.aliyun.com/ to pay to use the API to avoid the risk of being banned.
This organization and individuals do not accept any financial donations or transactions. This project is purely for research, exchange and learning!
It is for personal use only, and it is prohibited to provide external services or commercial use to avoid putting pressure on the official service, otherwise it is at your own risk!
It is for personal use only, and it is prohibited to provide external services or commercial use to avoid putting pressure on the official service, otherwise it is at your own risk!
It is for personal use only, and it is prohibited to provide external services or commercial use to avoid putting pressure on the official service, otherwise it is at your own risk!
This link is only for temporary testing. Please deploy it yourself for long-term use.
https://udify.app/chat/qOXzVl5kkvhQXM8r
Log in from Tongyi Qianwen
Enter Tongyi Qianwen and initiate a conversation, then open the developer tools with F12 and find the value of tongyi_sso_ticket
from Application > Cookies. This will be used as the Bearer Token value of Authorization: Authorization: Bearer TOKEN
Log in from Alibaba Cloud (not recommended if the account has important assets such as servers). If the account has not entered Tongyi Qianwen before, you need to enter the consent agreement first, otherwise it will not take effect.
Then open the developer tools with F12 and find the value of login_aliyunid_ticket
from Application > Cookies. This will be used as the Bearer Token value of Authorization: Authorization: Bearer TOKEN
You can provide tongyi_sso_ticket or login_aliyunid_ticket for multiple accounts and use the splicing provided:
Authorization: Bearer TOKEN1,TOKEN2,TOKEN3
One of these will be selected each time the service is requested.
Please prepare a server with a public IP and open port 8000.
Pull the image and start the service
docker run -it -d --init --name qwen-free-api -p 8000:8000 -e TZ=Asia/Shanghai vinlic/qwen-free-api:latest
View real-time service logs
docker logs -f qwen-free-api
Restart service
docker restart qwen-free-api
Stop service
docker stop qwen-free-api
version : ' 3 '
services :
qwen-free-api :
container_name : qwen-free-api
image : vinlic/qwen-free-api:latest
restart : always
ports :
- " 8000:8000 "
environment :
- TZ=Asia/Shanghai
Note: Some deployment areas may not be able to connect to qwen. If the container log shows a request timeout or cannot be connected, please switch to other areas for deployment! Note: The container instance of the free account will automatically stop running after a period of inactivity, which will cause a delay of 50 seconds or more on the next request. It is recommended to check Render container keep alive
Fork this project to your github account.
Visit Render and log in to your github account.
Build your Web Service (New+ -> Build and deploy from a Git repository -> Connect your forked project -> Select the deployment area -> Select the instance type as Free -> Create Web Service).
After waiting for the construction to complete, copy the assigned domain name and splice the URL for access.
Note: The request response timeout for Vercel free accounts is 10 seconds, but the interface response usually takes longer, and you may encounter a 504 timeout error returned by Vercel!
Please make sure you have installed the Node.js environment first.
npm i -g vercel --registry http://registry.npmmirror.com
vercel login
git clone https://github.com/LLM-Red-Team/qwen-free-api
cd qwen-free-api
vercel --prod
Please prepare a server with a public IP and open port 8000.
Please install the Node.js environment and configure the environment variables first, and confirm that the node command is available.
Install dependencies
npm i
Install PM2 for process guarding
npm i -g pm2
Compile and build. When you see the dist directory, the build is complete.
npm run build
Start service
pm2 start dist/index.js --name " qwen-free-api "
View real-time service logs
pm2 logs qwen-free-api
Restart service
pm2 reload qwen-free-api
Stop service
pm2 stop qwen-free-api
It is faster and easier to use the following secondary development client to access the free-api series projects, and supports document/image upload!
LobeChat developed by Clivia https://github.com/Yanyutin753/lobe-chat
ChatGPT Web https://github.com/SuYxh/chatgpt-web-sea developed by Guangguang@
Currently, it supports the /v1/chat/completions
interface that is compatible with openai. You can use the client access interface that is compatible with openai or other clients, or use online services such as dify to access it.
Conversation completion interface, compatible with openai's chat-completions-api.
POST /v1/chat/completions
header needs to set the Authorization header:
Authorization: Bearer [tongyi_sso_ticket/login_aliyunid_ticket]
Request data:
{
// 模型名称随意填写
"model" : " qwen " ,
// 目前多轮对话基于消息合并实现,某些场景可能导致能力下降且受单轮最大token数限制
// 如果您想获得原生的多轮对话体验,可以传入上一轮消息获得的id,来接续上下文
// "conversation_id": "bc9ef150d0e44794ab624df958292300-40811965812e4782bb87f1a9e4e2b2cd",
"messages" : [
{
"role" : " user " ,
"content" : "你是谁? "
}
],
// 如果使用SSE流请设置为true,默认false
"stream" : false
}
Response data:
{
// 如果想获得原生多轮对话体验,此id,你可以传入到下一轮对话的conversation_id来接续上下文
"id" : " bc9ef150d0e44794ab624df958292300-40811965812e4782bb87f1a9e4e2b2cd " ,
"model" : " qwen " ,
"object" : " chat.completion " ,
"choices" : [
{
"index" : 0 ,
"message" : {
"role" : " assistant " ,
"content" : "我是阿里云研发的超大规模语言模型,我叫通义千问。 "
},
"finish_reason" : " stop "
}
],
"usage" : {
"prompt_tokens" : 1 ,
"completion_tokens" : 1 ,
"total_tokens" : 2
},
"created" : 1710152062
}
Conversation completion interface, compatible with openai's images-create-api.
POST /v1/images/generations
header needs to set the Authorization header:
Authorization: Bearer [tongyi_sso_ticket/login_aliyunid_ticket]
Request data:
{
// 可以乱填
"model" : " wanxiang " ,
"prompt" : "一只可爱的猫"
}
Response data:
{
"created" : 1711507734 ,
"data" : [
{
"url" : " https://wanx.alicdn.com/wanx/1111111111/text_to_image/7248e85cfda6491aae59c54e7e679b17_0.png "
}
]
}
Provide an accessible file URL or BASE64_URL to parse.
POST /v1/chat/completions
header needs to set the Authorization header:
Authorization: Bearer [refresh_token]
Request data:
{
"model" : " qwen " ,
"messages" : [
{
"role" : " user " ,
"content" : [
{
"type" : " file " ,
"file_url" : {
"url" : " https://mj101-1317487292.cos.ap-shanghai.myqcloud.com/ai/test.pdf "
}
},
{
"type" : " text " ,
"text" : "文档里说了什么? "
}
]
}
]
}
Response data:
{
"id" : " b56ea6c9e86140429fa2de6a6ec028ff " ,
"model" : " qwen " ,
"object" : " chat.completion " ,
"choices" : [
{
"index" : 0 ,
"message" : {
"role" : " assistant " ,
"content": "文档中包含了四个古代魔法仪式或咒语的描述,它们似乎旨在影响或控制一个特定女性的情感和行为,使其对施术者产生强烈的爱意。以下是每个仪式的具体内容:nn1. **仪式一**(PMG 4.1390 – 1495):n - 施术者需留下一些面包,将其掰成七小块。n - 前往一处英雄、角斗士或其他暴力死亡者丧生的地方。n - 对着面包碎片念诵咒语后丢弃,并从该地取一些受污染的泥土扔进目标女性的住所。n - 咒语内容包括向命运三女神(Moirai)、罗马版的命运女神(Fates)、自然力量(Daemons)、饥荒与嫉妒之神以及非正常死亡者献祭食物,并请求他们以痛苦折磨目标,使她在梦中惊醒,心生忧虑与恐惧,最终跟随施术者的步伐并顺从其意愿。此过程以赫卡忒(Hecate)女神为命令的源泉。nn2. **仪式二**(PMG 4.1342 – 57):n - 施术者召唤恶魔(Daemon),通过一系列神秘的神祇名号(如Erekisephthe Araracharara Ephthesikere)要求其将名为Tereous的女子(Apia所生)带至施术者Didymos(Taipiam所生)身边。n - 请求该女子在灵魂、心智及女性器官上遭受剧烈痛苦,直至她主动找寻Didymos并与之紧密相连(唇对唇、发对发、腹部对腹部)。整个过程要求立即执行。nn3. **仪式三**(PGM 4.1265 – 74):n - 揭示了阿佛洛狄忒(Aphrodite)鲜为人知的名字——NEPHERIĒRI[nfr-iry-t]。n - 如果想赢得一位美丽女子的芳心,施术者应保持三天纯净,献上乳香,并在心中默念该名字七次。n - 这样的做法需持续七天,据说这样便能成功吸引女子。nn4. **仪式四**(PGM 4.1496 – 1):n - 施术者在燃烧的煤炭上供奉没药(myrrh),同时念诵咒语。n - 咒语将没药称为“苦涩的调和者”、“热力的激发者”,并命令它前往指定的女子(及其母亲的名字)处,阻止她进行日常活动(如坐、饮、食、注视他人、亲吻他人),迫使她心中只有施术者,对其产生强烈的欲望与爱意。n - 咒语还指示没药直接穿透女子的灵魂,驻留在其心中,焚烧其内脏、胸部、肝脏、气息、骨骼、骨髓,直到她来到施术者身边。nn这些仪式反映了古代魔法实践中试图借助超自然力量操控他人情感与行为的企图,涉及对神灵、恶魔、神秘名字及特定物质(如面包、泥土、乳香、没药)的运用,通常伴随着严格的仪式规程和咒语念诵。此类行为在现代伦理和法律框架下被视为不恰当甚至违法,且缺乏科学依据。"
},
"finish_reason" : " stop "
}
],
"usage" : {
"prompt_tokens" : 1 ,
"completion_tokens" : 1 ,
"total_tokens" : 2
},
"created" : 1712253736
}
Provide an accessible image URL or BASE64_URL to parse.
This format is compatible with the gpt-4-vision-preview API format, and you can also use this format to transmit documents for parsing.
POST /v1/chat/completions
header needs to set the Authorization header:
Authorization: Bearer [refresh_token]
Request data:
{
"model" : " qwen " ,
"messages" : [
{
"role" : " user " ,
"content" : [
{
"type" : " file " ,
"file_url" : {
"url" : " https://img.alicdn.com/imgextra/i1/O1CN01CC9kic1ig1r4sAY5d_!!6000000004441-2-tps-880-210.png "
}
},
{
"type" : " text " ,
"text" : "图像描述了什么? "
}
]
}
]
}
Response data:
{
"id" : " 895fbe7fa22442d499ba67bb5213e842 " ,
"model" : " qwen " ,
"object" : " chat.completion " ,
"choices" : [
{
"index" : 0 ,
"message" : {
"role" : " assistant " ,
"content" : "图像展示了通义千问的标志,一个紫色的六边形和一个蓝色的三角形,以及“通义千问”四个白色的汉字。 "
},
"finish_reason" : " stop "
}
],
"usage" : {
"prompt_tokens" : 1 ,
"completion_tokens" : 1 ,
"total_tokens" : 2
},
"created" : 1712254066
}
Check whether tongyi_sso_ticket or login_aliyunid_ticket is alive. If live is not true, otherwise it is false. Please do not call this interface frequently (less than 10 minutes).
POST /token/check
Request data:
{
"token" : " QIhaHrrXUaIrWMUmL... "
}
Response data:
{
"live" : true
}
If you are using Nginx reverse proxy qwen-free-api, please add the following configuration items to optimize the output effect of the stream and optimize the experience.
# 关闭代理缓冲。当设置为off时,Nginx会立即将客户端请求发送到后端服务器,并立即将从后端服务器接收到的响应发送回客户端。
proxy_buffering off ;
# 启用分块传输编码。分块传输编码允许服务器为动态生成的内容分块发送数据,而不需要预先知道内容的大小。
chunked_transfer_encoding on ;
# 开启TCP_NOPUSH,这告诉Nginx在数据包发送到客户端之前,尽可能地发送数据。这通常在sendfile使用时配合使用,可以提高网络效率。
tcp_nopush on ;
# 开启TCP_NODELAY,这告诉Nginx不延迟发送数据,立即发送小数据包。在某些情况下,这可以减少网络的延迟。
tcp_nodelay on ;
# 设置保持连接的超时时间,这里设置为120秒。如果在这段时间内,客户端和服务器之间没有进一步的通信,连接将被关闭。
keepalive_timeout 120 ;
Since the inference side is not in qwen-free-api, the token cannot be counted and will be returned as a fixed number.