PHOTA Image Edit
curl --request POST \
--url https://api.aihubmax.com/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "phota-image-edit",
"prompt": "Change the background to a tropical beach at sunset",
"image_urls": [
"https://example.com/portrait.jpg"
],
"num_outputs": 1,
"resolution": "1K"
}
'import requests
url = "https://api.aihubmax.com/v1/images/generations"
payload = {
"model": "phota-image-edit",
"prompt": "Change the background to a tropical beach at sunset",
"image_urls": ["https://example.com/portrait.jpg"],
"num_outputs": 1,
"resolution": "1K"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'phota-image-edit',
prompt: 'Change the background to a tropical beach at sunset',
image_urls: ['https://example.com/portrait.jpg'],
num_outputs: 1,
resolution: '1K'
})
};
fetch('https://api.aihubmax.com/v1/images/generations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aihubmax.com/v1/images/generations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'phota-image-edit',
'prompt' => 'Change the background to a tropical beach at sunset',
'image_urls' => [
'https://example.com/portrait.jpg'
],
'num_outputs' => 1,
'resolution' => '1K'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aihubmax.com/v1/images/generations"
payload := strings.NewReader("{\n \"model\": \"phota-image-edit\",\n \"prompt\": \"Change the background to a tropical beach at sunset\",\n \"image_urls\": [\n \"https://example.com/portrait.jpg\"\n ],\n \"num_outputs\": 1,\n \"resolution\": \"1K\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.aihubmax.com/v1/images/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"phota-image-edit\",\n \"prompt\": \"Change the background to a tropical beach at sunset\",\n \"image_urls\": [\n \"https://example.com/portrait.jpg\"\n ],\n \"num_outputs\": 1,\n \"resolution\": \"1K\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aihubmax.com/v1/images/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"phota-image-edit\",\n \"prompt\": \"Change the background to a tropical beach at sunset\",\n \"image_urls\": [\n \"https://example.com/portrait.jpg\"\n ],\n \"num_outputs\": 1,\n \"resolution\": \"1K\"\n}"
response = http.request(request)
puts response.read_body{
"created": 1757165031,
"id": "task-unified-1757165031-uyujaw3d",
"model": "<string>",
"object": "image.generation.task",
"progress": 0,
"status": "pending",
"task_info": {
"can_cancel": true,
"estimated_time": 45
},
"type": "image"
}{
"error": {
"message": "Invalid request parameters",
"type": "invalid_request_error"
}
}{
"error": {
"message": "Invalid API key",
"type": "authentication_error"
}
}{
"error": {
"message": "Insufficient balance",
"type": "insufficient_quota"
}
}{
"error": {
"message": "Parameter validation failed",
"type": "validation_error"
}
}{
"error": {
"message": "Rate limit exceeded",
"type": "rate_limit_error"
}
}{
"error": {
"message": "Internal server error",
"type": "server_error"
}
}{
"error": {
"message": "Service temporarily unavailable, please try again later",
"type": "service_unavailable"
}
}Phota
Phota Image Editing
- PHOTA image editing model
- Supports 1K / 4K resolution, supports profile_ids
- Asynchronous processing mode, use the returned task ID to query task status
- Generated image links are valid for 24 hours, please save them promptly
POST
/
v1
/
images
/
generations
PHOTA Image Edit
curl --request POST \
--url https://api.aihubmax.com/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "phota-image-edit",
"prompt": "Change the background to a tropical beach at sunset",
"image_urls": [
"https://example.com/portrait.jpg"
],
"num_outputs": 1,
"resolution": "1K"
}
'import requests
url = "https://api.aihubmax.com/v1/images/generations"
payload = {
"model": "phota-image-edit",
"prompt": "Change the background to a tropical beach at sunset",
"image_urls": ["https://example.com/portrait.jpg"],
"num_outputs": 1,
"resolution": "1K"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'phota-image-edit',
prompt: 'Change the background to a tropical beach at sunset',
image_urls: ['https://example.com/portrait.jpg'],
num_outputs: 1,
resolution: '1K'
})
};
fetch('https://api.aihubmax.com/v1/images/generations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aihubmax.com/v1/images/generations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'phota-image-edit',
'prompt' => 'Change the background to a tropical beach at sunset',
'image_urls' => [
'https://example.com/portrait.jpg'
],
'num_outputs' => 1,
'resolution' => '1K'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aihubmax.com/v1/images/generations"
payload := strings.NewReader("{\n \"model\": \"phota-image-edit\",\n \"prompt\": \"Change the background to a tropical beach at sunset\",\n \"image_urls\": [\n \"https://example.com/portrait.jpg\"\n ],\n \"num_outputs\": 1,\n \"resolution\": \"1K\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.aihubmax.com/v1/images/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"phota-image-edit\",\n \"prompt\": \"Change the background to a tropical beach at sunset\",\n \"image_urls\": [\n \"https://example.com/portrait.jpg\"\n ],\n \"num_outputs\": 1,\n \"resolution\": \"1K\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aihubmax.com/v1/images/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"phota-image-edit\",\n \"prompt\": \"Change the background to a tropical beach at sunset\",\n \"image_urls\": [\n \"https://example.com/portrait.jpg\"\n ],\n \"num_outputs\": 1,\n \"resolution\": \"1K\"\n}"
response = http.request(request)
puts response.read_body{
"created": 1757165031,
"id": "task-unified-1757165031-uyujaw3d",
"model": "<string>",
"object": "image.generation.task",
"progress": 0,
"status": "pending",
"task_info": {
"can_cancel": true,
"estimated_time": 45
},
"type": "image"
}{
"error": {
"message": "Invalid request parameters",
"type": "invalid_request_error"
}
}{
"error": {
"message": "Invalid API key",
"type": "authentication_error"
}
}{
"error": {
"message": "Insufficient balance",
"type": "insufficient_quota"
}
}{
"error": {
"message": "Parameter validation failed",
"type": "validation_error"
}
}{
"error": {
"message": "Rate limit exceeded",
"type": "rate_limit_error"
}
}{
"error": {
"message": "Internal server error",
"type": "server_error"
}
}{
"error": {
"message": "Service temporarily unavailable, please try again later",
"type": "service_unavailable"
}
}Authorizations
All APIs require Bearer Token authentication
Add to request header:
Authorization: Bearer YOUR_API_KEY
Body
application/json
phota-image-edit: Image editing, supports profile
Example:
"phota-image-edit"
Editing prompt
Notes:
- Describe the editing requirements for the input image
Example:
"Change the background to a tropical beach at sunset"
Input image URL list
Notes:
- Images to edit
- Must be publicly accessible URLs
Example:
["https://example.com/portrait.jpg"]
Number of output images
Notes:
- Each image is billed independently
Example:
1
Output image resolution
Options:
1K— Standard resolution4K— High resolution (double price)
Example:
"1K"
Profile ID list
Notes:
- Profile IDs created by
phota-create-profile - Used to maintain character consistency in editing results
Do not pass this parameter unless necessary.
Example:
["profile_abc123"]
Response
Task created successfully
Task creation timestamp
Example:
1757165031
Task ID
Example:
"task-unified-1757165031-uyujaw3d"
Actual model name used
Specific task type
Available options:
image.generation.task Task progress percentage (0-100)
Required range:
0 <= x <= 100Example:
0
Task status
Available options:
pending, processing, completed, failed Example:
"pending"
Async task information
Show child attributes
Show child attributes
Task output type
Available options:
image Example:
"image"