A powerful AI-driven tool that generates, edits, and publishes SEO-optimized blog posts directly to Medium with zero hassle.
Features • Demo • Installation • Usage • Configuration • API Setup • Deployment
AI Medium Blog Automator is an intelligent content creation and publishing platform that leverages the power of Meta's Llama 3.3 70B model to generate professional, SEO-optimized blog posts. With an intuitive Streamlit interface, you can create, edit, enhance with images, and publish directly to Medium—all in one seamless workflow.
- AI-Powered Content Generation: Utilizes Meta Llama 3.3 70B Instruct Turbo for high-quality, contextual blog writing
- Interactive Editor: Real-time blog editing with paragraph-level control
- Image Integration: Upload and position images with captions and affiliate links
- SEO Optimization: Built-in SEO best practices and keyword optimization
- Direct Medium Publishing: One-click publishing to Medium via RapidAPI
- Live Preview: See your blog as it will appear before publishing
- Professional Templates: Pre-configured templates for consistent, high-quality output
- ✍️ AI-Powered Writing: Generate comprehensive blog posts from simple prompts
- 🎯 SEO Optimized: Automatic keyword integration and meta tag generation
- 📊 Structured Output: Well-formatted blogs with proper headings and sections
- 🔄 Continuation Detection: Automatically handles long-form content generation
- 🎨 Customizable Templates: Modify blog structure and style via templates
- ✏️ Interactive Editor: Edit title and each paragraph individually
- 🖼️ Image Management: Upload images with captions after any paragraph
- 🔗 Affiliate Links: Add referral/affiliate links to images
- 👁️ Live Preview: Real-time preview of your final blog post
- 💾 Session State: Your work is preserved during editing
- 📤 Direct Medium Upload: Publish directly to your Medium account
- 🏷️ Tag Management: Add custom tags for better discoverability
- 🌐 HTML Formatting: Automatic conversion to Medium-compatible HTML
- ☁️ Image Hosting: Automatic image upload to ImgBB for reliable hosting
- ✅ Success Tracking: Get direct links to your published posts
Before you begin, ensure you have the following:
- Python 3.8 or higher installed on your system
- pip package manager
- Git (for cloning the repository)
- Active accounts and API keys for:
- Together AI (for Llama 3.3 70B model)
- RapidAPI (for Medium API access)
- ImgBB (for image hosting)
git clone https://github.com/yourusername/AI-Medium-Blog-Automator.git
cd AI-Medium-Blog-AutomatorWindows:
python -m venv venv
venv\Scripts\activatemacOS/Linux:
python3 -m venv venv
source venv/bin/activatepip install -r requirements.txtCreate a .env file in the root directory:
# For Windows
copy .env.example .env
# For macOS/Linux
cp .env.example .envEdit the .env file and add your API keys:
# Together AI API Key (for Llama 3.3 70B model)
TOGETHER_API_KEY=your_together_ai_api_key_here
# RapidAPI Key (for Medium publishing)
RAPIDAPI_KEY=your_rapidapi_key_here
# ImgBB API Key (for image hosting)
IMGBB_API_KEY=your_imgbb_api_key_here- Visit Together AI
- Sign up or log in to your account
- Navigate to API Keys section
- Create a new API key
- Copy the key and paste it in your
.envfile asTOGETHER_API_KEY
Free Tier: Together AI offers free credits for testing. The Llama 3.3 70B Turbo Free model is available for use.
- Go to RapidAPI Hub
- Sign up or log in
- Search for "Medium API" or visit Medium2 API
- Subscribe to a plan (free tier available)
- Go to Endpoints and copy your
X-RapidAPI-Key - Paste it in your
.envfile asRAPIDAPI_KEY
Important: You'll also need to authenticate your Medium account through the RapidAPI interface.
- Visit ImgBB API
- Sign up for a free account
- Navigate to API section
- Copy your API key
- Paste it in your
.envfile asIMGBB_API_KEY
Free Tier: ImgBB offers free image hosting with reasonable limits for personal projects.
- Make sure your virtual environment is activated
- Run the Streamlit app:
streamlit run app.py- Your default browser will open automatically at
http://localhost:8501
In the text area, provide a detailed prompt for your blog. The more specific you are, the better the output.
Example Prompts:
Write a comprehensive blog about the top 5 gaming mice under ₹2000 in India,
including their features, pros, cons, and where to buy them.
Create an in-depth guide on getting started with machine learning using Python,
covering essential libraries, concepts, and a beginner project.
Write a blog post about sustainable fashion trends in 2024, including eco-friendly
brands, materials, and tips for building a sustainable wardrobe.
- Click the ✨ Generate Blog button
- Wait for the AI to generate your content (usually 10-30 seconds)
- The generated blog will appear in the editor below
- Edit Title: Modify the blog title in the text input field
- Edit Paragraphs: Each paragraph has its own text area for editing
- Add Images:
- Expand the image section after any paragraph
- Upload an image (JPG, JPEG, or PNG)
- Add a caption
- Optionally add an affiliate/referral link
Scroll to the 👀 Blog Preview section to see how your blog will look when published.
- Click ✅ Save and Proceed to Upload
- Wait for the upload process to complete
- You'll receive a success message with a link to your published blog
The blog generation follows a template located at templates/blog_prompt_template.txt. You can customize this template to change:
- Blog structure and sections
- SEO requirements
- Writing style and tone
- Content depth guidelines
- Call-to-action formats
To edit the template:
# Open the template file
notepad templates\blog_prompt_template.txt # Windows
nano templates/blog_prompt_template.txt # macOS/LinuxIn blog_generator.py, you can modify the AI model parameters:
data = {
"model": MODEL,
"messages": [...],
"max_tokens": 2048, # Increase for longer blogs
"temperature": 0.7, # 0.0-1.0: Lower = more focused, Higher = more creative
"top_p": 0.9, # Nucleus sampling
"frequency_penalty": 0.2, # Reduce repetition
"presence_penalty": 0.1, # Encourage topic diversity
}The default model is meta-llama/Llama-3.3-70B-Instruct-Turbo-Free. You can change this in blog_generator.py:
MODEL = "meta-llama/Llama-3.3-70B-Instruct-Turbo-Free" # Current model
# Or try other Together AI models:
# MODEL = "meta-llama/Meta-Llama-3.1-405B-Instruct-Turbo"
# MODEL = "mistralai/Mixtral-8x7B-Instruct-v0.1"- Push your code to GitHub (make sure
.envis in.gitignore) - Visit Streamlit Cloud
- Sign in with GitHub
- Click New app
- Select your repository and branch
- Set Main file path to
app.py - Click Advanced settings
- Add your environment variables:
TOGETHER_API_KEYRAPIDAPI_KEYIMGBB_API_KEY
- Click Deploy
- Create a Heroku account at heroku.com
- Install Heroku CLI
- Login and create a new app:
heroku login
heroku create your-app-name- Set environment variables:
heroku config:set TOGETHER_API_KEY=your_key_here
heroku config:set RAPIDAPI_KEY=your_key_here
heroku config:set IMGBB_API_KEY=your_key_here- Deploy:
git push heroku mainNote: The Procfile is already configured for Streamlit on Heroku.
- Visit railway.app
- Sign in with GitHub
- Click New Project → Deploy from GitHub repo
- Select your repository
- Add environment variables in the Variables tab
- Railway will automatically detect and deploy your Streamlit app
AI-Medium-Blog-Automator/
│
├── app.py # Main Streamlit application
├── blog_generator.py # AI blog generation logic
├── medium_uploader.py # Medium publishing functionality
├── requirements.txt # Python dependencies
├── Procfile # Deployment configuration
├── .env # Environment variables (not in repo)
├── .gitignore # Git ignore file
│
├── templates/
│ └── blog_prompt_template.txt # Blog generation template
│
└── README.md # This file
Solution: Ensure your .env file exists and contains the correct API key. Restart the Streamlit app after adding the key.
Solutions:
- Check your Together AI API key is valid
- Verify you have sufficient API credits
- Check your internet connection
- Try a shorter/simpler prompt
Solutions:
- Verify your RapidAPI key is correct
- Check if you've authenticated your Medium account on RapidAPI
- Ensure you have remaining API calls in your RapidAPI plan
- Check the Medium API status on RapidAPI
Solutions:
- Verify your ImgBB API key
- Check image file size (ImgBB has limits)
- Ensure image format is JPG, JPEG, or PNG
- Check your internet connection
Solution: The app has automatic continuation detection. If it's still cutting off:
- Increase
max_tokensinblog_generator.py - Break your prompt into smaller, more specific sections
Solutions:
# Reinstall dependencies
pip install --upgrade -r requirements.txt
# Clear Streamlit cache
streamlit cache clear
# Check Python version
python --version # Should be 3.8+- Frontend: Streamlit
- AI Model: Meta Llama 3.3 70B Instruct Turbo (via Together AI)
- APIs:
- Together AI API (LLM)
- RapidAPI Medium API (Publishing)
- ImgBB API (Image Hosting)
- Languages: Python 3.8+
- Key Libraries:
streamlit- Web interfacerequests- API callspython-dotenv- Environment managementPillow- Image processing
- Multi-language blog generation
- Custom tag suggestions based on content
- Draft saving and loading
- Batch blog generation
- Analytics integration
- WordPress integration
- Twitter thread generation
- Content calendar planning
Contributions are welcome! Here's how you can help:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Follow PEP 8 style guidelines
- Add comments for complex logic
- Update README.md for new features
- Test thoroughly before submitting PR
This project is licensed under the MIT License - see the LICENSE file for details.
Kill_Switch
- GitHub: @yourusername
- Medium: @yourmedium
- Together AI for providing access to Llama 3.3 70B
- Meta AI for the Llama model
- Streamlit for the amazing framework
- RapidAPI for Medium API access
- ImgBB for free image hosting
If you find this project helpful, please consider:
- Giving it a ⭐ on GitHub
- Sharing it with others
- Contributing to its development
- Reporting bugs and suggesting features
- Issues: Open an issue on GitHub
- Discussions: Use GitHub Discussions for questions
- Email: [email protected]
Made with ❤️ and AI