AI-powered image captioning for Vue.js applications using Hugging Face BLIP models
npm install @aivue/image-caption



š¼ļø AI-powered image captioning for Vue.js applications using OpenAI Vision API
Generate intelligent, contextual captions for images using GPT-4 Vision, the most advanced computer vision model available. Perfect for accessibility, content management, social media, and AI-powered applications.
- š¤ GPT-4 Vision - Most advanced image understanding AI
- šÆ Easy Integration - Drop-in Vue component with minimal setup
- š Simple Authentication - Just add your OpenAI API key
- š± Drag & Drop Upload - Intuitive file upload with preview
- š URL Support - Caption images from URLs
- š Batch Processing - Process multiple images at once
- š History Tracking - Keep track of generated captions
- š¾ Export Data - Export captions as JSON or CSV
- šØ Beautiful UI - Modern, responsive design
- š§ TypeScript Support - Full type definitions included
- š± Mobile Friendly - Works great on all devices
``bash`
npm install @aivue/image-caption
`vue
@caption-generated="onCaptionGenerated"
/>
`
Set your API key in environment variables:
`bash`.env
VITE_OPENAI_API_KEY=your-openai-api-key
| Prop | Type | Default | Description |
|------|------|---------|-------------|
| apiKey | string | '' | OpenAI API key |model
| | string | 'gpt-4o' | AI model to use |autoCaption
| | boolean | false | Auto-generate caption on image upload |maxHistorySize
| | number | 20 | Maximum number of captions to keep in history |
| Event | Payload | Description |
|-------|---------|-------------|
| caption-generated | ImageCaptionResult | Fired when caption is successfully generated |caption-error
| | Error | Fired when caption generation fails |image-uploaded
| | ImageUploadEvent | Fired when image is uploaded |image-removed
| | void | Fired when image is removed |
`vue`
| Model | ID | Description | Best For |
|-------|----|-----------| ---------|
| GPT-4o | gpt-4o | Latest and most capable vision model | General use, highest quality |gpt-4o-mini
| GPT-4o Mini | | Faster and more cost-effective | High volume, cost-sensitive apps |gpt-4-turbo
| GPT-4 Turbo | | High-intelligence vision model | Detailed analysis, complex scenes |
`typescript
interface ImageCaptionConfig {
apiKey?: string; // OpenAI API key
model?: string; // Model ID to use ('gpt-4o', 'gpt-4o-mini', 'gpt-4-turbo')
}
interface ImageCaptionOptions {
model?: string; // Override model for this request
prompt?: string; // Custom prompt for caption generation
detail?: 'low' | 'high' | 'auto'; // Image analysis detail level
maxTokens?: number; // Maximum response tokens (300)
temperature?: number; // Creativity level (0.7)
}
`
The component comes with beautiful default styles, but you can customize them:
`css
/ Override default styles /
.ai-image-caption {
--primary-color: #your-color;
--border-radius: 12px;
--spacing: 16px;
}
/ Custom upload area /
.upload-area {
border: 2px dashed #your-color;
background: #your-background;
}
/ Custom button styles /
.generate-btn {
background: linear-gradient(135deg, #your-gradient);
}
`
`vue`
`vue`
`vue`
1. Go to OpenAI Platform
2. Sign up for an account
3. Go to API Keys
4. Create a new secret key
5. Copy your key (starts with "sk-") and use it as your API key
Pricing:
- GPT-4o: $5.00 / 1M input tokens, $15.00 / 1M output tokens
- GPT-4o Mini: $0.15 / 1M input tokens, $0.60 / 1M output tokens
- GPT-4 Turbo: $10.00 / 1M input tokens, $30.00 / 1M output tokens
`vue
@caption-generated="updateAltText"
/>
`
`vue
``
We welcome contributions! Please see our Contributing Guide for details.
Explore the complete @aivue ecosystem:
MIT License - see LICENSE for details.
- Documentation
- Live Demo
- GitHub Repository
- npm Package
- Hugging Face Models
---
Made with ā¤ļø by reachbrt