FastAPI Qwen 0.6B REST API
This repository contains a production-ready (though lightweight) wrapper for the Qwen/Qwen3-0.6B model using FastAPI and JWT authentication.
Features
- FastAPI Backend: Efficient RESTful endpoints.
- JWT Security: Token-based authentication for the
/generateendpoint. - Thinking Toggle: Option to hide or show the model's internal reasoning/thinking blocks via regex filtering.
- OpenAI Chat Format: Compatible with list-of-messages input.
Files
app.py: The core FastAPI server logic.generate_jwt.py: Utility to create access tokens.client.py: Demo script for performing inference.
Quick Start
- Install dependencies:
pip install fastapi uvicorn transformers torch pyjwt python-dotenv requests. - Set your
SECRET_KEYin a.envfile. - Run
python app.py. - Use
client.pyto send requests.
Model discussions
Share what you know. Help others. Build trust.
Loading comments...
Keep it about the model. No spam, scams or personal attacks. Links are not allowed in comments or replies. Comment policy