Poseidonas

payload ai manager

by Poseidonas
AI content generation
v3
>=3.88 <4
MIT

Overview

Summary generated from the README

Writes product titles, descriptions, attribute lists and translations into chosen fields of configured collections. Provider, model and API key are set in an admin settings global, and generation runs on save or through a single endpoint. A stored fingerprint of source content and targets prevents paying twice for unchanged content. Requires Payload 3.88 or newer and the ecommerce plugin.

Features

  • Four selectable providers: Claude, ChatGPT, Gemini and Kimi
  • Target kinds for title, description, attributes and translation, with optional max length
  • Fingerprint of source fields and targets skips regeneration of unchanged content
  • Per-field switches in a settings global to turn targets off without a deploy
  • API key read from a named environment variable, with a database fallback
  • Manual generation endpoint with a force option, or automatic generation on save

Use cases

  • Generate product copy for an ecommerce catalogue from titles, brands and categories
  • Translate product descriptions into other languages in dedicated fields
  • Control AI spend by regenerating only when source content has changed

From the author

Claude, ChatGPT, Gemini and Kimi for Payload: writes product descriptions, attribute lists and translations into the fields you choose, and never twice for the same content.

Installation

npm i payload-ai-manager

1

Stars

0

Forks

0

Open Issues

2 weeks ago

Last Updated

22

Weekly Downloads

v1.0.1

npm Version

52.6 KB

Unpacked Size

0

Dependencies

GitHub stars

10 since Sep 6

Show data
GitHub stars by day (UTC)
DateStars
Dec 5, 20261
Dec 4, 20261
Dec 3, 20261
Dec 2, 20261
Dec 1, 20261
Nov 30, 20261
Nov 29, 20261
Nov 28, 20261
Nov 27, 20261
Nov 26, 20261
Nov 25, 20261
Nov 24, 20261
Nov 23, 20261
Nov 22, 20261
Nov 21, 20261
Nov 20, 20261
Nov 19, 20261
Nov 18, 20261
Nov 17, 20261
Nov 16, 20261
Nov 15, 20261
Nov 14, 20261
Nov 13, 20261
Nov 12, 20261
Nov 11, 20261
Nov 10, 20261
Nov 9, 20261
Nov 8, 20261
Nov 7, 20261
Nov 6, 20261
Nov 5, 20261
Nov 4, 20261
Nov 3, 20261
Nov 2, 20261
Nov 1, 20261
Oct 31, 20261
Oct 30, 20261
Oct 29, 20261
Oct 28, 20261
Oct 27, 20261
Oct 26, 20261
Oct 25, 20261
Oct 24, 20261
Oct 23, 20261
Oct 22, 20261
Oct 21, 20261
Oct 20, 20261
Oct 19, 20261
Oct 18, 20261
Oct 17, 20261
Oct 16, 20261
Oct 15, 20261
Oct 14, 20261
Oct 13, 20261
Oct 12, 20261
Oct 11, 20261
Oct 10, 20261
Oct 9, 20261
Oct 8, 20261
Oct 7, 20261
Oct 6, 20261
Oct 5, 20261
Oct 4, 20261
Oct 3, 20261
Oct 2, 20261
Oct 1, 20261
Sep 30, 20261
Sep 29, 20261
Sep 28, 20261
Sep 27, 20261
Sep 26, 20261
Sep 25, 20261
Sep 24, 20261
Sep 23, 20261
Sep 22, 20261
Sep 21, 20261
Sep 20, 20261
Sep 19, 20261
Sep 18, 20261
Sep 17, 20261
Sep 16, 20261
Sep 15, 20261
Sep 14, 20261
Sep 13, 20261
Sep 12, 20261
Sep 11, 20261
Sep 10, 20261
Sep 9, 20261
Sep 8, 20261
Sep 7, 20261
Sep 6, 20261
npm weekly downloads

18−2 since Sep 6

Show data
npm weekly downloads by day (UTC)
DateWeekly downloads
Dec 5, 202618
Dec 4, 202619
Dec 3, 202625
Dec 2, 202625
Dec 1, 202627
Nov 30, 202626
Nov 29, 202633
Nov 28, 202642
Nov 27, 202651
Nov 26, 2026233
Nov 25, 2026233
Nov 24, 2026230
Nov 23, 2026225
Nov 22, 2026218
Nov 21, 2026209
Nov 20, 2026198
Nov 19, 20269
Nov 18, 202610
Nov 17, 202611
Nov 16, 202614
Nov 15, 202614
Nov 14, 202615
Nov 13, 202619
Nov 12, 202620
Nov 11, 202619
Nov 10, 202618
Nov 9, 202616
Nov 8, 202616
Nov 7, 202615
Nov 6, 202610
Nov 5, 202611
Nov 4, 202611
Nov 3, 202612
Nov 2, 202615
Nov 1, 202613
Oct 31, 202615
Oct 30, 202615
Oct 29, 202612
Oct 28, 202611
Oct 27, 202611
Oct 26, 20268
Oct 25, 20268
Oct 24, 20267
Oct 23, 20267
Oct 22, 20269
Oct 21, 20269
Oct 20, 20267
Oct 19, 20268
Oct 18, 20267
Oct 17, 20267
Oct 16, 20267
Oct 15, 20267
Oct 14, 202610
Oct 13, 202610
Oct 12, 20268
Oct 11, 202612
Oct 10, 202612
Oct 9, 202612
Oct 8, 202611
Oct 7, 20268
Oct 6, 202611
Oct 5, 202610
Oct 4, 20267
Oct 3, 20266
Oct 2, 20269
Oct 1, 20269
Sep 30, 202612
Sep 29, 202610
Sep 28, 202610
Sep 27, 202611
Sep 26, 202617
Sep 25, 202614
Sep 24, 202614
Sep 23, 202612
Sep 22, 202612
Sep 21, 202613
Sep 20, 202614
Sep 19, 20267
Sep 18, 20268
Sep 17, 20269
Sep 16, 202613
Sep 15, 202612
Sep 14, 202612
Sep 13, 202610
Sep 12, 202610
Sep 11, 202610
Sep 10, 202610
Sep 9, 20267
Sep 8, 202610
Sep 7, 202616
Sep 6, 202620

Each point is npm's rolling 7-day download count.

Health Score

70/100Good

Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.

Badge for your README

Payload Directory health badge
Markdown
[![Payload Directory](https://payloaddirectory.dev/badge/1341834252-root.svg)](https://payloaddirectory.dev/plugins/1341834252-root)
HTML
<a href="https://payloaddirectory.dev/plugins/1341834252-root"><img src="https://payloaddirectory.dev/badge/1341834252-root.svg" alt="Payload Directory"></a>
Updated Nov 17, 2026Created Aug 21, 2026Published Nov 17, 2026

README

payload-ai-manager

npm node license payload ecommerce

Claude, ChatGPT, Gemini and Kimi for Payload. Writes product titles, descriptions, attribute lists and translations into the fields you name and no others, and refuses to pay for the same content twice.

  • Four providers, selected from the admin panel: Claude, ChatGPT, Gemini, Kimi
  • Automatic on save, or on demand through one endpoint
  • Stores a fingerprint of what it generated, so unchanged content is never sent again
  • The API key can live in an environment variable and never touch your database
  • No runtime dependencies, and no admin components, so it survives Payload's minor releases

What it writes

kindOutputDefault maxLength
titleA product title on one line. Names the product, not its benefits. No quotes, no trailing full stop.70
descriptionA product description in plain prose. No headings, no markdown, no bullet points.unlimited
attributesAn array of Name: value strings, only for attributes the source material supports.unlimited
translationThe source material in the locale you name. Translates only — adds and removes nothing.unlimited

The 70 character default on title is where a product title stops being read in listings, search results and browser tabs. Override it per target with maxLength.

Turning a field off without a deploy

Every target gets a switch under Fields to write in the settings global, labelled with the field and what is written into it. An editor can turn one off without touching the config or redeploying. A target that is off is not sent to the model at all, and the content already in that field is left exactly as it is — nothing is cleared.

Fields the plugin writes to carry a note under them in the edit view saying so. This is Payload's admin.description, plain text rather than a custom component: components are the part of the admin that changes between minor releases, and this plugin is built to survive those untouched. A field that already has its own description keeps it.

Compatibility

RequirementVersionDeclared as
payload>=3.88 <4peer dependency
@payloadcms/plugin-ecommerce>=3.88 <4peer dependency
@anthropic-ai/sdk>=0.60.0 <1optional peer dependency, needed only for Claude
Node>=20engines

The floor is the version this package was actually tested against, not the oldest that might work. Verified end to end on Payload 3.88.0 with the official ecommerce plugin, on both PostgreSQL and MongoDB. When a newer version is verified the floor moves up and a release goes out.

Install

Requires Payload 3.88 or newer and @payloadcms/plugin-ecommerce 3.88 or newer.

pnpm add payload-ai-manager

Claude is called through the official Anthropic SDK, which is an optional peer dependency. Install it only if you intend to use Claude:

pnpm add @anthropic-ai/sdk

ChatGPT, Gemini and Kimi are called over their REST APIs with fetch and need nothing installed. If Claude is selected while the SDK is absent, generation fails with a message telling you to install it; nothing crashes and no other provider is affected.

import { aiManagerPlugin } from 'payload-ai-manager'

export default buildConfig({
  plugins: [
    aiManagerPlugin({
      collections: {
        products: {
          sourceFields: ['title', 'brand', 'categories'],
          targets: [
            { field: 'title', kind: 'title' },
            { field: 'description', kind: 'description', maxLength: 600 },
            { field: 'attributes', kind: 'attributes' },
            { field: 'descriptionEl', kind: 'translation', locale: 'Greek' },
          ],
          auto: false,
        },
      },
    }),
  ],
})

Then open AI Manager in the admin panel, choose a provider, point it at a key, and switch generation on. Nothing is sent anywhere until you do.

What was measured

Measured on 21 August 2026 against @payloadcms/plugin-ecommerce 3.88.0 and the npm registry.

QuestionAnswer
Does the ecommerce plugin generate any content?No. Nothing in it calls a model
Is there already an AI plugin for Payload?Yes, @ai-stack/payloadcms, actively maintained
Does it support Kimi?No. Its published files contain no reference to moonshot or kimi
Does it know the ecommerce plugin, or product attributes?No. Neither term appears in it
Does it record what it already generated?No fingerprint, no already-generated guard
How large is it?1.6 MB, with 19 files importing React

That is the gap: four providers including Kimi, aimed at a product catalogue, refusing to regenerate content that has not changed, in about 24 kB with no React anywhere.

Verified against the real endpoints

Every provider was called at its real endpoint with a deliberately invalid key. All four rejected the credential and nothing else, which means all four accepted the shape of the request.

ProviderResponse to an invalid key
Claude401 authentication_error, "API key is invalid."
ChatGPT401, "Incorrect API key provided"
Kimi401, "Invalid Authentication"
Gemini400 INVALID_ARGUMENT, "API key not valid."

Gemini reports a bad key as 400, not 401, so the error body is inspected before a 400 is classified. All four surface as an authentication failure carrying the provider's own wording.

The successful path was exercised against a local server answering in each vendor's response shape. No valid key has been used, so a successful generation from a real vendor has not been observed.

Behaviour under stress

SituationResult
Model returns every field emptyRefused. Existing copy is left untouched
Model answers only some fieldsOnly those fields are written
Model returns text that is not JSONRefused with INVALID_RESPONSE
Model returns 900 characters against a maxLength of 400Truncated to 400
Provider returns 429Refused with RATE_LIMIT
Claude returns stop_reason: refusalRefused with REFUSED
Provider takes 6 seconds, auto offThe save takes 0.06 seconds. It does not wait
Prompt injection in a source fieldStays in the user message. It never reaches the system prompt
__proto__ in the model's JSONNo prototype pollution. Only configured targets are read
Endpoint called with no token, or a bad one403

How it works

Both paths, automatic and manual, run through the same function. Six gates stand between a save and a paid API call, in this order:

  1. The plugin is enabled and the collection is configured
  2. Generation is switched on in the admin panel
  3. A known provider is selected and a key resolves
  4. At least one source field actually carries content
  5. The fingerprint differs from the stored one, or force was passed
  6. The model returned something usable

Failing any of the first five is a skipped with a reason. Failing the sixth is a failed. Neither ever leaves a document half written.

Why it does not regenerate

Every generated document stores a fingerprint: a SHA-256 over the source field values and the target definitions, truncated to 32 characters.

Including the targets matters. Change your instructions, add a target or alter a locale, and the fingerprint changes, so the document is regenerated even though the product itself did not change.

The hash is stable in the ways that would otherwise cause false work. Key order does not affect it at any depth. A relationship counts as its id, so reading a document at depth 0 or depth 2 produces the same answer. A field that is absent and a field set to null are the same thing.

The prompt

The system prompt is assembled from your targets: one line per field, worded differently for each kind — prose for a description, Name: value for attributes, translate-only for a translation. Above them sit the rules against invention. Below them, your house style.

The user message contains only the source fields you named. Whatever a catalogue editor typed stays there and is never promoted into the system prompt.

The automatic path

The afterChange hook marks req.context before saving its result, and returns early when it sees that mark. One save produces one API call, not a loop. A failure is logged and the save proceeds: losing generated copy is better than losing the document.

Providers

ProviderTransportRequest shapeDefault model
ClaudeOfficial SDK, imported dynamicallyoutput_config.format with a JSON schema, thinking: adaptiveclaude-opus-5
ChatGPTfetchresponse_format.json_schema, strict: truegpt-4.1
Kimifetch, same code as ChatGPTidentical, different base URLkimi-k2-0905-preview
GeminifetchresponseSchema, with additionalProperties strippedgemini-2.5-flash

Kimi's API is OpenAI compatible, so it reuses that client with https://api.moonshot.ai/v1. Mainland China users set the base URL to https://api.moonshot.cn/v1. Gemini rejects additionalProperties, so that keyword is removed for Gemini only.

Every provider is asked for a JSON object matching a schema built from your targets, with all of them required.

Options

OptionDefaultMeaning
collectionsrequiredWhich collections take part, keyed by slug
collections[slug].sourceFieldsrequiredFields read to build the prompt. A missing one is skipped, not an error
collections[slug].targetsrequiredFields written. At least one
collections[slug].autofalseGenerate on create, and whenever the source fields change
disabledfalseStops generation, leaves fields and settings in place
maxOutputTokens2048Upper bound per request
settingsSlug'ai-manager'Slug of the settings global
statusField'aiStatus'Name of the group recording what was generated

Each target takes:

FieldRequiredMeaning
fieldyesThe field written. Dot paths are not supported
kindyesdescription, attributes or translation
localefor translationThe target language, in words
instructionsnoExtra wording appended for this target only
maxLengthnoApplied to the result, not requested from the model

A value that cannot be used is replaced by its default rather than applied: a negative maxLength becomes no limit, a maxOutputTokens of 0 becomes 2048, and 4096.9 becomes 4096. A target with an unknown kind, or a translation with no locale, is dropped rather than guessed at. A collection left without a usable target takes no part at all.

What it adds to your database

WhereFieldNotes
each configured collectionaiStatus groupgeneratedAt, provider, model, fields, and a hidden indexed fingerprint
new global ai-managerprovider, model, key, base URL, house styleAppears in the admin menu under Ecommerce

The settings are an ordinary Payload global, which is why they appear in the menu without this package shipping a single React component.

Settings and keys

The global carries two key fields, and the order matters.

API key environment variable holds the name of an environment variable. It is read at request time and never stored. This is the recommended field.

API key is the fallback, used only when the variable is empty or unset. It is written to your database in clear text, and its read access is closed, so neither REST nor GraphQL ever returns it. It exists because a shop owner without deploy access still needs a way in.

The House style field is appended to every prompt. Use it to say how the shop speaks, what to avoid, and which claims are not permitted.

Endpoint

POST /api/ai-manager/generate
{ "collection": "products", "id": 42, "force": false }

Requires an authenticated user, and reads the document with the caller's own access rights. force: true ignores the fingerprint.

ResponseMeaning
{"status":"generated","fields":[...]}Written. fields lists what changed
{"status":"skipped","reason":"..."}Nothing sent. Reason is disabled, not-configured, no-source or unchanged
{"status":"failed","reason":"..."}The provider or its answer failed. HTTP 502, prefixed with a code such as AUTH or RATE_LIMIT

Honest limits

No successful generation from a real vendor has been observed. Every provider has been reached at its real endpoint and has accepted the shape of the request, but only with an invalid key. The successful path was exercised against a local recording server. Treat your first run with a real key as the real test.

Simultaneous requests for the same document each cost a call. Every Payload request runs in its own transaction, so requests fired at the same instant cannot see each other's uncommitted fingerprint: measured, five simultaneous calls produced five provider requests instead of one. Sequential requests deduplicate correctly, and that is the path a save or a button click takes. If you drive the endpoint from a script, serialise it.

A model can still be wrong. The prompt forbids inventing specifications and asks for an empty field rather than filler when the source is too thin. It cannot forbid a plausible sentence that happens to be false. Copy for a regulated product should be read before it is published.

Automatic mode costs money on every source change. It is off by default and stays off until you enable it per collection. The fingerprint prevents repeat work, not first work.

With auto enabled, a save waits for the provider. For a bulk import, leave auto off and drive the endpoint yourself.

Model names go stale. Providers retire models. Set the model field explicitly if a default stops resolving.

Changing settingsSlug or statusField later is a schema change. On PostgreSQL, Payload will ask how to migrate the renamed enum and table, and a non-interactive deploy will stall waiting for that answer. Decide both names before the first deploy, or run the migration deliberately.

One field, one value. Dot paths are not supported, so a target inside a group or an array cannot be addressed. Rich text fields receive plain strings.

License

MIT. Copyright George Vasiliades, https://github.com/Poseidonas

Similar plugins