4Z API

Image generation

Endpoint: POST https://4zapi.com/v1beta/models/{modeName}:generateContent

Official documentation: https://ai.google.dev/gemini-api/docs/image-generation?hl=zh-cn

Parameters

  • modeName (path, string, required): Model name: gemini-2.5-flash-image gemini-2.5-flash-image-preview gemini-3-pro-image-preview gemini-3.1-flash-image-preview
  • key (query, string, required): API Key (Authorization: Bearer also supported)
  • Content-Type (header, string, required): Request body content type, usually application/json

Request body (application/json)

  • contents (array<object>, required): List of conversation contents; each item has parts (text/image/etc.)
  • generationConfig (object): Generate configuration
  • response_format (string): Fill in the url and return the url, if not fill in the default base64