curl -X POST "https://apolloai.lol/v1/generation/image/edit" \
-H "x-api-key: <api_key>" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A futuristic city skyline with flying cars",
"image": "<base64_image_data>",
"mask": "<base64_mask_data>",
"size": "1024x1024",
"n": 1
}'
import requests
# For local development, use: http://localhost:3000/v1/generation/image/edit
url = "https://apolloai.lol/v1/generation/image/edit"
headers = {
"x-api-key": "<api_key>",
"Content-Type": "application/json"
}
data = {
"prompt": "A futuristic city skyline with flying cars",
"image": "<base64_image_data>",
"mask": "<base64_mask_data>",
"size": "1024x1024",
"n": 1
}
try:
response = requests.post(url, headers=headers, json=data)
response.raise_for_status()
print(response.json())
except requests.exceptions.HTTPError as err:
print(f"HTTP Error: {err}")
print(f"Response Body: {response.text}")
except Exception as err:
print(f"Error: {err}")
const url = "https://apolloai.lol/v1/generation/image/edit";
const headers = {
"x-api-key": "<api_key>",
"Content-Type": "application/json"
};
const body = JSON.stringify({
prompt: "A futuristic city skyline with flying cars",
image: "<base64_image_data>",
mask: "<base64_mask_data>",
size: "1024x1024",
n: 1
});
fetch(url, { method: "POST", headers, body })
.then(async response => {
if (!response.ok) {
const text = await response.text();
throw new Error(`HTTP error! status: ${response.status}, body: ${text}`);
}
return response.json();
})
.then(console.log)
.catch(console.error);
package main
import (
"bytes"
"fmt"
"net/http"
"io/ioutil"
)
func main() {
// For local development, use: http://localhost:3000/v1/generation/image/edit
url := "https://apolloai.lol/v1/generation/image/edit"
var jsonStr = []byte(`{
"prompt":"A futuristic city skyline with flying cars",
"image":"<base64_image_data>",
"mask":"<base64_mask_data>",
"size":"1024x1024",
"n": 1
}`)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonStr))
req.Header.Set("x-api-key", "<api_key>")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
if resp.StatusCode >= 400 {
fmt.Printf("Error (Status %d): %s\n", resp.StatusCode, string(body))
} else {
fmt.Println(string(body))
}
}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
public class Main {
public static void main(String[] args) throws Exception {
// For local development, use: http://localhost:3000/v1/generation/image/edit
String url = "https://apolloai.lol/v1/generation/image/edit";
String json = "{\"prompt\":\"A futuristic city skyline with flying cars\", \"image\":\"<base64_image_data>\", \"mask\":\"<base64_mask_data>\", \"size\":\"1024x1024\", \"n\": 1}";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("x-api-key", "<api_key>")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
client.sendAsync(request, BodyHandlers.ofString())
.thenAccept(response -> {
if (response.statusCode() >= 400) {
System.out.println("Error (Status " + response.statusCode() + "): " + response.body());
} else {
System.out.println(response.body());
}
})
.join();
}
}
require 'uri'
require 'net/http'
require 'json'
url = URI("https://apolloai.lol/v1/generation/image/edit")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = "<api_key>"
request["Content-Type"] = "application/json"
request.body = JSON.dump({
"prompt": "A futuristic city skyline with flying cars",
"image": "<base64_image_data>",
"mask": "<base64_mask_data>",
"size": "1024x1024",
"n": 1
})
response = http.request(request)
puts response.read_body
#include <stdio.h>
#include <curl/curl.h>
int main(void) {
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "https://apolloai.lol/v1/generation/image/edit");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: <api_key>");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
const char *data = "{\"prompt\":\"A futuristic city skyline with flying cars\", \"image\":\"<base64_image_data>\", \"mask\":\"<base64_mask_data>\", \"size\":\"1024x1024\", \"n\": 1}";
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
res = curl_easy_perform(curl);
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
}
return 0;
}
use reqwest::Client;
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
let res = client.post("https://apolloai.lol/v1/generation/image/edit")
.header("x-api-key", "<api_key>")
.header("Content-Type", "application/json")
.json(&json!({
"prompt": "A futuristic city skyline with flying cars",
"image": "<base64_image_data>",
"mask": "<base64_mask_data>",
"size": "1024x1024",
"n": 1
}))
.send()
.await?;
let body = res.text().await?;
println!("{}", body);
Ok(())
}
{
"created": 1706859322,
"data": [
{
"b64_json": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII="
}
]
}
{
"error": "Image is required for editing."
}
{
"error": "Invalid API Key."
}
{
"error": "Daily quota exceeded."
}
Image
Edit Image
Edit existing images using inpainting or variation
POST
/
v1
/
generation
/
image
/
edit
curl -X POST "https://apolloai.lol/v1/generation/image/edit" \
-H "x-api-key: <api_key>" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A futuristic city skyline with flying cars",
"image": "<base64_image_data>",
"mask": "<base64_mask_data>",
"size": "1024x1024",
"n": 1
}'
import requests
# For local development, use: http://localhost:3000/v1/generation/image/edit
url = "https://apolloai.lol/v1/generation/image/edit"
headers = {
"x-api-key": "<api_key>",
"Content-Type": "application/json"
}
data = {
"prompt": "A futuristic city skyline with flying cars",
"image": "<base64_image_data>",
"mask": "<base64_mask_data>",
"size": "1024x1024",
"n": 1
}
try:
response = requests.post(url, headers=headers, json=data)
response.raise_for_status()
print(response.json())
except requests.exceptions.HTTPError as err:
print(f"HTTP Error: {err}")
print(f"Response Body: {response.text}")
except Exception as err:
print(f"Error: {err}")
const url = "https://apolloai.lol/v1/generation/image/edit";
const headers = {
"x-api-key": "<api_key>",
"Content-Type": "application/json"
};
const body = JSON.stringify({
prompt: "A futuristic city skyline with flying cars",
image: "<base64_image_data>",
mask: "<base64_mask_data>",
size: "1024x1024",
n: 1
});
fetch(url, { method: "POST", headers, body })
.then(async response => {
if (!response.ok) {
const text = await response.text();
throw new Error(`HTTP error! status: ${response.status}, body: ${text}`);
}
return response.json();
})
.then(console.log)
.catch(console.error);
package main
import (
"bytes"
"fmt"
"net/http"
"io/ioutil"
)
func main() {
// For local development, use: http://localhost:3000/v1/generation/image/edit
url := "https://apolloai.lol/v1/generation/image/edit"
var jsonStr = []byte(`{
"prompt":"A futuristic city skyline with flying cars",
"image":"<base64_image_data>",
"mask":"<base64_mask_data>",
"size":"1024x1024",
"n": 1
}`)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonStr))
req.Header.Set("x-api-key", "<api_key>")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
if resp.StatusCode >= 400 {
fmt.Printf("Error (Status %d): %s\n", resp.StatusCode, string(body))
} else {
fmt.Println(string(body))
}
}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
public class Main {
public static void main(String[] args) throws Exception {
// For local development, use: http://localhost:3000/v1/generation/image/edit
String url = "https://apolloai.lol/v1/generation/image/edit";
String json = "{\"prompt\":\"A futuristic city skyline with flying cars\", \"image\":\"<base64_image_data>\", \"mask\":\"<base64_mask_data>\", \"size\":\"1024x1024\", \"n\": 1}";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("x-api-key", "<api_key>")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
client.sendAsync(request, BodyHandlers.ofString())
.thenAccept(response -> {
if (response.statusCode() >= 400) {
System.out.println("Error (Status " + response.statusCode() + "): " + response.body());
} else {
System.out.println(response.body());
}
})
.join();
}
}
require 'uri'
require 'net/http'
require 'json'
url = URI("https://apolloai.lol/v1/generation/image/edit")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = "<api_key>"
request["Content-Type"] = "application/json"
request.body = JSON.dump({
"prompt": "A futuristic city skyline with flying cars",
"image": "<base64_image_data>",
"mask": "<base64_mask_data>",
"size": "1024x1024",
"n": 1
})
response = http.request(request)
puts response.read_body
#include <stdio.h>
#include <curl/curl.h>
int main(void) {
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "https://apolloai.lol/v1/generation/image/edit");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: <api_key>");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
const char *data = "{\"prompt\":\"A futuristic city skyline with flying cars\", \"image\":\"<base64_image_data>\", \"mask\":\"<base64_mask_data>\", \"size\":\"1024x1024\", \"n\": 1}";
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
res = curl_easy_perform(curl);
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
}
return 0;
}
use reqwest::Client;
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
let res = client.post("https://apolloai.lol/v1/generation/image/edit")
.header("x-api-key", "<api_key>")
.header("Content-Type", "application/json")
.json(&json!({
"prompt": "A futuristic city skyline with flying cars",
"image": "<base64_image_data>",
"mask": "<base64_mask_data>",
"size": "1024x1024",
"n": 1
}))
.send()
.await?;
let body = res.text().await?;
println!("{}", body);
Ok(())
}
{
"created": 1706859322,
"data": [
{
"b64_json": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII="
}
]
}
{
"error": "Image is required for editing."
}
{
"error": "Invalid API Key."
}
{
"error": "Daily quota exceeded."
}
Modify an image based on a text prompt. You can perform inpainting (if a mask is provided) or generate variations of the input image.
Headers
string
required
Your Apollo AI API key.
Body Parameters
string
required
The text description of the desired edit or variation.
string
required
Base64 encoded string of the source image.
string
Base64 encoded string of the mask image (for inpainting). White pixels indicate areas to modify. If omitted, the request is treated as an image variation.
string
default:"1024x1024"
The dimensions of the generated image. Supported values: “1024x1024”, “512x512”.
integer
default:"1"
The number of variation images to generate.
Response
integer
Timestamp of generation.
curl -X POST "https://apolloai.lol/v1/generation/image/edit" \
-H "x-api-key: <api_key>" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A futuristic city skyline with flying cars",
"image": "<base64_image_data>",
"mask": "<base64_mask_data>",
"size": "1024x1024",
"n": 1
}'
import requests
# For local development, use: http://localhost:3000/v1/generation/image/edit
url = "https://apolloai.lol/v1/generation/image/edit"
headers = {
"x-api-key": "<api_key>",
"Content-Type": "application/json"
}
data = {
"prompt": "A futuristic city skyline with flying cars",
"image": "<base64_image_data>",
"mask": "<base64_mask_data>",
"size": "1024x1024",
"n": 1
}
try:
response = requests.post(url, headers=headers, json=data)
response.raise_for_status()
print(response.json())
except requests.exceptions.HTTPError as err:
print(f"HTTP Error: {err}")
print(f"Response Body: {response.text}")
except Exception as err:
print(f"Error: {err}")
const url = "https://apolloai.lol/v1/generation/image/edit";
const headers = {
"x-api-key": "<api_key>",
"Content-Type": "application/json"
};
const body = JSON.stringify({
prompt: "A futuristic city skyline with flying cars",
image: "<base64_image_data>",
mask: "<base64_mask_data>",
size: "1024x1024",
n: 1
});
fetch(url, { method: "POST", headers, body })
.then(async response => {
if (!response.ok) {
const text = await response.text();
throw new Error(`HTTP error! status: ${response.status}, body: ${text}`);
}
return response.json();
})
.then(console.log)
.catch(console.error);
package main
import (
"bytes"
"fmt"
"net/http"
"io/ioutil"
)
func main() {
// For local development, use: http://localhost:3000/v1/generation/image/edit
url := "https://apolloai.lol/v1/generation/image/edit"
var jsonStr = []byte(`{
"prompt":"A futuristic city skyline with flying cars",
"image":"<base64_image_data>",
"mask":"<base64_mask_data>",
"size":"1024x1024",
"n": 1
}`)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonStr))
req.Header.Set("x-api-key", "<api_key>")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
if resp.StatusCode >= 400 {
fmt.Printf("Error (Status %d): %s\n", resp.StatusCode, string(body))
} else {
fmt.Println(string(body))
}
}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
public class Main {
public static void main(String[] args) throws Exception {
// For local development, use: http://localhost:3000/v1/generation/image/edit
String url = "https://apolloai.lol/v1/generation/image/edit";
String json = "{\"prompt\":\"A futuristic city skyline with flying cars\", \"image\":\"<base64_image_data>\", \"mask\":\"<base64_mask_data>\", \"size\":\"1024x1024\", \"n\": 1}";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("x-api-key", "<api_key>")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
client.sendAsync(request, BodyHandlers.ofString())
.thenAccept(response -> {
if (response.statusCode() >= 400) {
System.out.println("Error (Status " + response.statusCode() + "): " + response.body());
} else {
System.out.println(response.body());
}
})
.join();
}
}
require 'uri'
require 'net/http'
require 'json'
url = URI("https://apolloai.lol/v1/generation/image/edit")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = "<api_key>"
request["Content-Type"] = "application/json"
request.body = JSON.dump({
"prompt": "A futuristic city skyline with flying cars",
"image": "<base64_image_data>",
"mask": "<base64_mask_data>",
"size": "1024x1024",
"n": 1
})
response = http.request(request)
puts response.read_body
#include <stdio.h>
#include <curl/curl.h>
int main(void) {
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "https://apolloai.lol/v1/generation/image/edit");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-api-key: <api_key>");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
const char *data = "{\"prompt\":\"A futuristic city skyline with flying cars\", \"image\":\"<base64_image_data>\", \"mask\":\"<base64_mask_data>\", \"size\":\"1024x1024\", \"n\": 1}";
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
res = curl_easy_perform(curl);
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
}
return 0;
}
use reqwest::Client;
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
let res = client.post("https://apolloai.lol/v1/generation/image/edit")
.header("x-api-key", "<api_key>")
.header("Content-Type", "application/json")
.json(&json!({
"prompt": "A futuristic city skyline with flying cars",
"image": "<base64_image_data>",
"mask": "<base64_mask_data>",
"size": "1024x1024",
"n": 1
}))
.send()
.await?;
let body = res.text().await?;
println!("{}", body);
Ok(())
}
{
"created": 1706859322,
"data": [
{
"b64_json": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII="
}
]
}
{
"error": "Image is required for editing."
}
{
"error": "Invalid API Key."
}
{
"error": "Daily quota exceeded."
}