API ReferenceImageGemini
General API
OpenAI-compatible Gemini image generation and reference-image editing with URL output.
The compatible endpoint follows the OpenAI image format and normally returns an image URL.
Endpoint Information
| Item | Value |
|---|---|
| Endpoint | POST https://api.tokenhub.belivestudios.com/v1/images/generations |
| Authentication | Header Authorization: Bearer sk-your-belive-studios-key |
| Content-Type | application/json |
Generate
curl https://api.tokenhub.belivestudios.com/v1/images/generations \
-H "Authorization: Bearer sk-your-belive-studios-key" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-3.1-flash-image",
"prompt": "A cat running through a neon street after rain, cinematic",
"size": "1k",
"aspect_ratio": "1:1",
"response_format": "url"
}'Reference-Image Editing
Some models support reference images. Put the reference image URL in the request body's image array; use prompt only for the text editing instruction:
curl https://api.tokenhub.belivestudios.com/v1/images/generations \
-H "Authorization: Bearer sk-your-belive-studios-key" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-3.1-flash-image",
"prompt": "Keep the person unchanged and replace the background with a beach sunset",
"size": "1k",
"aspect_ratio": "16:9",
"response_format": "url",
"image": [
"https://example.com/reference.jpg"
]
}'Response
Image generation and reference-image editing use the same response structure. After a successful request, the generated image URL is in data[0].url.
{
"created": 1787888579,
"data": [
{
"b64_json": "",
"revised_prompt": "",
"url": "https://cdn.aiznt.com/relay-temp-images/20260828/b13c70b8-5e24-4936-a54f-d158aadf980a.jpg"
}
]
}| Field | Type | Description |
|---|---|---|
created | integer | Unix timestamp, in seconds, when the response was created |
data | array | List of generated image results |
data[].url | string | Temporary URL for the generated image |
data[].b64_json | string | Base64 image data; normally an empty string in URL response mode |
data[].revised_prompt | string | Server-revised prompt; normally an empty string when none is provided |
Temporary image URL
Download and store the image promptly after receiving the response. Do not use the temporary URL as permanent storage.
Python
import requests
response = requests.post(
"https://api.tokenhub.belivestudios.com/v1/images/generations",
headers={"Authorization": "Bearer sk-your-belive-studios-key"},
json={
"model": "gemini-3.1-flash-image",
"prompt": "A cat running through a neon street after rain, cinematic",
"size": "1k",
"aspect_ratio": "1:1",
"response_format": "url",
},
timeout=300,
)
response.raise_for_status()
print(response.json()["data"][0]["url"])Parameters
| Parameter | Description |
|---|---|
model | Gemini image model ID |
prompt | Generation or editing instruction |
image | Reference image array, when supported by the selected model |
size | Commonly 1k or 2k, subject to model support |
aspect_ratio | Ratio such as 1:1 or 16:9 |
response_format | Usually url |
Use the current console endpoint definition for the complete fields and model capabilities.