curl --request POST \
--url https://api.hopscotchlabs.ai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "vertex-ai/gemini-3.1-flash-image",
"prompt": "A small blue circle centered on a plain white background. No text.",
"n": 1,
"size": "1024x1024",
"response_format": "b64_json"
}
'import requests
url = "https://api.hopscotchlabs.ai/v1/images/generations"
payload = {
"model": "vertex-ai/gemini-3.1-flash-image",
"prompt": "A small blue circle centered on a plain white background. No text.",
"n": 1,
"size": "1024x1024",
"response_format": "b64_json"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'vertex-ai/gemini-3.1-flash-image',
prompt: 'A small blue circle centered on a plain white background. No text.',
n: 1,
size: '1024x1024',
response_format: 'b64_json'
})
};
fetch('https://api.hopscotchlabs.ai/v1/images/generations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.hopscotchlabs.ai/v1/images/generations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'vertex-ai/gemini-3.1-flash-image',
'prompt' => 'A small blue circle centered on a plain white background. No text.',
'n' => 1,
'size' => '1024x1024',
'response_format' => 'b64_json'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.hopscotchlabs.ai/v1/images/generations"
payload := strings.NewReader("{\n \"model\": \"vertex-ai/gemini-3.1-flash-image\",\n \"prompt\": \"A small blue circle centered on a plain white background. No text.\",\n \"n\": 1,\n \"size\": \"1024x1024\",\n \"response_format\": \"b64_json\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.hopscotchlabs.ai/v1/images/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"vertex-ai/gemini-3.1-flash-image\",\n \"prompt\": \"A small blue circle centered on a plain white background. No text.\",\n \"n\": 1,\n \"size\": \"1024x1024\",\n \"response_format\": \"b64_json\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hopscotchlabs.ai/v1/images/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"vertex-ai/gemini-3.1-flash-image\",\n \"prompt\": \"A small blue circle centered on a plain white background. No text.\",\n \"n\": 1,\n \"size\": \"1024x1024\",\n \"response_format\": \"b64_json\"\n}"
response = http.request(request)
puts response.read_bodyGenerate images
Generate an image with a model offered for image_generations. For Vertex Gemini, request one image as b64_json at a supported square resolution. Image support through chat alone does not establish this endpoint is available.
Published prices determine whether the offering is token-metered or charged per image. Preserve Gemini image-token usage and use GET /v1/usage/ to read the settled charge.
curl --request POST \
--url https://api.hopscotchlabs.ai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "vertex-ai/gemini-3.1-flash-image",
"prompt": "A small blue circle centered on a plain white background. No text.",
"n": 1,
"size": "1024x1024",
"response_format": "b64_json"
}
'import requests
url = "https://api.hopscotchlabs.ai/v1/images/generations"
payload = {
"model": "vertex-ai/gemini-3.1-flash-image",
"prompt": "A small blue circle centered on a plain white background. No text.",
"n": 1,
"size": "1024x1024",
"response_format": "b64_json"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'vertex-ai/gemini-3.1-flash-image',
prompt: 'A small blue circle centered on a plain white background. No text.',
n: 1,
size: '1024x1024',
response_format: 'b64_json'
})
};
fetch('https://api.hopscotchlabs.ai/v1/images/generations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.hopscotchlabs.ai/v1/images/generations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'vertex-ai/gemini-3.1-flash-image',
'prompt' => 'A small blue circle centered on a plain white background. No text.',
'n' => 1,
'size' => '1024x1024',
'response_format' => 'b64_json'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.hopscotchlabs.ai/v1/images/generations"
payload := strings.NewReader("{\n \"model\": \"vertex-ai/gemini-3.1-flash-image\",\n \"prompt\": \"A small blue circle centered on a plain white background. No text.\",\n \"n\": 1,\n \"size\": \"1024x1024\",\n \"response_format\": \"b64_json\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.hopscotchlabs.ai/v1/images/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"vertex-ai/gemini-3.1-flash-image\",\n \"prompt\": \"A small blue circle centered on a plain white background. No text.\",\n \"n\": 1,\n \"size\": \"1024x1024\",\n \"response_format\": \"b64_json\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hopscotchlabs.ai/v1/images/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"vertex-ai/gemini-3.1-flash-image\",\n \"prompt\": \"A small blue circle centered on a plain white background. No text.\",\n \"n\": 1,\n \"size\": \"1024x1024\",\n \"response_format\": \"b64_json\"\n}"
response = http.request(request)
puts response.read_bodyAuthorizations
Body
Generate an image with an offering that publishes image_generations in endpoint_families. Accepted controls depend on the offering.
Response
The image list. Vertex Gemini returns base64 image data and reported token usage; image-output tokens and text tokens use their respective published customer rates. This JSON endpoint does not stream. Other offerings may publish per-image prices. A missing image or inconsistent required image-usage details is a failed response.