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
+7
View File
@@ -1,3 +1,6 @@
import { aigenApiPathAllowed, aigenBearerAuthorized } from '~/server/utils/aigenApiAuth'
import { isXaigenStudio } from '~/utils/videoModels'
export default defineEventHandler((event) => {
if (!authEnabled()) return
const path = getRequestURL(event).pathname
@@ -15,6 +18,10 @@ export default defineEventHandler((event) => {
) {
return
}
const method = String(event.method || getMethod(event) || 'GET').toUpperCase()
if (!isXaigenStudio() && aigenApiPathAllowed(path, method) && aigenBearerAuthorized(event)) {
return
}
const user = getSessionUser(event)
if (user) return
if (path.startsWith('/api/')) {