Note: This is a fork of mhajder/ai-response-generator with significant enhancements including vision support, streaming responses, performance optimizations, and improved AI context.
An AI-powered response generator plugin for osTicket that helps agents generate intelligent, context-aware replies using OpenAI, Anthropic Claude, or any OpenAI-compatible API.
- Multi-AI Provider Support: OpenAI (GPT-4, GPT-4o), Anthropic (Claude 3/4), and OpenAI-compatible APIs
- Multi-Instance Support: Configure multiple AI providers simultaneously for different teams/workflows
- Smart Context Building: Includes recent ticket conversation with message types (Customer, Agent, Internal Note)
- Response Templates: Customizable output format with placeholders (
{user_name},{ticket_number}, etc.)
- Migrated to OpenAI Responses API: Modern API with better streaming support
- File attachments support: Send PDF, TXT, CSV and other documents to the AI
- Improved streaming: Native SSE event parsing for real-time responses
- Configurable defaults: Optimized default values (timeout: 10s, context: 3 messages)
- Placeholder hints: Config fields show default values as placeholder text
- AI Image Analysis: Send image attachments to vision-capable models (GPT-4o, Claude 3+)
- Analyze screenshots, error messages, product photos, documents
- Configurable limits: max images, file size, inline/attachment filtering
- Automatic format conversion for OpenAI and Anthropic
- Cost protection: Disabled by default, conservative limits
- Real-time typewriter effect for AI responses
- Works with both OpenAI and Anthropic APIs
- Server-Sent Events (SSE) implementation
- Configurable per instance (enable/disable)
- Efficient database queries using osTicket's QuerySet methods
- Only loads required thread entries (not all messages)
- Better message type labeling for improved AI context
- Fixed message ordering (newest first β most relevant context)
- v0.3.1: Fixed getPoster() returning string instead of object
- v0.2.1: Fixed pjax navigation ticket context bug
- v0.2.2: Fixed thread message order (was sending oldest instead of newest)
- osTicket: Version 1.18 or later
- PHP: Version 8.2 - 8.4 (8.4 recommended)
- AI Provider:
- OpenAI API account (for GPT models)
- Anthropic API account (for Claude models)
- Or any OpenAI-compatible API endpoint
- Download/Clone this repository
- Copy the plugin folder to
include/plugins/in your osTicket installation:cd /path/to/osticket/include/plugins/ git clone https://github.com/istoutjesdijk/ai-response-generator.git - Navigate to osTicket Admin Panel β Manage β Plugins
- Click Add New Plugin and select AI Response Generator
- Configure the instance (see Configuration section below)
-
API URL: Your AI provider endpoint
- OpenAI:
https://api.openai.com/v1/responses - Anthropic:
https://api.anthropic.com/v1/messages - Custom: Your OpenAI-compatible Responses API endpoint
- OpenAI:
-
API Key: Your authentication key
-
Model Name: Model identifier
- OpenAI:
gpt-4o,gpt-4-turbo,gpt-3.5-turbo - Anthropic:
claude-3-opus-20240229,claude-3-sonnet-20240229,claude-3-haiku-20240307
- OpenAI:
- Max Tokens: Response length limit (default: 512)
- Temperature: Creativity level 0.0-2.0 (default: 1.0)
- Timeout: API request timeout in seconds (default: 10)
- Max Thread Entries: Number of recent messages to include (default: 3)
- System Prompt: Custom instructions for AI behavior
- Response Template: Format output with placeholders
- Show Instructions Popup: Allow agents to add special instructions per response
- Enable Streaming: Real-time typewriter effect (default: disabled)
- Include Internal Notes: Include internal notes in AI context (default: enabled)
Both System Prompt and Response Template support osTicket variables:
| Variable | Description |
|---|---|
%{ticket.number} |
Ticket number |
%{ticket.subject} |
Ticket subject |
%{ticket.user.name} |
Customer name |
%{ticket.user.email} |
Customer email |
%{ticket.dept} |
Department name |
%{ticket.status} |
Ticket status |
%{ticket.priority} |
Priority level |
%{ticket.create_date} |
Creation date |
%{staff.name} |
Agent name |
%{date} |
Current date (Y-m-d) |
%{time} |
Current time (H:i) |
%{datetime} |
Current date & time |
%{day} |
Day of week |
%{ai_text} |
AI response (template only) |
- Enable Vision Support: Master switch (default: disabled)
- Max Images: Limit per request (default: 5, max: 10 for OpenAI, 100 for Anthropic)
- Max Image Size: Size limit in MB (default: 5 MB)
- Include Inline Images: Include embedded images like signatures (default: disabled)
Supported formats: JPEG, PNG, GIF, WebP
- Open a ticket in the agent panel
- Click the "AI Response" button (in toolbar or "More" dropdown)
- (Optional) Add special instructions in the popup (e.g., "Offer refund")
- Wait for the AI to generate a response
- Review and edit the generated response as needed
- Send the reply to the customer
Keyboard shortcuts in instructions popup:
- Ctrl+Enter (or Cmd+Enter): Submit and generate
- Escape: Close popup
When vision is enabled and a customer includes screenshots or images:
- The AI automatically analyzes the images
- You'll get context-aware responses based on visual content
- Useful for error screenshots, product photos, diagrams, etc.
Configure multiple plugin instances for:
- Different AI providers (GPT-4 for complex tickets, Claude for cost savings)
- Different departments (Sales uses Claude, Support uses GPT-4o)
- A/B testing different models or prompts
- Only staff with reply permission can use AI response generation
- API keys stored securely using osTicket's
PasswordField(encrypted) - All requests go through backend (no client-side API calls)
- Vision support processes images server-side only
- CSRF token validation on all AJAX requests
- Extra instructions input limited to 500 characters
- Check plugin instance is enabled in Admin Panel
- Verify user has staff reply permissions
- Check browser console for JavaScript errors
- Verify API URL format (must include full endpoint path)
- Check API key is valid and has sufficient credits
- Increase timeout for slow API responses
- Ensure model name matches provider format
- Confirm vision support is enabled in config
- Use vision-capable model (GPT-4o, Claude 3+)
- Check image format (JPEG, PNG, GIF, WebP only)
- Verify image size is under configured limit
| Feature | Original | This Fork |
|---|---|---|
| API | Chat Completions | β Responses API |
| Anthropic Claude | β | β Full support |
| Streaming | β | β Real-time SSE |
| Vision/Images | β | β GPT-4o & Claude 3+ |
| File Attachments | β | β PDF, TXT, CSV |
| Ticket Subject | β | β Included in context |
| Thread Context | β | β Recent messages |
| Internal Notes | β | β Optional in context |
| Template Variables | Basic | β Full osTicket vars |
| Instructions Popup | β | β Per-response guidance |
- Original Plugin: Mateusz Hajder - mhajder/ai-response-generator
- Enhanced Fork: Additional features and improvements by the osTicket community
MIT License - See LICENSE file for details
This fork maintains the original MIT license while adding significant enhancements. All original copyright notices are preserved.
Contributions are welcome! Please:
- Fork this repository
- Create a feature branch
- Make your changes
- Submit a pull request
- Issues: GitHub Issues
- Original Plugin: mhajder/ai-response-generator
- osTicket: osTicket Documentation