gen-queue is a WordPress plugin that runs paid generation work on behalf of other plugins. It is for plugin developers who call a paid API in bulk and for the site operators who have to pay for it. The code is at https://github.com/IndianOpinion/gen-queue, licensed MIT, and version v0.1.0 was released on 15 November 2026.
It holds no prompts and calls no provider. Another plugin registers a handler, enqueues jobs and reports what each call cost. We wrote it from scratch from an idea, with no third-party plugin as a starting point. It has not run on a live site.
The 47 utilities in this series were specified, built, reviewed and released between 11 and 19 November 2026 by language-model coding agents working under the editor’s direction, in five roles: a spec writer, a spec reviewer, a builder that saw only the spec, an independent code reviewer and a releaser. The editor made the rulings on every open question.
Plugins that call a paid API in bulk each write the same loop, and each gets the same things wrong. The PRD lists them:
gen-queue does that loop once. The plugin that generates things writes only a handler.
There are three tables: jobs, attempts (one row per run of a handler, with its cost and local day) and a small lock table. Settings and breaker state are options. Every database call goes through a storage interface with a $wpdb implementation and an in-memory double for tests.
A runner is a WP-Cron tick or wp gen-queue run. Both use Runner::run(). The steps per job are:
run_after, then id.gen_queue_can_run filter and spend-meter, then claim the job with one conditional UPDATE that only matches a row still queued.A job may run when spent today plus reserved plus its estimate is at most the cap. Money is held as integer nanos. Costs count on the site’s local day on which the attempt started. If a worker dies, its lease expires, the next runner closes the attempt as abandoned and retries the job. A late result from the dead worker is discarded, but its cost is kept.
A handler looks like this, taken from the README:
add_action('gen_queue_register_types', function (): void {
gen_queue_register_type('my-plugin.summary', 'my_summary_handler', [
'resource_key' => 'my-provider/small-model',
'group' => 'my-provider',
'cost_estimate' => '0.01',
'timeout' => 60,
]);
});
gen_queue_enqueue('my-plugin.summary', ['post_id' => 42], ['idempotency_key' => 'summary-42']);
GEN_QUEUE_DISABLED forces the queue off, and the kill switch option cannot turn it back on.The independent code review found and fixed these before the merge:
attempts and run_after in the UPDATE.wp gen-queue status --format=json.This is v0.1.0 and there are no open issues. Tests: 155 unit tests against a WordPress stub layer, and 10 integration tests against MySQL 8.0 on a throwaway server, including four runner processes draining one queue with every job run once. Static analysis and code style checks passed. CI has not yet run on GitHub: the workflow commit stayed local because the token lacked the workflow scope.
It needs PHP 8.1 or later, WordPress 6.4 or later, and MySQL 5.7+ or MariaDB 10.4+. It has no runtime dependencies.
The package is not on Packagist yet, so first add a Composer vcs repository entry for https://github.com/IndianOpinion/gen-queue.
composer require indianopinion/gen-queue
wp gen-queue cap 2.50
wp gen-queue run --until-empty
It can also be copied into wp-content/plugins/, or into wp-content/mu-plugins/ with the loader in examples/.