Skip to main content

CLI bulk generation

bin/magento seosuite:meta:generate
-e <entity_type> # product | category | cms_page (default: product)
[-i <ids>] # Comma-separated entity IDs (omit for all)
[-s <store_id>] # Default 0 (admin), use 1 for first store view
[-l <limit>] # Cap entities scanned (useful for samples)
[--dry-run] # List the entities that would be processed and exit
[-b <batch_id>] # Identifier for the run (default: cli-YYYYMMDD-HHMMSS)

Recipes

Sample 50 products from store 1

bin/magento seosuite:meta:generate -e product -s 1 -l 50

Generates 50 suggestions; review at Marketing → SEO Suite → AI Meta Suggestions filtered by Batch.

Specific products only

bin/magento seosuite:meta:generate -e product -i 1234,5678,9101 -s 1

All categories in store 1

bin/magento seosuite:meta:generate -e category -s 1

CMS pages, dry run first

bin/magento seosuite:meta:generate -e cms_page --dry-run
# → lists the page IDs that would be processed
bin/magento seosuite:meta:generate -e cms_page
# → actually generates

Tagged batch for a marketing campaign

bin/magento seosuite:meta:generate -e product -s 2 \
-i 100,101,102,103,104 \
-b "summer-sale-2026"

Then in the admin grid, filter Batch = summer-sale-2026 to see exactly which suggestions belong to this run before approving them as a group.

Quarterly refresh of a category tree

# Get the IDs first
bin/magento seosuite:meta:generate -e product -s 1 \
--dry-run --limit 200 > products.txt

# Then run for real with the batch tag
bin/magento seosuite:meta:generate -e product -s 1 \
--limit 200 -b "q2-2026-refresh"

What you'll see

Found 50 product entities. Batch: cli-20260425-141200. Store: en_gb.
50/50 [████████████████████████████] 100% 0:01:23 — id 1234
Done. ok=48 failed=2. Tokens: in=42850 (cached=38120) out=5760.
Review at: Marketing → SEO Suite → AI Meta Suggestions

The token totals tell you the cache is working — cached should be ~85–95% of in after the first few rows in a batch.

Exit codes

  • 0 — all rows succeeded, or some failed but at least one succeeded
  • 1 — every single row failed (usually means API key is misconfigured)

So seosuite:meta:generate ... && echo OK is reliable in CI.

Performance notes

  • Each row makes one API call — wall-clock time is dominated by Claude latency (~1–3s per call for Haiku 4.5)
  • Sequential, not parallelised — for a 5000-product run, expect ~2 hours wall-clock at Haiku speeds
  • The cache TTL is 5 minutes — long enough that a continuous batch keeps hitting cache; short enough that two batches separated by an idle gap will recompute the system blocks once

If you need to parallelise across thousands of SKUs, run multiple instances against disjoint ID ranges (-i 1-1000, -i 1001-2000, etc.) on the same Magento install — each process gets its own cache window but they don't interfere with each other.

Cost rough sizing

For Haiku 4.5 on a typical product (~600 chars description input):

  • Input: ~700 tokens (cached after row 1: ~85% discount)
  • Output: ~120 tokens

Approximate cost for a 1000-SKU Haiku run with caching working: $0.50–$1.00.

Failures

Rows that fail are still persisted to the queue with status=failed and the error message in the error column. Re-run them by extracting their IDs and rerunning with -i:

SELECT GROUP_CONCAT(target_id) FROM byte8_seosuite_meta_suggestion
WHERE batch_id = 'cli-20260425-141200' AND status = 'failed';

Then:

bin/magento seosuite:meta:generate -e product -i <list>