ashbuilds/payload-ai

AI Plugin is a powerful extension for the Payload CMS, integrating advanced AI capabilities to enhance content creation and management.

Payload AI Plugin – Overview

What it is: A plugin that adds AI‑powered content generation, editing, translation, and media creation directly inside Payload CMS. It lets you call large‑language‑model (LLM) services (OpenAI, Anthropic, Google Gemini, MiniMax) and voice/image generators (ElevenLabs, DALL‑E) from any text, rich‑text, or upload field.

Why it matters: Content teams can automate drafting, proofreading, translating, and even generating images or audio without leaving the CMS, keeping the workflow fast and consistent.


Key Features (as described in the README)

Area Capabilities
Text & RichText fields • Compose – generate new content from a prompt
• Proofread (beta) – polish existing prose
• Translate – automatic language conversion
• Rephrase (beta) – alternative wording
• Planned: Expand, Summarize, Simplify
Upload fields • Voice generation via ElevenLabs & OpenAI TTS
• Image generation via OpenAI DALL‑E & GPT‑Image‑1
Power‑user controls • Bring‑Your‑Own‑Model – plug any supported provider or custom OpenAI‑compatible endpoint
• Field‑level prompts – tailor the AI instruction per field
• Access control – restrict who can invoke AI (e.g., admin only)
• Prompt editor – UI for editing the prompt text
• i18n support – works with multilingual Payload setups
• Custom components – extend the UI with your own React components
Upcoming Document analyzer, fact checking, automated workflows, editor suggestions, AI chat assistant

Installation & Quick Start

# Add the plugin package
pnpm add @ai-stack/payloadcms
  1. Register the plugin in payload.config.ts:
    import { payloadAiPlugin } from '@ai-stack/payloadcms'
    
    export default buildConfig({
      plugins: [
        payloadAiPlugin({
          collections: { [Posts.slug]: true },
          debugging: false,
        })
      ],
    })
    
  2. Enable AI on a field (e.g., a RichText field) by adding the provided Lexical editor feature:
    import { PayloadAiPluginLexicalEditorFeature } from '@ai-stack/payloadcms'
    // inside the field definition
    editor: lexicalEditor({
      features: ({ rootFeatures }) => [
        // …other features
        PayloadAiPluginLexicalEditorFeature(),
      ],
    })
    
  3. Provide API keys – either via a .env file or directly in the plugin config. Supported keys include OPENAI_API_KEY, ANTHROPIC_API_KEY, GOOGLE_GENERATIVE_AI_API_KEY, MINIMAX_API_KEY, and ELEVENLABS_API_KEY.
  4. Restart the server (and optionally run payload generate:importmap).

Advanced Configuration Highlights

  • Access control – define access.generate and access.settings functions to limit AI usage (e.g., only admins).
  • Reference image resolver – for image‑to‑text or text‑to‑image prompts that include existing media, you must supply a resolveReferenceImage callback that safely fetches the image blob from your storage, respecting permissions and size limits.
  • Multi‑tenant / custom media upload – you can override how generated media is stored by providing a mediaUpload function.
  • Prompt seeding – seedPrompts lets you auto‑generate prompts for specific fields (e.g., SEO meta descriptions) when a document is created.
  • Custom language options – options.enabledLanguages controls which locales the AI features expose.

Documentation & Support

  • Demo videos – quick (YouTube) walkthroughs of the plugin in action.
  • Full guide – guide.md covers custom model setup, prompt engineering, and troubleshooting.
  • Community – Join the Payload Discord channel for help and discussion.
  • Funding – The author accepts donations via Buy Me a Coffee.

Who Might Use This?

  • Content teams looking to accelerate copywriting, translation, and media creation.
  • Developers building custom Payload‑based sites who want AI assistance without building their own integration layer.
  • Agencies managing multi‑tenant Payload installations that need per‑tenant AI credentials and strict access controls.

All information is taken directly from the repository’s README; no additional features are inferred.

Related

  • Project
  • Project
  • Project
  • Project
  • Project