Add an AIGen-only generate API for external tools.

Cursor and similar clients can enqueue Studio 2 stills with the same steps and CFG the bench uses, through session or AIGEN_API_KEY.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Towsty
2026-10-26 19:05:28 -05:00
co-authored by Cursor
parent 68469d9c71
commit 2b603b1d58
12 changed files with 399 additions and 9 deletions
+3
View File
@@ -21,6 +21,7 @@ import {
} from '~/utils/keepPrompts'
import { familyBaseName, nextClipPartName, clipPartLabel } from '~/utils/libraryBrowse'
import { musicExtension } from '~/utils/music'
import { aigenBearerAuthorized, aigenInstanceOwnerKey } from '~/server/utils/aigenApiAuth'
export { familyBaseName, nextClipPartName, clipPartLabel }
@@ -197,6 +198,8 @@ export function libraryRoot() {
export function libraryOwnerKey(event: H3Event) {
if (passwordAuthEnabled()) return privateInstanceId()
// AIGen API key: same catalog as the unauthenticated local owner. Never invent a second tree.
if (aigenBearerAuthorized(event)) return aigenInstanceOwnerKey()
const user = getSessionUser(event)
const raw = user?.sub || user?.email || (!authEnabled() ? 'local' : '')
if (!raw) {