A powerful, full-stack AI chat application built with Qwen2.5-Omni, featuring multimodal input support, MCP (Model Context Protocol) server integration, and advanced tool calling capabilities.
Omni Chat is a modern AI assistant application that combines:
- Qwen2.5-Omni Model: A state-of-the-art multimodal AI model supporting text, audio, image, and video
- FastAPI Backend: High-performance Python server with OpenAI-compatible API
- React Frontend: Modern, responsive web interface with dark theme
- MCP Integration: Connect to external MCP servers for extended functionality
- Tool Calling: Built-in tools and MCP tools for enhanced capabilities
- Modern Dark Theme: Sleek, professional design with Tailwind CSS
- Chat History: Persistent conversation history with sidebar navigation
- Multimodal Input: Support for text, audio, image, and video files
- Voice Recording: Record audio directly in the browser
- Audio Playback: Embedded audio player for text-to-speech responses
- Responsive Design: Works seamlessly on desktop and mobile devices
- Multimodal Understanding: Process text, audio, images, and videos in a single conversation
- Tool Calling: Automatic tool selection and execution based on user queries
- Iterative Tool Use: Multi-step reasoning with automatic tool chaining
- Language Control: Configurable response language (default: English)
- Context Awareness: Maintains conversation context across multiple turns
- STDIO Transport: Connect to local MCP servers via standard input/output
- HTTP Transport: Connect to remote MCP servers via HTTP/SSE
- Automatic Tool Discovery: Tools from connected MCP servers are automatically available
- Connection Management: Easy connect/disconnect/remove operations
- Persistent Storage: Server configurations saved in browser localStorage
- Auto-Refresh: Tool list automatically updates when servers connect/disconnect
get_current_time: Get the current date and timecalculate: Perform mathematical calculationsget_weather: Get weather information for a locationread_file: Read contents of a file
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β React Frontend (UI) β
β - Chat Interface - MCP Server Manager - Tool Display β
βββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββ
β HTTP/REST API
βββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββ
β FastAPI Backend (app/) β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β β Omni Manager β β Tool Service β β MCP Manager β β
β ββββββββ¬ββββββββ ββββββββ¬ββββββββ ββββββββ¬ββββββββ β
β β β β β
β βββββββββββββββββββΌββββββββββββββββββ β
β β β
ββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββΌββββββββββββββββββ
β β β
ββββββΌβββββ ββββββΌβββββ ββββββΌβββββ
β Qwen2.5 β β Built-in β β MCP β
β Omni β β Tools β β Servers β
βββββββββββ ββββββββββββ βββββββββββ
- Python 3.8+ with pip
- Node.js 18+ with npm
- CUDA-capable GPU (recommended) or CPU
- 8GB+ RAM (16GB+ recommended)
-
Clone the repository (if applicable) or navigate to the project directory
-
Install Python dependencies:
pip install -r requirements.txt- Optional: Install flash-attention for faster inference:
pip install flash-attn --no-build-isolation- Optional: Install qwen_omni_utils for full multimodal support:
pip install qwen-omni-utils- Start the backend server:
python omni.pyThe server will start on http://localhost:8665 by default.
- Navigate to the UI directory:
cd ui- Install dependencies:
npm install- Start the development server:
npm run devThe UI will be available at http://localhost:3000 (or the next available port).
PORT: Server port (default:8665)HOST: Server host (default:0.0.0.0)RELOAD: Enable auto-reload for development (default:false)OMNI_MODEL_NAME: Model name (default:wolfofbackstreet/Qwen2.5-Omni-3B-4Bit)OMNI_USE_FLASH_ATTENTION: Use flash attention (default:true)OMNI_USE_CPU_OFFLOAD: Use CPU offloading (default:false)
VITE_API_URL: Backend API URL (default:http://localhost:8665)
- Open the UI in your browser
- Click "+ New Chat" to start a new conversation
- Type your message in the input field
- The AI will respond with text and optionally audio
- Text: Simply type your message
- Audio: Click the microphone icon to record, or use the paperclip to upload an audio file
- Image: Use the paperclip icon to upload an image file
- Video: Use the paperclip icon to upload a video file
-
Add a Server:
- Click "+ Add MCP Server" in the MCP Servers section
- Enter a Server ID (e.g.,
search) - Choose transport type (STDIO or HTTP)
- For STDIO: Enter command (e.g.,
npx) and arguments - For HTTP: Enter the server URL
- Click "Add Server"
-
Connect a Server:
- Click the power icon next to a server to connect
- Wait for the connection status to show "connected"
- Tools from the server will automatically appear in the Available Tools section
-
Disconnect/Remove:
- Click the power icon again to disconnect
- Click the trash icon to remove a server configuration
Tools are automatically available to the AI. When you ask a question that requires a tool, the AI will:
- Identify which tool(s) to use
- Execute the tool(s) automatically
- Use the results to generate a response
Example queries that trigger tools:
- "What time is it?" β Uses
get_current_time - "Calculate 15 * 23 + 7" β Uses
calculate - "What's the weather in New York?" β Uses
get_weather - "Search the web for Python tutorials" β Uses MCP search tools (if connected)
Model Context Protocol (MCP) is a protocol that enables AI assistants to securely access external data and tools. Omni Chat supports connecting to MCP servers to extend its capabilities.
For local MCP servers that run as processes:
{
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-duckduckgo-search"],
"env": {}
}For remote MCP servers accessible via HTTP:
{
"url": "https://api.example.com/mcp",
"prefer_sse": true
}- DuckDuckGo Search:
npx -y @modelcontextprotocol/server-duckduckgo-search - Filesystem:
npx -y @modelcontextprotocol/server-filesystem - GitHub:
npx -y @modelcontextprotocol/server-github
GET /v1/mcp/servers- List all MCP serversPOST /v1/mcp/servers/connect- Connect to an MCP serverPOST /v1/mcp/servers/{server_id}/disconnect- Disconnect from a serverDELETE /v1/mcp/servers/{server_id}- Remove a serverGET /v1/mcp/servers/{server_id}/status- Get server statusGET /v1/mcp/servers/{server_id}/tools- Get tools from a serverGET /v1/mcp/tools- Get all tools from all servers
Endpoint: POST /v1/omni/chat/completions
Request:
{
"messages": [
{
"role": "user",
"content": "Hello, how are you?",
"image_path": "/path/to/image.png",
"audio_path": "/path/to/audio.wav",
"video_path": "/path/to/video.mp4"
}
],
"max_tokens": 512,
"temperature": 0.7,
"top_p": 0.9,
"response_format": {
"type": "text"
},
"tools": [...],
"language": "en"
}Response:
{
"id": "omni-abc123",
"model": "Qwen2.5-Omni-3B",
"choices": [{
"index": 0,
"message": {
"role": "assistant",
"content": "I'm doing well, thank you!",
"audio": {
"data": "base64_encoded_audio...",
"format": "wav"
}
},
"finish_reason": "stop"
}],
"usage": {
"prompt_tokens": 10,
"completion_tokens": 50,
"total_tokens": 60
}
}Endpoint: POST /v1/omni/chat/completions/upload
Form Data:
text: Text prompt (required)audio: Audio file (optional)image: Image file (optional)video: Video file (optional)max_tokens: Max tokens (default: 512)temperature: Temperature (default: 0.7)top_p: Top-p (default: 0.9)response_format_type: "text" or "audio" (default: "text")
Endpoint: GET /health
Response:
{
"status": "healthy",
"model_loaded": true,
"model_name": "Qwen2.5-Omni-3B",
"device": "cuda",
"context_length": 32768
}Endpoint: GET /v1/omni/tools
Response:
{
"tools": [
{
"type": "function",
"function": {
"name": "get_current_time",
"description": "Get the current date and time",
"parameters": {
"type": "object",
"properties": {},
"required": []
}
}
}
]
}omni/
βββ app/ # Backend FastAPI application
β βββ main.py # Main application entry point
β βββ omni_manager.py # Qwen2.5-Omni model manager
β βββ mcp_client_manager.py # MCP server client manager
β βββ tool_service.py # Tool management service
β βββ tool_executor.py # Built-in tool executor
β βββ routes/ # API route handlers
β β βββ omni_chat.py # Chat completion routes
β β βββ mcp_servers.py # MCP server management routes
β βββ models.py # Pydantic models
βββ ui/ # Frontend React application
β βββ src/
β β βββ components/ # React components
β β βββ services/ # API service layer
β β βββ hooks/ # Custom React hooks
β β βββ utils/ # Utility functions
β βββ package.json # Frontend dependencies
βββ requirements.txt # Python dependencies
βββ omni.py # Main startup script
βββ README.md # This file
Backend:
RELOAD=true python omni.pyFrontend:
cd ui
npm run devFrontend:
cd ui
npm run buildThe built files will be in ui/dist/.
The default model is wolfofbackstreet/Qwen2.5-Omni-3B-4Bit, a 4-bit quantized version for lower memory usage. You can change this via the OMNI_MODEL_NAME environment variable.
Built-in tools are automatically registered. MCP tools are discovered when servers connect. The tool list is automatically refreshed when:
- An MCP server connects
- An MCP server disconnects
- A manual refresh is triggered
By default, the model responds in English. You can change this by setting the language parameter in the chat request:
"en"- English (default)"zh"- Chinese- Other language codes as supported
- Talker Module: Disabled by default to avoid meta tensor errors. Audio output requires the talker module to be enabled.
- Flash Attention: Enabled by default for faster inference but requires the
flash-attnpackage. - Device Management: The model uses
device_map="auto"to automatically distribute across available GPUs/CPU. - Tool Privacy: The LLM only sees tool names and descriptions, not internal MCP server details.
- Connection Persistence: MCP server configurations are saved in browser localStorage and persist across sessions.
Contributions are welcome! Please feel free to submit a Pull Request.
[Add your license information here]
- Qwen Team at Alibaba Group for the Qwen2.5-Omni model
- Model Context Protocol for the MCP specification
- All open-source contributors and libraries used in this project
Built with β€οΈ using Qwen2.5-Omni, FastAPI, and React