MxChat Image Analysis

Transform your chatbot into a visual assistant. Let users upload images and receive intelligent AI-powered analysis, descriptions, OCR text extraction, and answers to their specific questions – all within your chat interface.

Requirements

  • MxChat Core Plugin (installed and activated)
  • MxChat Pro License (active)
  • OpenAI API key and/or xAI (Grok) API key
  • WordPress 5.8+ and PHP 7.4+

Quick Setup

  1. Install the Plugin: Upload and activate MxChat Image Analysis through your WordPress plugins page
  2. Configure API Key: Go to MxChat → Settings and temporarily switch to GPT-4V or Grok model to enter your API key
  3. Enable Vision: Navigate to MxChat → Image Analysis and toggle “Enable Vision Analysis”
  4. Select Model: Choose between OpenAI Vision (GPT-4V) or Grok Vision
  5. Configure Limits: Set max images per message and max file size
  6. Test Upload: Open your chat widget and try uploading an image using the camera icon

Available Models

OpenAI Vision (GPT-4V)

Advanced image analysis with high accuracy – Excellent for detailed descriptions, text recognition (OCR), and complex scenes. Best for professional use cases requiring precision.

Pricing: Pay per token usage

Grok Vision

Fast and efficient image analysis – Great for general purpose image understanding and quick responses. Cost-effective option for high-volume usage.

Pricing: Pay per request

Key Features

Multiple Upload Methods

  • File Selection: Click camera icon and select from device
  • Copy & Paste: Paste images directly from clipboard
  • Drag & Drop: Drag images into chat window

Supported Image Formats

  • JPEG (.jpg, .jpeg)
  • PNG (.png)
  • GIF (.gif)
  • WebP (.webp)

Custom Analysis Prompts

Create custom instructions for how AI analyzes images. The user’s specific question is automatically added to your instructions for contextual analysis.

Smart Image Processing

Images are automatically optimized and resized to 1024px maximum dimension for faster processing while maintaining quality.

Chat History Integration

Image uploads and analysis are properly saved to MxChat transcripts with full conversation context.

How to Use

  1. Open Chat: User opens your MxChat widget
  2. Upload Image: Click camera icon or paste/drag image into chat
  3. Review Preview: Image appears in preview area above chat input
  4. Ask Question: Type specific question about the image (optional)
  5. Send: Press Enter or click send button
  6. Get Analysis: AI provides detailed analysis and answers
Pro Tip: Use keyboard shortcut Ctrl/Cmd + V to quickly paste images from your clipboard directly into the chat.

Custom Analysis Prompts

What are Custom Prompts?

Custom prompts let you define how the AI analyzes images. Your instructions are combined with the user’s specific question for contextual responses.

Example Prompt Templates

Professional Analysis:

You are an expert image analyst. Examine this image systematically and provide: 1) A comprehensive description, 2) Key visual elements, 3) Any text content, 4) Professional insights.

OCR Focus:

First, extract and transcribe all readable text, numbers, or written content from this image. Then provide a detailed description of the visual elements.

Simple & Friendly:

Look at this image and be detailed but conversational in your response.

Technical Analysis:

Provide a technical analysis including composition, color schemes, objects, spatial relationships, and notable features.

Business/Marketing Focus:

Analyze this image from a business perspective. Consider branding elements, target audience appeal, visual messaging, and commercial effectiveness.

How It Works

If user uploads an image and asks “What brand is this?”, the AI receives your custom prompt plus their question: “User question: What brand is this?”

Troubleshooting

Camera icon not appearing

  • Verify Vision is enabled in MxChat → Image Analysis
  • Check that MxChat Pro license is active
  • Clear browser cache and reload page
  • Check browser console for JavaScript errors

Error: “Vision analysis is disabled”

Go to MxChat → Image Analysis and enable “Enable Vision Analysis” toggle.

Error: “API key is not configured”

  • Go to MxChat → Settings
  • Temporarily switch model to GPT-4V or Grok
  • Enter your API key and save
  • You can switch back to other models afterward

Image upload fails

  • Check file size is under configured limit (default 10MB)
  • Verify image format is supported (JPEG, PNG, GIF, WebP)
  • Ensure image is not corrupted
  • Check WordPress upload limits in php.ini

Analysis is slow or times out

  • Reduce max file size setting to speed up uploads
  • Try using a different AI model (Grok is typically faster)
  • Check your internet connection speed
  • Verify API provider status is operational
  • Large images are automatically resized – this may take extra time

Paste not working

  • Ensure you’re pasting inside the chat window or input field
  • Try copying image again from source
  • Some applications don’t support image clipboard copying
  • Use file selection as alternative

Images not showing in chat history

  • Check that images completed upload before sending
  • Verify MxChat transcripts are enabled
  • Images are stored as references in transcripts
  • Temporary files are cleaned up after 24 hours

Frequently Asked Questions

Do I need MxChat Pro?

Yes, this add-on requires an active MxChat Pro license to function.

Which model should I choose?

OpenAI Vision (GPT-4V) offers better accuracy for detailed analysis and OCR. Grok Vision is faster and more cost-effective for general image understanding. Test both to see which fits your needs.

Can users upload multiple images at once?

Yes, users can upload multiple images per message. You can configure the limit (default is 5) in settings. All images are analyzed together with the user’s question.

How much does image analysis cost?

Costs depend on your chosen AI provider. OpenAI charges per token (including image tokens), while Grok charges per request. Check your provider’s current pricing. Images are automatically optimized to reduce costs.

Where are uploaded images stored?

Images are temporarily stored in wp-content/uploads/mxchat-vision/ and automatically cleaned up after 24 hours to save space.

Can the AI read text from images (OCR)?

Yes, both OpenAI Vision and Grok Vision can extract and read text from images. Use a custom OCR-focused prompt for best results.

What happens without a custom prompt?

If no custom prompt is set, the AI uses only the user’s question (or a default “analyze this image” prompt if no question is provided).

Can I use both OpenAI and Grok?

You can have both API keys configured and switch between models anytime in settings. Only one model can be active at a time.

Does this work with other MxChat add-ons?

Yes, Vision integrates seamlessly with all MxChat add-ons. Users can upload images and still trigger actions, use forms, or interact with your Assistant API.

Common API Errors

HTTP 401: Unauthorized

Your API key is invalid or expired. Go to your AI provider’s dashboard, regenerate the key, and update it in MxChat settings.

HTTP 429: Rate Limit Exceeded

You’ve hit the provider’s rate limits. Wait a few minutes or upgrade your API plan for higher limits.

HTTP 400: Bad Request

Usually means invalid image format or corrupted file. Verify the image is a supported format and not corrupted.

HTTP 413: Payload Too Large

Image file is too large. Reduce the max file size setting or ask users to upload smaller images. The plugin auto-resizes, but very large files can still cause issues during upload.

HTTP 500/502/503: Server Error

AI provider’s servers are having issues. Wait a few minutes and try again. Check the provider’s status page for outages.

Timeout Error

Request took too long (over 60 seconds). Try using Grok for faster processing, or reduce image sizes. Complex images take longer to analyze.

Technical Details

Image Processing

  • Max Dimensions: 1024px (auto-resized)
  • Default Max File Size: 10MB (configurable 1-20MB)
  • Default Max Images: 5 per message (configurable 1-10)
  • Supported Formats: JPEG, PNG, GIF, WebP
  • Compression: JPEG quality 85%, PNG level 6

API Specifications

  • OpenAI Model: gpt-4o (vision-enabled)
  • Grok Model: grok-4 (vision-enabled)
  • Request Timeout: 60 seconds
  • Retry Logic: 3 attempts with exponential backoff
  • Storage Duration: 24 hours (auto-cleanup)

Performance

  • Upload Speed: Depends on user connection
  • Analysis Time: 2-10 seconds typical
  • Image Optimization: Automatic on upload
  • Token Usage: ~170 tokens per 512×512 tile

Security

  • File type validation
  • Size limit enforcement
  • Nonce verification on all AJAX requests
  • Automatic file cleanup
  • Capability checks for admin functions

Recent Updates

Version 1.0.2

Update test and improvements.

Version 1.0.1

Update test and bug fixes.

Version 1.0.0

Initial release with OpenAI Vision and Grok Vision support, custom prompts, multiple upload methods, and automatic image optimization.

Need Help?

If you’re experiencing issues not covered here: