curl -X POST "https://api.photio.io/v1/inference/generate" \
-H "Content-Type: application/json" \
-H "X-Photio-Key: YOUR_API_KEY" \
-d '{
"prompt": "Your prompt here", // Required
"negative_prompt": "Your negative prompt here", // Optional
"quality": "HIGH", // Optional: "LOW", "MIDDLE", "HIGH"
"seed": -1, // Optional: Integer
"cfg_scale": 1 // Optional: Float
}'
const requestBody = {
prompt: "Your prompt here", // Required
negative_prompt: "Your negative prompt here", // Optional
quality: "HIGH", // Optional: "LOW", "MIDDLE", "HIGH"
seed: -1, // Optional: Integer
cfg_scale: 1 // Optional: Float
};
fetch("https://api.photio.io/v1/inference/generate", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-Photio-Key": "YOUR_API_KEY",
},
body: JSON.stringify(requestBody),
}).then(response => {
// Handle response
});
import requests
request_body = {
"prompt": "Your prompt here", // Required
"negative_prompt": "Your negative prompt here", // Optional
"quality": "HIGH", // Optional: "LOW", "MIDDLE", "HIGH"
"seed": -1, // Optional: Integer
"cfg_scale": 1 // Optional: Float
}
response = requests.post(
"https://api.photio.io/v1/inference/generate",
json=request_body,
headers={"X-Photio-Key": "YOUR_API_KEY"},
)
print(response.text)
import okhttp3.OkHttpClient
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.RequestBody.Companion.toRequestBody
import okhttp3.Request
val client = OkHttpClient()
val mediaType = "application/json; charset=utf-8".toMediaType()
val body = """
{
"prompt": "Your prompt here", // Required
"negative_prompt": "Your negative prompt here", // Optional
"quality": "HIGH", // Optional: "LOW", "MIDDLE", "HIGH"
"seed": -1, // Optional: Integer
"cfg_scale": 1 // Optional: Float
}
""".trimIndent().toRequestBody(mediaType)
val request = Request.Builder()
.url("https://api.photio.io/v1/inference/generate")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-Photio-Key", "YOUR_API_KEY")
.build()
client.newCall(request).execute().use { response ->
println(response.body?.string())
}
import Foundation
let url = URL(string: "https://api.photio.io/v1/inference/generate")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.addValue("YOUR_API_KEY", forHTTPHeaderField: "X-Photio-Key") // Replace with your API key
let requestBody: [String: Any] = [
"prompt": "Your prompt here", // Required
"negative_prompt": "Your negative prompt here", // Optional
"quality": "HIGH", // Optional: "LOW", "MIDDLE", "HIGH"
"seed": -1, // Optional: Integer
"cfg_scale": 1 // Optional: Float
]
request.httpBody = try? JSONSerialization.data(withJSONObject: requestBody)
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print("Error: \(error?.localizedDescription ?? "Unknown error")")
return
}
// Process the response data here
}
task.resume()
curl -X POST "https://api.photio.io/v1/inference/remove-background" \
-H "X-Photio-Key: YOUR_API_KEY" \
-F "file=@/path/to/your/image.jpg" // Replace with the path to your image
const fetch = require('node-fetch');
const FormData = require('form-data');
const fs = require('fs');
const form = new FormData();
form.append('file', fs.createReadStream('/path/to/your/image.jpg')); // Replace with the path to your image
fetch('https://api.photio.io/v1/inference/remove-background', {
method: 'POST',
headers: {
'X-Photio-Key': 'YOUR_API_KEY', // Replace with your actual API key
...form.getHeaders(),
},
body: form,
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
import requests
url = 'https://api.photio.io/v1/inference/remove-background'
files = {'file': open('/path/to/your/image.jpg', 'rb')} # Replace with the path to your image
headers = {'X-Photio-Key': 'YOUR_API_KEY'} # Replace with your actual API key
response = requests.post(url, files=files, headers=headers)
print(response.text)
import okhttp3.*
import java.io.File
val client = OkHttpClient()
val mediaType = MediaType.parse("image/jpeg") // or "image/png" depending on your file
val file = File("/path/to/your/image.jpg") // Replace with the path to your image
val requestBody = MultipartBody.Builder()
.setType(MultipartBody.FORM)
.addFormDataPart("file", file.name, RequestBody.create(mediaType, file))
.build()
val request = Request.Builder()
.url("https://api.photio.io/v1/inference/remove-background")
.post(requestBody)
.addHeader("X-Photio-Key", "YOUR_API_KEY") // Replace with your actual API key
.build()
client.newCall(request).execute().use { response ->
println(response.body()?.string())
}
import Foundation
let url = URL(string: "https://api.photio.io/v1/inference/remove-background")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.addValue("YOUR_API_KEY", forHTTPHeaderField: "X-Photio-Key") // Replace with your API key
let boundary = "Boundary-\(UUID().uuidString)"
request.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type")
let fileUrl = URL(fileURLWithPath: "/path/to/your/image.jpg") // Replace with the path to your image
let fileData = try? Data(contentsOf: fileUrl)
let filename = fileUrl.lastPathComponent
var body = Data()
body.append("--\(boundary)\r\n".data(using: .utf8)!)
body.append("Content-Disposition: form-data; name=\"file\"; filename=\"\(filename)\"\r\n".data(using: .utf8)!)
body.append("Content-Type: image/jpeg\r\n\r\n".data(using: .utf8)!) // or "image/png" for PNG images
body.append(fileData!)
body.append("\r\n".data(using: .utf8)!)
body.append("--\(boundary)--\r\n".data(using: .utf8)!)
request.httpBody = body
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data, error == nil else {
print("Error: \(error?.localizedDescription ?? "Unknown error")")
return
}
// Process the response data here
}
task.resume()
curl -X POST "https://api.photio.io/v1/inference/remix" \
-H "Content-Type: application/json" \
-H "X-Photio-Key: YOUR_API_KEY" \
-d '{
"prompt": "Your prompt here", // Required
"negative_prompt": "If any", // Optional
"quality": "MIDDLE", // Optional: "LOW", "MIDDLE", "HIGH"
"seed": -1, // Optional: -1 for random
"cfg_scale": 1, // Optional: Default 1
"outline_fidelity": 1, // Optional: Default 1
"product_image": "Base64 encoded string", // Required
"ref_image": "Base64 encoded string", // Required
"style_fidelity": 0.7 // Optional: Default 0.7
}'
const requestBody = {
prompt: "Your prompt here", // Required
negative_prompt: "If any", // Optional
quality: "MIDDLE", // Optional: "LOW", "MIDDLE", "HIGH"
seed: -1, // Optional: -1 for random
cfg_scale: 1, // Optional: Default 1
outline_fidelity: 1, // Optional: Default 1
product_image: "Base64 encoded string", // Required
ref_image: "Base64 encoded string", // Required
style_fidelity: 0.7 // Optional: Default 0.7
};
fetch("https://api.photio.io/v1/inference/remix", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-Photio-Key": "YOUR_API_KEY",
},
body: JSON.stringify(requestBody),
}).then(response => {
// Handle response
});
import requests
request_body = {
"prompt": "Your prompt here", # Required
"negative_prompt": "If any", # Optional
"quality": "MIDDLE", # Optional: "LOW", "MIDDLE", "HIGH"
"seed": -1, # Optional: -1 for random
"cfg_scale": 1, # Optional: Default 1
"outline_fidelity": 1, # Optional: Default 1
"product_image": "Base64 encoded string", # Required
"ref_image": "Base64 encoded string", # Required
"style_fidelity": 0.7 # Optional: Default 0.7
}
response = requests.post(
"https://api.photio.io/v1/inference/remix",
json=request_body,
headers={"X-Photio-Key": "YOUR_API_KEY"},
)
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.RequestBody.Companion.toRequestBody
import okhttp3.MediaType.Companion.toMediaType
val client = OkHttpClient()
val mediaType = "application/json; charset=utf-8".toMediaType()
val body = """
{
"prompt": "Your prompt here", // Required
"negative_prompt": "If any", // Optional
"quality": "MIDDLE", // Optional: "LOW", "MIDDLE", "HIGH"
"seed": -1, // Optional: -1 for random
"cfg_scale": 1, // Optional: Default 1
"outline_fidelity": 1, // Optional: Default 1
"product_image": "Base64 encoded string", // Required
"ref_image": "Base64 encoded string", // Required
"style_fidelity": 0.7 // Optional: Default 0.7
}
""".trimIndent().toRequestBody(mediaType)
val request = Request.Builder()
.url("https://api.photio.io/v1/inference/remix")
.post(body)
.addHeader("X-Photio-Key", "YOUR_API_KEY")
.build()
client.newCall(request).execute().use { response ->
// Handle response
}
import Foundation
let url = URL(string: "https://api.photio.io/v1/inference/remix")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.addValue("YOUR_API_KEY", forHTTPHeaderField: "X-Photio-Key") // Replace with your API key
let requestBody: [String: Any] = [
"prompt": "Your prompt here", // Required
"negative_prompt": "If any", // Optional
"quality": "MIDDLE", // Optional: "LOW", "MIDDLE", "HIGH"
"seed": -1, // Optional: -1 for random
"cfg_scale": 1, // Optional: Default 1
"outline_fidelity": 1, // Optional: Default 1
"product_image": "Base64 encoded string", // Required
"ref_image": "Base64 encoded string", // Required
"style_fidelity": 0.7 // Optional: Default 0.7
]
request.httpBody = try? JSONSerialization.data(withJSONObject: requestBody)
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print("Error: \(error?.localizedDescription ?? "Unknown error")")
return
}
// Process the response data here
}
task.resume()
curl -X POST "https://api.photio.io/v1/inference/regen" \
-H "Content-Type: application/json" \
-H "X-Photio-Key: YOUR_API_KEY" \
-d '{
"prompt": "Your prompt here", // Required
"negative_prompt": "If any", // Optional
"quality": "MIDDLE", // Optional: "LOW", "MIDDLE", "HIGH"
"seed": -1, // Optional: -1 for random
"cfg_scale": 1.0, // Optional: Default 1.0
"mask_image": "Base64 encoded string", // Required
"base_image": "Base64 encoded string" // Optional
}'
const requestBody = {
prompt: "Your prompt here", // Required
negative_prompt: "If any", // Optional
quality: "MIDDLE", // Optional: "LOW", "MIDDLE", "HIGH"
seed: -1, // Optional: -1 for random
cfg_scale: 1.0, // Optional: Default 1.0
mask_image: "Base64 encoded string", // Required
base_image: "Base64 encoded string" // Optional
};
fetch("https://api.photio.io/v1/inference/regen", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-Photio-Key": "YOUR_API_KEY",
},
body: JSON.stringify(requestBody),
}).then(response => {
// Handle response
});
import requests
request_body = {
"prompt": "Your prompt here", # Required
"negative_prompt": "If any", # Optional
"quality": "MIDDLE", # Optional: "LOW", "MIDDLE", "HIGH"
"seed": -1, # Optional: -1 for random
"cfg_scale": 1.0, # Optional: Default 1.0
"mask_image": "Base64 encoded string", # Required
"base_image": "Base64 encoded string" # Optional
}
response = requests.post(
"https://api.photio.io/v1/inference/regen",
json=request_body,
headers={"X-Photio-Key": "YOUR_API_KEY"},
)
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.RequestBody.Companion.toRequestBody
import okhttp3.MediaType.Companion.toMediaType
val client = OkHttpClient()
val mediaType = "application/json; charset=utf-8".toMediaType()
val body = """
{
"prompt": "Your prompt here", // Required
"negative_prompt": "If any", // Optional
"quality": "MIDDLE", // Optional: "LOW", "MIDDLE", "HIGH"
"seed": -1, // Optional: -1 for random
"cfg_scale": 1.0, // Optional: Default 1.0
"mask_image": "Base64 encoded string", // Required
"base_image": "Base64 encoded string" // Optional
}
""".trimIndent().toRequestBody(mediaType)
val request = Request.Builder()
.url("https://api.photio.io/v1/inference/regen")
.post(body)
.addHeader("X-Photio-Key", "YOUR_API_KEY")
.build()
client.newCall(request).execute().use { response ->
// Handle response
}
import Foundation
let url = URL(string: "https://api.photio.io/v1/inference/regen")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.addValue("YOUR_API_KEY", forHTTPHeaderField: "X-Photio-Key") // Replace with your API key
let requestBody: [String: Any] = [
"prompt": "Your prompt here", // Required
"negative_prompt": "If any", // Optional
"quality": "MIDDLE", // Optional: "LOW", "MIDDLE", "HIGH"
"seed": -1, // Optional: -1 for random
"cfg_scale": 1.0, // Optional: Default 1.0
"mask_image": "Base64 encoded string", // Required
"base_image": "Base64 encoded string" // Optional
]
request.httpBody = try? JSONSerialization.data(withJSONObject: requestBody)
let task = URLSession
curl -X POST "https://api.photio.io/v1/inference/instant" \
-H "Content-Type: application/json" \
-H "X-Photio-Key: YOUR_API_KEY" \
-d '{
"seed": -1, // Default is -1
"product_image": "Base64 encoded string", // Required
"product_description": "Description of the product" // Required
}'
const requestBody = {
seed: -1, // Default is -1
product_image: "Base64 encoded string", // Required
product_description: "Description of the product" // Required
};
fetch("https://api.photio.io/v1/inference/instant", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-Photio-Key": "YOUR_API_KEY",
},
body: JSON.stringify(requestBody),
}).then(response => {
// Handle response
});
import requests
request_body = {
"seed": -1, # Default is -1
"product_image": "Base64 encoded string", # Required
"product_description": "Description of the product" # Required
}
response = requests.post(
"https://api.photio.io/v1/inference/instant",
json=request_body,
headers={"X-Photio-Key": "YOUR_API_KEY"},
)
print(response.text)
import okhttp3.OkHttpClient
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.RequestBody.Companion.toRequestBody
import okhttp3.Request
val client = OkHttpClient()
val mediaType = "application/json; charset=utf-8".toMediaType()
val body = """
{
"seed": -1, // Default is -1
"product_image": "Base64 encoded string", // Required
"product_description": "Description of the product" // Required
}
""".trimIndent().toRequestBody(mediaType)
val request = Request.Builder()
.url("https://api.photio.io/v1/inference/instant")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-Photio-Key", "YOUR_API_KEY")
.build()
client.newCall(request).execute().use { response ->
println(response.body?.string())
}
import Foundation
let url = URL(string: "https://api.photio.io/v1/inference/instant")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.addValue("YOUR_API_KEY", forHTTPHeaderField: "X-Photio-Key") // Replace with your API key
let requestBody: [String: Any] = [
"seed": -1, // Default is -1
"product_image": "Base64 encoded string", // Required
"product_description": "Description of the product" // Required
]
request.httpBody = try? JSONSerialization.data(withJSONObject: requestBody)
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print("Error: \(error?.localizedDescription ?? "Unknown error")")
return
}
// Process the response data here
}
task.resume()
curl -X POST "https://api.photio.io/v1/inference/upscale" \
-H "Content-Type: application/json" \
-H "X-Photio-Key: YOUR_API_KEY" \
-d '{
"prompt": "Your prompt here", // Required
"negative_prompt": "If any", // Optional
"quality": "MIDDLE", // Optional: "LOW", "MIDDLE", "HIGH"
"image": "Base64 encoded string", // Required
"upscale_by": 2 // Optional: Upscale factor, default is 2
}'
const requestBody = {
prompt: "Your prompt here", // Required
negative_prompt: "If any", // Optional
quality: "MIDDLE", // Optional: "LOW", "MIDDLE", "HIGH"
image: "Base64 encoded string", // Required
upscale_by: 2 // Optional: Upscale factor, default is 2
};
fetch("https://api.photio.io/v1/inference/upscale", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-Photio-Key": "YOUR_API_KEY",
},
body: JSON.stringify(requestBody),
}).then(response => {
// Handle response
});
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.RequestBody.Companion.toRequestBody
import okhttp3.MediaType.Companion.toMediaType
val client = OkHttpClient()
val mediaType = "application/json; charset=utf-8".toMediaType()
val body = """
{
"prompt": "Your prompt here", // Required
"negative_prompt": "If any", // Optional
"quality": "MIDDLE", // Optional: "LOW", "MIDDLE", "HIGH"
"image": "Base64 encoded string", // Required
"upscale_by": 2 // Optional: Upscale factor, default is 2
}
""".trimIndent().toRequestBody(mediaType)
val request = Request.Builder()
.url("https://api.photio.io/v1/inference/upscale")
.post(body)
.addHeader("X-Photio-Key", "YOUR_API_KEY")
.build()
client.newCall(request).execute().use { response ->
// Handle response
}
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.RequestBody.Companion.toRequestBody
import okhttp3.MediaType.Companion.toMediaType
val client = OkHttpClient()
val mediaType = "application/json; charset=utf-8".toMediaType()
val body = """
{
"prompt": "Your prompt here",
"negative_prompt": "",
"quality": "MIDDLE",
"seed": -1,
"cfg_scale": 1
}
""".trimIndent().toRequestBody(mediaType)
val request = Request.Builder()
.url("https://api.photio.io/v1/photio/generate")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("Authentication", "YOUR_API_KEY")
.build()
client.newCall(request).execute().use { response ->
val responseString = response.body?.string()
// Handle the response
}
import Foundation
let url = URL(string: "https://api.photio.io/v1/inference/upscale")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.addValue("YOUR_API_KEY", forHTTPHeaderField: "X-Photio-Key") // Replace with your API key
let requestBody: [String: Any] = [
"prompt": "Your prompt here", // Required
"negative_prompt": "If any", // Optional
"quality": "MIDDLE", // Optional: "LOW", "MIDDLE", "HIGH"
"image": "Base64 encoded string", // Required
"upscale_by": 2 // Optional: Upscale factor, default is 2
]
request.httpBody = try? JSONSerialization.data(withJSONObject: requestBody)
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print("Error: \(error?.localizedDescription ?? "Unknown error")")
return
}
// Process the response data here
}
task.resume()
The Photio API is a RestAPI that allows you to integrate an AI capable of creating product catalog photos into your application. It can be incorporated into any program to edit and generate photos. Choose the API that best fits your service and try it out with a test run. Photio offers the first 40 API calls for free.
Each call to the API is charged at a rate of $0.05. This means that every time the API is utilized, a small fee is deducted from your account. We recommend budgeting your API usage accordingly, especially for high-volume applications, to manage costs effectively.
Yes, to help you get started and test our API without immediate costs, we provide 40 free API calls each month. These free calls are reset at the beginning of each calendar month, allowing you to try different features without financial commitment.
Payments for API usage are processed through our secure dashboard. To manage your payments, you must register a valid credit or debit card in your account settings. Charges will be automatically applied to your card based on your API usage at the end of each billing cycle.
To obtain an API key, you first need to create an account on our dashboard. Once your account is set up and your payment method is registered, you can generate an API key directly from the dashboard. This key will be used to authenticate your API requests.
There is no upper limit on the number of API calls you can make. However, keep in mind that each call beyond your monthly quota of 40 free calls will be charged at $0.05 per call. We advise monitoring your usage through the dashboard to avoid unexpected charges.
If you exceed your quota of 40 free calls in a month, each additional API call will be charged at the standard rate of $0.05. Charges for these additional calls will be automatically calculated and billed to your registered payment method.
Yes, our dashboard provides detailed tracking of your API usage and expenditures. You can view your current and past usage, monitor the number of free calls remaining for the month, and check the charges accrued for any additional calls. This tool is designed to help you manage and forecast your API expenditures effectively.