A powerful Streamlit-based chat interface for interacting with Nebius Token Factory's advanced language models and image generation capabilities.
- Multi-Model Support: Chat with DeepSeek-R1-0528 and Qwen3-235B-A22B models
- Conversation Memory: Maintains chat history with context awareness
- Custom Instructions: Set system prompts and use preset instruction templates
- Advanced Parameters: Fine-tune temperature, top-p, max tokens, and other generation settings
- Thinking Visualization: View model reasoning process with expandable thinking sections
- Multiple Models: Support for Flux Schnell, Flux Dev, and SDXL models
- Flexible Output: Generate images in PNG, JPG, JPEG, or WebP formats
- Advanced Controls: Customize width, height, inference steps, negative prompts, and seeds
- LoRA Support: Apply custom LoRA models for specialized image generation
- Usage Statistics: Track token usage, conversation counts, and average tokens per conversation
- Export Functionality: Download complete conversation history as JSON
- Session Management: Clear conversations and manage chat sessions
- Python 3.11 or higher
- Nebius Token Factory API key
-
Clone the repository
git clone git clone https://github.com/Arindam200/awesome-ai-apps.git cd simple_ai_agents/nebius-chat -
Install dependencies
# Using uv (recommended) uv sync # Or using pip pip install -r requirements.txt
-
Environment Setup
# Create .env file echo "NEBIUS_API_KEY=your_api_key_here" > .env
-
Run the application
streamlit run app.py
- Sign up at Nebius Token Factory
- Generate your API key from the console
- Add the key to your
.envfile or enter it in the sidebar
- DeepSeek-R1-0528: General-purpose model with strong reasoning capabilities
- Qwen3-235B-A22B: Large multilingual model with advanced capabilities
- Flux Schnell: Fast image generation with high quality
- Flux Dev: Development version with latest features
- SDXL: Stable Diffusion XL for high-resolution images
- Select "Chat" from the tool selector
- Choose your preferred model
- Adjust generation parameters (temperature, top-p, max tokens)
- Set custom instructions or use preset templates
- Start chatting with the AI assistant
- Select "Image Generation" from the tool selector
- Choose an image generation model
- Configure image parameters (size, format, inference steps)
- Enter your prompt and optional negative prompt
- Generate and download your images
Use preset templates or create custom system prompts:
- Default: General AI assistant
- Creative Writer: Storytelling and narrative assistance
- Business Assistant: Professional business advice
- Language Tutor: Language learning support
- Technical Expert: Technical information and solutions
- API Integration: Handles all Nebius Token Factory API communications
- Conversation Management: Maintains chat history and context
- Image Generation: Manages image generation requests
- Usage Tracking: Monitors token usage and statistics
send_message(): Process chat completionsgenerate_image(): Handle image generation requestsexport_conversation(): Export chat historyget_usage_stats(): Calculate usage statistics
- Streamlit Interface: Modern, responsive web interface
- Sidebar Configuration: Model selection and parameter tuning
- Chat Display: Real-time message rendering with thinking visualization
- Image Gallery: Generated image display and download
POST https://api.tokenfactory.nebius.com/v1/chat/completionsPOST https://api.tokenfactory.nebius.com/v1/images/generations- Temperature: 0.0-1.0 (creativity control)
- Top-p: 0.1-1.0 (nucleus sampling)
- Max Tokens: 50-500 (response length)
- Presence Penalty: 0.63 (default)
- Top-k: 51 (default)
The application tracks comprehensive usage metrics:
- Total conversations
- Token usage (prompt, completion, total)
- Average tokens per conversation
- Model-specific statistics
streamlit run app.py- Set up environment variables
- Configure reverse proxy (nginx)
- Use process manager (PM2, systemd)
- Enable HTTPS with SSL certificates
FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
EXPOSE 8501
CMD ["streamlit", "run", "app.py", "--server.port=8501"]- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Nebius Token Factory for providing the API
- Streamlit for the web framework
- DeepSeek and Qwen for the language models
For support and questions:
- Create an issue in the repository
- Check the Nebius Token Factory documentation
- Review the application logs for debugging
- Initial release with chat and image generation capabilities
- Support for DeepSeek and Qwen models
- Basic conversation management and export features
- Streamlit-based user interface
