OpenAI comp: Image generation

Hi @GUNAND_MAYANGLAMBAM and @Vishal

After accessing the models successfully I ran my testsuite of REST API calls and I stumbled upon an issue generating image(s). First, giving you the context from the API reference documentation of GenerateImagesRequest that has a property called responseFormat:

Optional. The format in which the generated images are returned. Must be one of url or b64Json

While using the value b64Json the call returns an HTTP 200 OK but not so when using the value url:

{
  "error": {
    "code": 400,
    "message": "Unsupported response format: url. Supported formats are: b64_json.",
    "status": "INVALID_ARGUMENT"
  }
}

Kindly fix one of it - API reference docs or API endpoint - to provide consistency. Thanks.

Here’s the REST call for reference:

#format: b64Json or Url
POST https://generativelanguage.googleapis.com/v1beta/openai/images/generations
Authorization: Bearer {{apiKey}}
Content-Type: application/json

{
  "prompt": "High-resolution image of Andromeda galaxy, 8k",
  "model": "imagen-3.0-generate-002",
  "response_format": "url",
  "n": 1,
  "quality": "hd"
}

Ref: OpenAI compatibility  |  Gemini API  |  Google AI for Developers

1 Like

Hey @jkirstaetter, great catch! I’ll escalate to the engineering team. Thanks.

1 Like

Got confirmation that the response_format ‘url’ is not supported. The documentation will be updated accordingly.

1 Like

Thanks @GUNAND_MAYANGLAMBAM

Sad but as expected.

Google AI could leverage the user’s Drive space (like AI Studio does it already) whereas Vertex AI could use a designated GCS bucket though. Just an idea. :slight_smile:

Cheers.