diff --git a/scripts/image-gen.ps1 b/scripts/image-gen.ps1 index e5ecfc7..bdfa4a9 100644 --- a/scripts/image-gen.ps1 +++ b/scripts/image-gen.ps1 @@ -79,7 +79,7 @@ $sw = [System.Diagnostics.Stopwatch]::StartNew() $r = $null # --- attempt 1: b64_json --- -$body = @{ model = $resolvedModel; prompt = $Prompt; n = $N; size = $Size; response_format = 'b64_json' } | ConvertTo-Json -Depth 5 +$body = @{ model = $resolvedModel; prompt = $Prompt; n = $N; size = $Size; extra_body = @{ response_format = 'b64_json' } } | ConvertTo-Json -Depth 5 try { $resp = Invoke-WebRequest -Uri $endpoint -Method Post -Headers @{ Authorization = "Bearer $resolvedKey" } -ContentType 'application/json; charset=utf-8' -Body $body -TimeoutSec $TimeoutSec $sw.Stop() @@ -94,7 +94,7 @@ try { # Some providers reject b64_json; retry once with response_format=url. if ($status -eq 400 -or $status -eq 422) { Write-Err "WARN: b64_json rejected (status $status); retrying with response_format=url." - $bodyUrl = @{ model = $resolvedModel; prompt = $Prompt; n = $N; size = $Size; response_format = 'url' } | ConvertTo-Json -Depth 5 + $bodyUrl = @{ model = $resolvedModel; prompt = $Prompt; n = $N; size = $Size; extra_body = @{ response_format = 'url' } } | ConvertTo-Json -Depth 5 try { $sw.Restart() $resp = Invoke-WebRequest -Uri $endpoint -Method Post -Headers @{ Authorization = "Bearer $resolvedKey" } -ContentType 'application/json; charset=utf-8' -Body $bodyUrl -TimeoutSec $TimeoutSec