š§ Fork: https://github.com/EndyKaufman/FreeQwenApiā
š Original: https://github.com/y13sint/FreeQwenApiā
Free Qwen AI API Proxy with OpenAI compatibility and Telegram bot integration. Access Qwen models without API keys.
baseURL# 1. Add account locally first
npm run auth
# 2. Build and run
docker compose build --no-cache
docker compose up -d
services:
qwen-proxy:
build: .
container_name: qwen-proxy
environment:
- SKIP_ACCOUNT_MENU=true
- PORT=3264
ports:
- "3264:3264"
volumes:
- ./session:/app/session
- ./logs:/app/logs
- ./uploads:/app/uploads
restart: unless-stopped
git clone https://github.com/EndyKaufman/FreeQwenApi
cd FreeQwenApi
npm install
npm start
| Endpoint | Method | Description |
|---|---|---|
/api/chat | POST | Native chat endpoint |
/api/chat/completions | POST | OpenAI-compatible endpoint |
/api/models | GET | List available models |
/api/status | GET | Check authentication status |
/api/chats | POST | Create new chat |
/api/files/upload | POST | Upload files/images |
/api/images/generations | POST | Generate images (DALL-E compatible) |
curl http://localhost:3264/api/chat/completions \
-H "Content-Type: application/json" \
-d '{"model":"qwen-max-latest","messages":[{"role":"user","content":"Hello!"}]}'
import OpenAI from 'openai';
const client = new OpenAI({
baseURL: 'http://localhost:3264/api',
apiKey: 'any-string',
});
const response = await client.chat.completions.create({
model: 'qwen-max-latest',
messages: [{ role: 'user', content: 'Hello!' }],
});
curl -X POST http://localhost:3264/api/chat/completions \
-H "Content-Type: application/json" \
-d '{"model":"qwen-max-latest","messages":[{"role":"user","content":"Write a poem"}],"stream":true}'
// First message
const res1 = await fetch('/api/chat', {
method: 'POST',
body: JSON.stringify({ message: "What is 2+2?" })
});
const data1 = await res1.json();
// Response: { chatId: "abc-123", parentId: "xyz-789", ... }
// Continue conversation
const res2 = await fetch('/api/chat', {
method: 'POST',
body: JSON.stringify({
message: "Now add 3?",
chatId: data1.chatId,
parentId: data1.parentId
})
});
qwen3.5-plus, qwen3.5-flash, qwen3.5-397b-a17b, qwen3.5-122b-a10b, qwen3.5-27bqwen3-max, qwen3-plus, qwen3-omni-flash, qwen3-coder-plusqwen-vl-max, qwen-vl-plus, qwen2.5-vl-32b-instruct, qwen2.5-vl-7b-instructqwen-max, qwen-plus, qwen-turbo, qwen2.5-72b-instruct, qwq-32bAuto-mapping: Aliases like
qwen3,qwq,qwen-turboautomatically map to canonical models.
By default, API is open. To enable authorization, add keys to src/Authorization.txt:
your-api-key-here
Then include header: Authorization: Bearer your-api-key-here
Enhanced fork includes Telegram bot for:
Configure via environment variables:
TELEGRAM_BOT_TOKEN - Bot token from @BotFatherTELEGRAM_ALLOWED_USERS - Comma-separated user IDs (optional whitelist)| Variable | Default | Description |
|---|---|---|
PORT | 3264 | HTTP server port |
SKIP_ACCOUNT_MENU | false | Skip interactive account menu |
DEFAULT_MODEL | qwen-max-latest | Default model if not specified |
LOG_LEVEL | info | Logging level (error/warn/info/debug) |
MAX_FILE_SIZE | 10485760 | Max upload size (10MB) |
DASHSCOPE_API_KEY | - | Required for image generation |
TELEGRAM_BOT_TOKEN | - | Telegram bot token |
| Volume | Purpose |
|---|---|
./session | Qwen tokens and accounts |
./logs | Winston log files |
./uploads | Temporary uploaded files |
./temp | Archive extraction temp dir |
./session_backup | Session backups before updates |
Run npm start without SKIP_ACCOUNT_MENU:
With multiple accounts:
{
"model": "qwen-max-latest",
"messages": [
{"role": "system", "content": "You are a helpful assistant"},
{"role": "user", "content": "Hello!"}
],
"stream": false
}
Response:
{
"id": "chatcmpl-123",
"choices": [{"message": {"role": "assistant", "content": "Hi!"}}],
"chatId": "abc-123",
"parentId": "def-456"
}
{
"message": "Hello!",
"model": "qwen-max-latest",
"chatId": "abc-123",
"parentId": "def-456"
}
curl -X POST http://localhost:3264/api/files/upload -F "[email protected]"
Response:
{
"success": true,
"file": {
"url": "https://cdn.qwenlm.ai/uploaded-image.jpg"
}
}
{
"prompt": "Space ship on nebula background",
"model": "qwen-image-plus",
"n": 1,
"size": "1024x1024"
}
http://localhost:3264/apiconversation_id, proxy doesn't restore global contextFull documentation available in repository:
docs/ENV_SETUP.md - Environment configurationdocs/TELEGRAM_BOT_FLOW.md - Telegram bot workflowsdocs/IMAGE_GENERATION.md - Image generation guidedocs/OPENWEBUI_SETUP.md - OpenWebUI integrationdocs/TOKEN_EXPIRY_CHECKING.md - Token expiry detectionāāā index.js # Entry point: Express server
āāā main.py # Python FastAPI alternative
āāā src/
ā āāā api/ # API routes and handlers
ā āāā browser/ # Puppeteer browser automation
ā āāā logger/ # Winston logging
ā āāā utils/ # Utilities (account setup, Telegram bot)
āāā session/ # Tokens and accounts
āāā logs/ # Log files
āāā examples/ # Usage examples (JS/Python)
This is an enhanced fork of https://github.com/y13sint/FreeQwenApiā
Key improvements:
MIT License - see LICENSE file for details
Content type
Image
Digest
sha256:a27fda3abā¦
Size
714.4 MB
Last updated
3 months ago
docker pull endykaufman/qwen-api-proxy