Skip to content

Commit 62c1709

Browse files
authored
Merge pull request #643 from Portkey-AI/mintlify/add-gemini-pr-630-changes-88554
Add image_config parameter to Gemini image generation examples
2 parents c23a7b8 + a4c1a88 commit 62c1709

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

integrations/llms/gemini.mdx

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2185,6 +2185,10 @@ response = portkey.chat.completions.create(
21852185
max_tokens=32768,
21862186
stream=False,
21872187
modalities=["image"],
2188+
image_config={ # optional
2189+
"aspect_ratio": "16:9",
2190+
"image_size": "2K"
2191+
},
21882192
messages=[
21892193
{
21902194
"role": "system",
@@ -2224,6 +2228,10 @@ async function generateImage() {
22242228
max_tokens: 32768,
22252229
stream: false,
22262230
modalities: ["image"],
2231+
image_config: { // optional
2232+
aspect_ratio: "16:9",
2233+
image_size: "2K"
2234+
},
22272235
messages: [
22282236
{
22292237
role: "system",
@@ -2269,6 +2277,10 @@ async function generateImage() {
22692277
max_tokens: 32768,
22702278
stream: false,
22712279
modalities: ["image"],
2280+
image_config: { // optional
2281+
aspect_ratio: "16:9",
2282+
image_size: "2K"
2283+
},
22722284
messages: [
22732285
{
22742286
role: "system",
@@ -2310,6 +2322,10 @@ response = openai.chat.completions.create(
23102322
max_tokens=32768,
23112323
stream=False,
23122324
modalities=["image"],
2325+
image_config={ # optional
2326+
"aspect_ratio": "16:9",
2327+
"image_size": "2K"
2328+
},
23132329
messages=[
23142330
{
23152331
"role": "system",
@@ -2341,6 +2357,10 @@ curl "https://api.portkey.ai/v1/chat/completions" \
23412357
"max_tokens": 32768,
23422358
"stream": false,
23432359
"modalities": ["image"],
2360+
"image_config": {
2361+
"aspect_ratio": "16:9",
2362+
"image_size": "2K"
2363+
},
23442364
"messages": [
23452365
{
23462366
"role": "system",
@@ -2371,6 +2391,10 @@ response = portkey.chat.completions.create(
23712391
max_tokens=32768,
23722392
stream=False,
23732393
modalities=["text", "image"], # Include both text and image
2394+
image_config={ # optional
2395+
"aspect_ratio": "16:9",
2396+
"image_size": "2K"
2397+
},
23742398
messages=[
23752399
{
23762400
"role": "user",
@@ -2391,6 +2415,10 @@ const response = await portkey.chat.completions.create({
23912415
max_tokens: 32768,
23922416
stream: false,
23932417
modalities: ["text", "image"], // Include both text and image
2418+
image_config: { // optional
2419+
aspect_ratio: "16:9",
2420+
image_size: "2K"
2421+
},
23942422
messages: [
23952423
{
23962424
role: "user",
@@ -2417,6 +2445,10 @@ curl "https://api.portkey.ai/v1/chat/completions" \
24172445
"max_tokens": 32768,
24182446
"stream": false,
24192447
"modalities": ["text", "image"],
2448+
"image_config": {
2449+
"aspect_ratio": "16:9",
2450+
"image_size": "2K"
2451+
},
24202452
"messages": [
24212453
{
24222454
"role": "user",
@@ -2443,6 +2475,10 @@ initial_response = portkey.chat.completions.create(
24432475
model="gemini-3-pro-image-preview",
24442476
max_tokens=32768,
24452477
modalities=["text", "image"],
2478+
image_config={ # optional
2479+
"aspect_ratio": "16:9",
2480+
"image_size": "2K"
2481+
},
24462482
messages=[
24472483
{
24482484
"role": "user",
@@ -2464,6 +2500,10 @@ edit_response = portkey.chat.completions.create(
24642500
model="gemini-3-pro-image-preview",
24652501
max_tokens=32768,
24662502
modalities=["text", "image"],
2503+
image_config={ # optional
2504+
"aspect_ratio": "16:9",
2505+
"image_size": "2K"
2506+
},
24672507
messages=[
24682508
{
24692509
"role": "user",
@@ -2494,6 +2534,10 @@ const initialResponse = await portkey.chat.completions.create({
24942534
model: "gemini-3-pro-image-preview",
24952535
max_tokens: 32768,
24962536
modalities: ["text", "image"],
2537+
image_config: { // optional
2538+
aspect_ratio: "16:9",
2539+
image_size: "2K"
2540+
},
24972541
messages: [
24982542
{
24992543
role: "user",
@@ -2515,6 +2559,10 @@ const editResponse = await portkey.chat.completions.create({
25152559
model: "gemini-3-pro-image-preview",
25162560
max_tokens: 32768,
25172561
modalities: ["text", "image"],
2562+
image_config: { // optional
2563+
aspect_ratio: "16:9",
2564+
image_size: "2K"
2565+
},
25182566
messages: [
25192567
{
25202568
role: "user",

0 commit comments

Comments
 (0)