Google: Fix image generation on deprecated models

This commit is contained in:
Cohee
2025-06-21 23:54:36 +03:00
parent 0677777a74
commit 5605265862
+4 -2
View File
@@ -426,6 +426,8 @@ router.post('/generate-image', async (request, response) => {
// AI Studio is stricter than Vertex AI.
const isVertex = request.body.api === 'vertexai';
// Is it even worth it?
const isDeprecated = model.startsWith('imagegeneration');
const requestBody = {
instances: [{
@@ -437,9 +439,9 @@ router.post('/generate-image', async (request, response) => {
enhancePrompt: isVertex ? Boolean(request.body.enhance ?? false) : undefined,
negativePrompt: isVertex ? (request.body.negative_prompt || undefined) : undefined,
aspectRatio: String(request.body.aspect_ratio || '1:1'),
personGeneration: 'allow_all',
personGeneration: !isDeprecated ? 'allow_all' : undefined,
language: isVertex ? 'auto' : undefined,
safetySetting: isVertex ? 'block_only_high' : 'block_low_and_above',
safetySetting: !isDeprecated ? (isVertex ? 'block_only_high' : 'block_low_and_above') : undefined,
addWatermark: isVertex ? false : undefined,
outputOptions: {
mimeType: 'image/jpeg',