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:
@@ -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/')) {
|
||||
|
||||
Reference in New Issue
Block a user