{"id":24737968,"url":"https://github.com/ashbuilds/payload-ai","last_synced_at":"2026-05-22T01:30:10.168Z","repository":{"id":254738454,"uuid":"829724738","full_name":"ashbuilds/payload-ai","owner":"ashbuilds","description":"AI Plugin is a powerful extension for the Payload CMS, integrating advanced AI capabilities to enhance content creation and management.","archived":false,"fork":false,"pushed_at":"2025-01-08T14:55:35.000Z","size":86011,"stargazers_count":112,"open_issues_count":1,"forks_count":18,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-01-21T10:54:39.783Z","etag":null,"topics":["ai","ai-translate","ai-writing","ai-writing-tool","content-generation","payloadcms","plugin","smart-generation","text-generation","text-to-image","text-to-speech"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ashbuilds.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["ashbuilds"],"buy_me_a_coffee":"ashbuilds"}},"created_at":"2024-07-17T00:26:53.000Z","updated_at":"2025-01-21T03:49:54.000Z","dependencies_parsed_at":"2024-09-18T01:59:26.475Z","dependency_job_id":null,"html_url":"https://github.com/ashbuilds/payload-ai","commit_stats":null,"previous_names":["ashbuilds/payload-ai"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashbuilds%2Fpayload-ai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashbuilds%2Fpayload-ai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashbuilds%2Fpayload-ai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashbuilds%2Fpayload-ai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ashbuilds","download_url":"https://codeload.github.com/ashbuilds/payload-ai/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235934725,"owners_count":19068724,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","ai-translate","ai-writing","ai-writing-tool","content-generation","payloadcms","plugin","smart-generation","text-generation","text-to-image","text-to-speech"],"created_at":"2025-01-27T22:34:46.862Z","updated_at":"2026-05-22T01:30:10.152Z","avatar_url":"https://github.com/ashbuilds.png","language":"TypeScript","funding_links":["https://github.com/sponsors/ashbuilds","https://buymeacoffee.com/ashbuilds","https://www.buymeacoffee.com/ashbuilds"],"categories":["Plugins","TypeScript"],"sub_categories":["Articles"],"readme":"# Payload AI Plugin\n\n\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"Payload AI Plugin\" src=\"assets/payload-ai-intro.gif\" width=\"100%\" /\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cstrong\u003eTransform content creation with intelligent automation — your models, your way\u003c/strong\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"Supported AI Providers\" src=\"assets/providers.png\" width=\"100%\" /\u003e\n\u003c/p\u003e\n\n---\n\n## 🚀 What is this?\n\nThe Payload AI Plugin is your secret weapon for turbocharged content creation. It seamlessly integrates cutting-edge AI capabilities directly into [Payload CMS](https://payloadcms.com), turning your content workflow from tedious to tremendous.\n\n### 🎥 See It in Action\n\n- **[Quick Demo](https://youtu.be/qaYukeGpuu4)** - Watch the magic happen\n- **[Extended Demo](https://youtu.be/LEsuHbKalNY)** - Deep dive into all features\n- **[Customization Guide](guide.md)** - Make it your own\n\n---\n\n## ⚠️ Beta Notice\n\nThis plugin is actively evolving. We're constantly shipping improvements and new features. Tested with Payload v3.38.0.\n\n**Quick Start Tip:** Try it out with [Payload's website template](https://github.com/payloadcms/payload/tree/main/templates/website) for the smoothest experience.\n\n---\n\n## ✨ Features\n\n### 📝 Text \u0026 RichText Fields\n\n**Content Generation Magic:**\n- ✅ **Compose** - Generate content from scratch\n- ✅ **Proofread** - Polish your prose (Beta)\n- ✅ **Translate** - Break language barriers\n- ✅ **Rephrase** - Find better ways to say it (Beta)\n- 🔜 **Expand** - Elaborate on ideas\n- 🔜 **Summarize** - Distill the essence\n- 🔜 **Simplify** - Make complex things clear\n\n### 🎨 Upload Fields\n\n- 🎙️ **Voice Generation** - Powered by ElevenLabs \u0026 OpenAI\n- 🖼️ **Image Generation** - Powered by OpenAI (DALL-E \u0026 GPT-Image-1)\n\n### 🔧 Power User Features\n\n- 🔌 **Bring Your Own Model** - Not limited to our defaults\n- 🎛️ **Field-Level Prompts** - Customize AI behavior per field\n- 🔐 **Access Control** - Lock down who can use AI features\n- 🧠 **Prompt Editor** - Fine-tune AI instructions\n- 🌍 **i18n Support** - Works with your multilingual setup\n- 🎨 **Custom Components** - Extend with your own UI\n\n### 🔜 Coming Soon\n\n- 📊 Document Analyzer\n- ✅ Fact Checking\n- 🔄 Automated Workflows\n- 💡 Editor Suggestions\n- 💬 AI Chat Assistant\n\n---\n\n## 📦 Installation\n\n```bash\npnpm add @ai-stack/payloadcms\n```\n\nThat's it! Now let's configure it.\n\n---\n\n## 🛠️ Quick Setup\n\n### Step 1: Configure the Plugin\n\nAdd to `src/payload.config.ts`:\n\n```typescript\nimport { payloadAiPlugin } from '@ai-stack/payloadcms'\n\nexport default buildConfig({\n  plugins: [\n    payloadAiPlugin({\n      collections: {\n        [Posts.slug]: true,\n      },\n      debugging: false,\n    }),\n  ],\n  // ... rest of your config\n})\n```\n\n### Step 2: Enable AI in Your Fields\n\nAdd to your RichText fields (e.g., `src/collections/Posts/index.ts`):\n\n```typescript\nimport { PayloadAiPluginLexicalEditorFeature } from '@ai-stack/payloadcms'\n\nfields: [\n  {\n    name: 'content',\n    type: 'richText',\n    editor: lexicalEditor({\n      features: ({ rootFeatures }) =\u003e {\n        return [\n          HeadingFeature({ enabledHeadingSizes: ['h1', 'h2', 'h3', 'h4'] }),\n          // Add this line:\n          PayloadAiPluginLexicalEditorFeature(),\n        ]\n      },\n    }),\n  },\n]\n```\n\n### Step 3: Add Your API Keys\n\nCreate a `.env` file in your project root. Add the keys for the providers you want to use:\n```env\n# Text Generation - Choose your provider(s)\nOPENAI_API_KEY=your-openai-api-key           # OpenAI models (GPT-4, etc.)\nANTHROPIC_API_KEY=your-anthropic-api-key     # Claude models\nGOOGLE_GENERATIVE_AI_API_KEY=your-google-key # Gemini models\nMINIMAX_API_KEY=your-minimax-api-key         # MiniMax M2.7 / M2.5 models\n\n# Image Generation - Choose your provider(s)\nOPENAI_API_KEY=your-openai-api-key           # DALL-E (uses same key as above)\n# OPENAI_ORG_ID=your-org-id                  # Required only for GPT-Image-1 model\nGOOGLE_GENERATIVE_AI_API_KEY=your-google-key # Imagen (uses same key as above)\n\n# Audio/Voice Generation - Choose your provider(s)\nELEVENLABS_API_KEY=your-elevenlabs-api-key   # ElevenLabs voices\nOPENAI_API_KEY=your-openai-api-key           # OpenAI TTS (uses same key as above)\n\n# Optional: Use custom OpenAI-compatible endpoint\n# OPENAI_BASE_URL=https://api.openai.com/v1\n```\n\n**You only need the keys for the providers you plan to use.** Mix and match based on your preferences!\n\n\n**Important:** Restart your server after updating `.env` or plugin settings!\n\nYou may also need to regenerate the import map:\n```bash\npayload generate:importmap\n```\n\n---\n\n## ⚙️ Advanced Configuration\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003e🔐 Access Control \u0026 Multi-Tenant Setup\u003c/strong\u003e\u003c/summary\u003e\n\n```typescript\nimport { payloadAiPlugin } from '@ai-stack/payloadcms'\n\nexport default buildConfig({\n  plugins: [\n    payloadAiPlugin({\n      collections: {\n        [Posts.slug]: true,\n      },\n      \n      // Enable AI for globals too\n      globals: {\n        [Home.slug]: true,\n      },\n\n      // Development helpers\n      debugging: false,\n      disableSponsorMessage: false,\n      generatePromptOnInit: process.env.NODE_ENV !== 'production',\n\n      // Specify media collection for GPT-Image-1\n      uploadCollectionSlug: \"media\",\n\n      // Lock down AI features\n      access: {\n        generate: ({ req }) =\u003e req.user?.role === 'admin',\n        settings: ({ req }) =\u003e req.user?.role === 'admin',\n      },\n\n      // Customize language options\n      options: {\n        enabledLanguages: [\"en-US\", \"zh-SG\", \"zh-CN\", \"en\"],\n      },\n\n      // Reference additional fields in prompts\n      promptFields: [\n        {\n          name: 'url',\n          collections: ['images'],\n        },\n        {\n          name: 'markdown',\n          async getter(doc, {collection}) {\n            return docToMarkdown(collection, doc)\n          }\n        }\n      ],\n\n      // Control initial prompt generation\n      seedPrompts: ({path}) =\u003e {\n        if (path.endsWith('.meta.description')) {\n          return {\n            data: {\n              prompt: 'Generate SEO-friendly meta description: {{markdown}}',\n            }\n          }\n        }\n        if (path.endsWith('.slug')) return false // Disable for slugs\n        return undefined // Use defaults\n      },\n\n      // Custom media upload (useful for multi-tenant)\n      mediaUpload: async (result, { request, collection }) =\u003e {\n        return request.payload.create({\n          collection,\n          data: result.data,\n          file: result.file,\n        })\n      },\n    }),\n  ],\n})\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003e🎨 Custom Components \u0026 Fields\u003c/strong\u003e\u003c/summary\u003e\n\nCustom fields don't automatically inherit AI capabilities. If your AI-enabled fields don't show Compose settings, manually add this component path:\n\n```\n@ai-stack/payloadcms/fields#ComposeField\n```\n\n**Debug Tip:** Enable `debugging: true` in your plugin config to see which fields have AI enabled.\n\n\u003c/details\u003e\n\n---\n\n## 📚 Documentation\n\nNeed more details? Check out the **[Complete Setup Guide](guide.md)** for:\n- Custom model configuration\n- Advanced prompt engineering\n- Field-specific customization\n- Troubleshooting tips\n\n---\n\n## 🤝 Support This Project\n\nBuilt with ❤️ in my free time. If this plugin saves you hours of work, consider fueling future development!\n\n\u003ca href=\"https://www.buymeacoffee.com/ashbuilds\" target=\"_blank\"\u003e\n  \u003cimg src=\"https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png\" alt=\"Buy Me A Coffee\" height=\"60\" width=\"217\" /\u003e\n\u003c/a\u003e\n\nEvery coffee keeps the AI models running and new features shipping. Thank you! 🙏\n\n---\n\n## 👥 Contributing\n\nWe love contributors! Whether you're fixing typos, suggesting features, or building new capabilities, all contributions are welcome.\n\n### Ways to Contribute\n\n- 🐛 Report bugs\n- 💡 Suggest features\n- 📖 Improve documentation\n- 🔧 Submit pull requests\n\nJoin the conversation on [Payload's Discord](https://discord.com/channels/967097582721572934/1264949995656843345) and let's build something amazing together!\n\n### Local Development\n\nWant to hack on the plugin? Here's how:\n\n#### Prerequisites\n\n- Node.js (version in `.nvmrc`)\n- pnpm\n- Database connection (Postgres or MongoDB)\n- Optional: AI provider API keys\n\n#### Setup\n\n```bash\n# 1. Install dependencies\npnpm install\n\n# 2. Set up environment\ncp dev/.env.example dev/.env\n# Edit dev/.env with your DATABASE_URI, PAYLOAD_SECRET, and API keys\n\n# 3. Start development server\npnpm dev\n# Admin UI available at http://localhost:3000\n\n# 4. Generate types/importmap if needed\npnpm generate:importmap\npnpm generate:types\n```\n\n#### Development Workflow\n\n- Plugin source: `src/`\n- Test app: `dev/`\n- Edit files in `src/` and refresh to see changes\n\n#### Testing \u0026 Quality\n\n```bash\npnpm test                    # Run all tests\npnpm lint                    # ESLint\npnpm prettier --write .      # Format code\npnpm build                   # Build plugin\n```\n\n#### Test in Another Project\n\n```bash\npnpm pack\n# In your other project:\npnpm add /path/to/ai-plugin-*.tgz\n```\n\n#### Project Structure\n\n```\n├── src/              # Plugin source code\n├── dev/              # Test Payload app\n│   ├── int.spec.ts   # Integration tests\n│   └── e2e.spec.ts   # E2E tests\n└── README.md         # You are here!\n```\n\n---\n\n\u003cp align=\"center\"\u003e\n  Made with ❤️ and ☕ by the community\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/ashbuilds/payload-ai\"\u003eStar on GitHub\u003c/a\u003e •\n  \u003ca href=\"https://discord.com/channels/967097582721572934/1264949995656843345\"\u003eJoin Discord\u003c/a\u003e •\n  \u003ca href=\"guide.md\"\u003eRead the Guide\u003c/a\u003e\n\u003c/p\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashbuilds%2Fpayload-ai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fashbuilds%2Fpayload-ai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashbuilds%2Fpayload-ai/lists"}