curl --request POST \
--url https://api.geekidea.ai/v1/images/edits \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form 'prompt=make the sky orange' \
--form model=openai/gpt-image-2 \
--form 'images={
"image_url": "https://example.com/cat.png",
"file_id": "file-0192f1c3a7b87c3e9a4f5b6c7d8e9f01"
}' \
--form n=1 \
--form quality=medium \
--form size=1024x1024 \
--form response_format=url \
--form 'background=<string>' \
--form 'input_fidelity=<string>' \
--form output_compression=50 \
--form 'output_format=<string>' \
--form partial_images=123 \
--form stream=true \
--form 'user=<string>' \
--form 'generation_config={
"resolution": "2K",
"aspect_ratio": "16:9",
"seed": 123,
"negative_prompt": "<string>"
}' \
--form 'metadata={}' \
--form image=@example-fileimport requests
url = "https://api.geekidea.ai/v1/images/edits"
files = { "image": ("example-file", open("example-file", "rb")) }
payload = {
"prompt": "make the sky orange",
"model": "openai/gpt-image-2",
"images": "{
\"image_url\": \"https://example.com/cat.png\",
\"file_id\": \"file-0192f1c3a7b87c3e9a4f5b6c7d8e9f01\"
}",
"n": "1",
"quality": "medium",
"size": "1024x1024",
"response_format": "url",
"background": "<string>",
"input_fidelity": "<string>",
"output_compression": "50",
"output_format": "<string>",
"partial_images": "123",
"stream": "true",
"user": "<string>",
"generation_config": "{
\"resolution\": \"2K\",
\"aspect_ratio\": \"16:9\",
\"seed\": 123,
\"negative_prompt\": \"<string>\"
}",
"metadata": "{}"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('prompt', 'make the sky orange');
form.append('model', 'openai/gpt-image-2');
form.append('images', '{
"image_url": "https://example.com/cat.png",
"file_id": "file-0192f1c3a7b87c3e9a4f5b6c7d8e9f01"
}');
form.append('n', '1');
form.append('quality', 'medium');
form.append('size', '1024x1024');
form.append('response_format', 'url');
form.append('background', '<string>');
form.append('input_fidelity', '<string>');
form.append('output_compression', '50');
form.append('output_format', '<string>');
form.append('partial_images', '123');
form.append('stream', 'true');
form.append('user', '<string>');
form.append('generation_config', '{
"resolution": "2K",
"aspect_ratio": "16:9",
"seed": 123,
"negative_prompt": "<string>"
}');
form.append('metadata', '{}');
form.append('image', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.geekidea.ai/v1/images/edits', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{}{
"error": {
"message": "The model does not exist or you do not have access to it.",
"type": "not_found_error",
"param": "model",
"code": "model_not_found",
"retryable": false,
"errors": [
{
"param": "messages",
"code": "missing_parameter",
"message": "<string>"
}
]
}
}{
"error": {
"message": "The model does not exist or you do not have access to it.",
"type": "not_found_error",
"param": "model",
"code": "model_not_found",
"retryable": false,
"errors": [
{
"param": "messages",
"code": "missing_parameter",
"message": "<string>"
}
]
}
}{
"error": {
"message": "The model does not exist or you do not have access to it.",
"type": "not_found_error",
"param": "model",
"code": "model_not_found",
"retryable": false,
"errors": [
{
"param": "messages",
"code": "missing_parameter",
"message": "<string>"
}
]
}
}{
"error": {
"message": "The model does not exist or you do not have access to it.",
"type": "not_found_error",
"param": "model",
"code": "model_not_found",
"retryable": false,
"errors": [
{
"param": "messages",
"code": "missing_parameter",
"message": "<string>"
}
]
}
}{
"error": {
"message": "The model does not exist or you do not have access to it.",
"type": "not_found_error",
"param": "model",
"code": "model_not_found",
"retryable": false,
"errors": [
{
"param": "messages",
"code": "missing_parameter",
"message": "<string>"
}
]
}
}{
"error": {
"message": "The model does not exist or you do not have access to it.",
"type": "not_found_error",
"param": "model",
"code": "model_not_found",
"retryable": false,
"errors": [
{
"param": "messages",
"code": "missing_parameter",
"message": "<string>"
}
]
}
}{
"error": {
"message": "The model does not exist or you do not have access to it.",
"type": "not_found_error",
"param": "model",
"code": "model_not_found",
"retryable": false,
"errors": [
{
"param": "messages",
"code": "missing_parameter",
"message": "<string>"
}
]
}
}{
"error": {
"message": "The model does not exist or you do not have access to it.",
"type": "not_found_error",
"param": "model",
"code": "model_not_found",
"retryable": false,
"errors": [
{
"param": "messages",
"code": "missing_parameter",
"message": "<string>"
}
]
}
}Edit images
Compatible with OpenAI images.edit: send reference images as multipart files (image / image[]) or as JSON images[].image_url. The model must support image-to-image; the number of references is limited by max_reference_images in GET /v1/models. mask and file_id are not supported yet. The response and billing are the same as image generation.
curl --request POST \
--url https://api.geekidea.ai/v1/images/edits \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form 'prompt=make the sky orange' \
--form model=openai/gpt-image-2 \
--form 'images={
"image_url": "https://example.com/cat.png",
"file_id": "file-0192f1c3a7b87c3e9a4f5b6c7d8e9f01"
}' \
--form n=1 \
--form quality=medium \
--form size=1024x1024 \
--form response_format=url \
--form 'background=<string>' \
--form 'input_fidelity=<string>' \
--form output_compression=50 \
--form 'output_format=<string>' \
--form partial_images=123 \
--form stream=true \
--form 'user=<string>' \
--form 'generation_config={
"resolution": "2K",
"aspect_ratio": "16:9",
"seed": 123,
"negative_prompt": "<string>"
}' \
--form 'metadata={}' \
--form image=@example-fileimport requests
url = "https://api.geekidea.ai/v1/images/edits"
files = { "image": ("example-file", open("example-file", "rb")) }
payload = {
"prompt": "make the sky orange",
"model": "openai/gpt-image-2",
"images": "{
\"image_url\": \"https://example.com/cat.png\",
\"file_id\": \"file-0192f1c3a7b87c3e9a4f5b6c7d8e9f01\"
}",
"n": "1",
"quality": "medium",
"size": "1024x1024",
"response_format": "url",
"background": "<string>",
"input_fidelity": "<string>",
"output_compression": "50",
"output_format": "<string>",
"partial_images": "123",
"stream": "true",
"user": "<string>",
"generation_config": "{
\"resolution\": \"2K\",
\"aspect_ratio\": \"16:9\",
\"seed\": 123,
\"negative_prompt\": \"<string>\"
}",
"metadata": "{}"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('prompt', 'make the sky orange');
form.append('model', 'openai/gpt-image-2');
form.append('images', '{
"image_url": "https://example.com/cat.png",
"file_id": "file-0192f1c3a7b87c3e9a4f5b6c7d8e9f01"
}');
form.append('n', '1');
form.append('quality', 'medium');
form.append('size', '1024x1024');
form.append('response_format', 'url');
form.append('background', '<string>');
form.append('input_fidelity', '<string>');
form.append('output_compression', '50');
form.append('output_format', '<string>');
form.append('partial_images', '123');
form.append('stream', 'true');
form.append('user', '<string>');
form.append('generation_config', '{
"resolution": "2K",
"aspect_ratio": "16:9",
"seed": 123,
"negative_prompt": "<string>"
}');
form.append('metadata', '{}');
form.append('image', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.geekidea.ai/v1/images/edits', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{}{
"error": {
"message": "The model does not exist or you do not have access to it.",
"type": "not_found_error",
"param": "model",
"code": "model_not_found",
"retryable": false,
"errors": [
{
"param": "messages",
"code": "missing_parameter",
"message": "<string>"
}
]
}
}{
"error": {
"message": "The model does not exist or you do not have access to it.",
"type": "not_found_error",
"param": "model",
"code": "model_not_found",
"retryable": false,
"errors": [
{
"param": "messages",
"code": "missing_parameter",
"message": "<string>"
}
]
}
}{
"error": {
"message": "The model does not exist or you do not have access to it.",
"type": "not_found_error",
"param": "model",
"code": "model_not_found",
"retryable": false,
"errors": [
{
"param": "messages",
"code": "missing_parameter",
"message": "<string>"
}
]
}
}{
"error": {
"message": "The model does not exist or you do not have access to it.",
"type": "not_found_error",
"param": "model",
"code": "model_not_found",
"retryable": false,
"errors": [
{
"param": "messages",
"code": "missing_parameter",
"message": "<string>"
}
]
}
}{
"error": {
"message": "The model does not exist or you do not have access to it.",
"type": "not_found_error",
"param": "model",
"code": "model_not_found",
"retryable": false,
"errors": [
{
"param": "messages",
"code": "missing_parameter",
"message": "<string>"
}
]
}
}{
"error": {
"message": "The model does not exist or you do not have access to it.",
"type": "not_found_error",
"param": "model",
"code": "model_not_found",
"retryable": false,
"errors": [
{
"param": "messages",
"code": "missing_parameter",
"message": "<string>"
}
]
}
}{
"error": {
"message": "The model does not exist or you do not have access to it.",
"type": "not_found_error",
"param": "model",
"code": "model_not_found",
"retryable": false,
"errors": [
{
"param": "messages",
"code": "missing_parameter",
"message": "<string>"
}
]
}
}{
"error": {
"message": "The model does not exist or you do not have access to it.",
"type": "not_found_error",
"param": "model",
"code": "model_not_found",
"retryable": false,
"errors": [
{
"param": "messages",
"code": "missing_parameter",
"message": "<string>"
}
]
}
}Authorizations
Provide your API key in the Authorization header using Bearer auth
Headers
Set to respond-async to process asynchronously: returns 202 with a Generation object right away; poll GET /v1/generations/{id} for the result
Idempotency key for asynchronous requests (up to 255 characters): the same key in the same project is accepted only once, and a repeat returns the existing generation
Body
Image edit multipart form: the JSON fields as form fields (generation_config and metadata as JSON strings) plus reference image files
Prompt
32000"make the sky orange"
Model ID (author/model). See GET /v1/models?type=image
1"openai/gpt-image-2"
Reference images for JSON requests (up to the model's max_reference_images); multipart requests upload files as image / image[] instead
16Show child attributes
Show child attributes
Number of images, 1-10
1 <= x <= 101
Quality: low / medium / high / auto …; affects price
"medium"
Size, e.g. 1024x1024, 1536x1024 or auto
"1024x1024"
Response format: url (default, signed link) / b64_json
"url"
Background: transparent / opaque / auto
How closely to follow the reference images: high / low
Output compression 0-100 (jpeg / webp)
0 <= x <= 100Output format: png / jpeg / webp
Partial images when streaming (streaming not supported yet)
Whether to stream (not supported yet)
End-user identifier for abuse detection
Image generation parameters
Show child attributes
Show child attributes
Caller-defined data (up to 16 keys), shown in billing
Show child attributes
Show child attributes
Reference image files (png / jpeg / webp / gif, up to 20 MB each): image for one file, image[] for several
Response
OK
The response is of type object.
