{
"data": [
{
"url": "https://filesystem.site/cdn/20250428/5LsFMT0Def02RVVUkwJ4v7IslleMzo.webp",
"revised_prompt": "A cute fluffy cat with big, bright eyes, soft fur, and a playful expression. It has a light gray coat with hints of white on its paws and tail. The cat is sitting in a cozy setting, surrounded by soft cushions, with its tail wrapped around its paws. Its ears are perked up, and it's looking directly at the viewer, exuding a sense of curiosity and warmth."
}
],
"created": 1745818538
}
import base64
from openai import OpenAI
client = OpenAI(
base_url="https://api.ttapi.io/v1",
api_key="your api key",
)
prompt = """
Generate a photorealistic image of a gift basket on a white background
labeled 'Relax & Unwind' with a ribbon and handwriting-like font,
containing all the items in the reference pictures.
"""
result = client.images.edit(
model="gpt-image-1",
image=[
open("body-lotion.png", "rb"),
open("bath-bomb.png", "rb"),
open("incense-kit.png", "rb"),
open("soap.png", "rb"),
],
prompt=prompt
)
image_base64 = result.data[0].b64_json
image_bytes = base64.b64decode(image_base64)
# Save the image to a file
with open("gift-basket.png", "wb") as f:
f.write(image_bytes)
import fs from "fs";
import OpenAI, { toFile } from "openai";
const client = new OpenAI({
apiKey: "your api key",
baseURL: "https://api.ttapi.io/v1"
});
const imageFiles = [
"bath-bomb.png",
"body-lotion.png",
"incense-kit.png",
"soap.png",
];
const images = await Promise.all(
imageFiles.map(async (file) =>
await toFile(fs.createReadStream(file), null, {
type: "image/png",
})
),
);
const rsp = await client.images.edit({
model: "gpt-image-1",
image: images,
prompt: "Create a lovely gift basket with these four items in it",
});
// Save the image to a file
const image_base64 = rsp.data[0].b64_json;
const image_bytes = Buffer.from(image_base64, "base64");
fs.writeFileSync("basket.png", image_bytes);
{
"status": "SUCCESS",
"message": "success",
"data": {
"created": 1713577682,
"data": [
{
"revised_prompt": "A serene, domestic scene unfolding at dusk: a fluffy, long-haired tabby cat with piercing green eyes and distinctive black and white stripes curled up on a cozy, burgundy-colored velvet cushion. Around the cat is the warmth of a rustic country home, with wooden beams and a crackling fireplace. Light streams in through a large, arched window, painting the scene in the beautiful, ethereal light of golden hour.",
"url": "https://dalleprodaue.blob.core.windows.net/private/images/cbb4adae-b889-4adf-9b84-4cd6d72d74fc/generated_00.png?se=2024-04-21T01%3A48%3A14Z&sig=th9fuLXfJVtLUOWu%2BfkJk1aY8abDZTDe7aIWJ1QzLkY%3D&ske=2024-04-26T13%3A43%3A10Z&skoid=f4f58869-78fa-4857-8a87-4ce5ae4ba8c3&sks=b&skt=2024-04-19T13%3A43%3A10Z&sktid=33e01921-4d64-4f8c-a055-5bdaffd5e33d&skv=2020-10-02&sp=r&spr=https&sr=b&sv=2020-10-02"
}
]
}
}
{
"status": "FAILED",
"message": "For the dall-e-3 model, \"size\" must be one of 1024x1024, 1792x1024, or 1024x1792.",
"data": null
}