curl https://api.pipellm.ai/v1/images/variations \
-H "Authorization: Bearer $PIPELLM_API_KEY" \
-F model="dall-e-2" \
-F image="@logo.png" \
-F n=2 \
-F size="1024x1024"
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["PIPELLM_API_KEY"],
base_url="https://api.pipellm.ai/v1",
)
result = client.images.create_variation(
model="dall-e-2",
image=open("logo.png", "rb"),
n=2,
size="1024x1024",
)
print([item.url for item in result.data])
{
"created": 1726400000,
"data": [
{ "url": "https://..." },
{ "url": "https://..." }
]
}
Create an image variation
Generate variations of a source image.
POST
/
v1
/
images
/
variations
curl https://api.pipellm.ai/v1/images/variations \
-H "Authorization: Bearer $PIPELLM_API_KEY" \
-F model="dall-e-2" \
-F image="@logo.png" \
-F n=2 \
-F size="1024x1024"
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["PIPELLM_API_KEY"],
base_url="https://api.pipellm.ai/v1",
)
result = client.images.create_variation(
model="dall-e-2",
image=open("logo.png", "rb"),
n=2,
size="1024x1024",
)
print([item.url for item in result.data])
{
"created": 1726400000,
"data": [
{ "url": "https://..." },
{ "url": "https://..." }
]
}
Upstream, this endpoint only supports
dall-e-2. GPT image models do not implement it. To vary an image with a GPT image model, send the source to POST /v1/images/edits with a prompt describing the variation you want.multipart/form-data.
file
required
Source image. Must be a square PNG under 4 MB.
string
default:"dall-e-2"
Only
dall-e-2 implements variations.integer
default:"1"
Number of variations, 1–10.
string
default:"1024x1024"
256x256, 512x512, or 1024x1024.string
default:"url"
url or b64_json. URLs expire about 60 minutes after generation, so download promptly.string
Stable end-user identifier.
curl https://api.pipellm.ai/v1/images/variations \
-H "Authorization: Bearer $PIPELLM_API_KEY" \
-F model="dall-e-2" \
-F image="@logo.png" \
-F n=2 \
-F size="1024x1024"
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["PIPELLM_API_KEY"],
base_url="https://api.pipellm.ai/v1",
)
result = client.images.create_variation(
model="dall-e-2",
image=open("logo.png", "rb"),
n=2,
size="1024x1024",
)
print([item.url for item in result.data])
{
"created": 1726400000,
"data": [
{ "url": "https://..." },
{ "url": "https://..." }
]
}
integer
Unix timestamp of the generation.
array
One entry per variation, carrying
url or b64_json depending on response_format.Errors
Same envelope as Errors. A non-square or oversized source returns400; a model that does not implement variations returns the upstream’s error unchanged.Was this page helpful?