curl --request POST \
--url https://api.budgetpixel.com/v1/images/mai-image-2.7 \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "<string>",
"aspect_ratio": "auto",
"background": "opaque",
"num_images": 1,
"output_format": "png",
"reference_images": [
"<string>"
],
"size": "1K"
}
'import requests
url = "https://api.budgetpixel.com/v1/images/mai-image-2.7"
payload = {
"prompt": "<string>",
"aspect_ratio": "auto",
"background": "opaque",
"num_images": 1,
"output_format": "png",
"reference_images": ["<string>"],
"size": "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({
prompt: '<string>',
aspect_ratio: 'auto',
background: 'opaque',
num_images: 1,
output_format: 'png',
reference_images: ['<string>'],
size: '1K'
})
};
fetch('https://api.budgetpixel.com/v1/images/mai-image-2.7', 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.budgetpixel.com/v1/images/mai-image-2.7",
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([
'prompt' => '<string>',
'aspect_ratio' => 'auto',
'background' => 'opaque',
'num_images' => 1,
'output_format' => 'png',
'reference_images' => [
'<string>'
],
'size' => '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.budgetpixel.com/v1/images/mai-image-2.7"
payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"aspect_ratio\": \"auto\",\n \"background\": \"opaque\",\n \"num_images\": 1,\n \"output_format\": \"png\",\n \"reference_images\": [\n \"<string>\"\n ],\n \"size\": \"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.budgetpixel.com/v1/images/mai-image-2.7")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\",\n \"aspect_ratio\": \"auto\",\n \"background\": \"opaque\",\n \"num_images\": 1,\n \"output_format\": \"png\",\n \"reference_images\": [\n \"<string>\"\n ],\n \"size\": \"1K\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.budgetpixel.com/v1/images/mai-image-2.7")
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 \"prompt\": \"<string>\",\n \"aspect_ratio\": \"auto\",\n \"background\": \"opaque\",\n \"num_images\": 1,\n \"output_format\": \"png\",\n \"reference_images\": [\n \"<string>\"\n ],\n \"size\": \"1K\"\n}"
response = http.request(request)
puts response.read_body{
"characters": [
{
"handle": "barry",
"name": "Barry",
"official": true,
"page_url": "<string>"
}
],
"id": "img_a1b2c3d4e5f6",
"message": "<string>",
"model": "<string>",
"status": "pending"
}{
"error": {
"code": "model_not_available",
"message": "<string>",
"type": "invalid_request_error"
}
}{
"error": {
"code": "model_not_available",
"message": "<string>",
"type": "invalid_request_error"
}
}{
"error": {
"code": "model_not_available",
"message": "<string>",
"type": "invalid_request_error"
}
}{
"error": {
"code": "model_not_available",
"message": "<string>",
"type": "invalid_request_error"
}
}Generate image with MAI Image 2.7
Microsoft MAI Image 2.7 — Microsoft’s newest image model: realistic photos, correctly spelled text in images, and precise edits from plain instructions that change what you ask and keep the rest. Text-to-image, plus editing and combining up to 5 input images, at 1K (about 1 MP) or 2K (about 4 MP) in 7 aspect ratios, and transparent backgrounds. Billing: 50 credits per image at 1K, 190 at 2K, plus 11 (1K) or 45 (2K) per input image (each one, per generated image). Prompts up to 8000 characters. No seed or negative prompt.
Asynchronous. Returns a job id (the image is not in this response). Poll GET /v1/images/{id} until status is succeeded — the generated image URLs are in that response’s images array (each { url, position }).
Examples, sample output and pricing: MAI Image 2.7
curl --request POST \
--url https://api.budgetpixel.com/v1/images/mai-image-2.7 \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "<string>",
"aspect_ratio": "auto",
"background": "opaque",
"num_images": 1,
"output_format": "png",
"reference_images": [
"<string>"
],
"size": "1K"
}
'import requests
url = "https://api.budgetpixel.com/v1/images/mai-image-2.7"
payload = {
"prompt": "<string>",
"aspect_ratio": "auto",
"background": "opaque",
"num_images": 1,
"output_format": "png",
"reference_images": ["<string>"],
"size": "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({
prompt: '<string>',
aspect_ratio: 'auto',
background: 'opaque',
num_images: 1,
output_format: 'png',
reference_images: ['<string>'],
size: '1K'
})
};
fetch('https://api.budgetpixel.com/v1/images/mai-image-2.7', 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.budgetpixel.com/v1/images/mai-image-2.7",
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([
'prompt' => '<string>',
'aspect_ratio' => 'auto',
'background' => 'opaque',
'num_images' => 1,
'output_format' => 'png',
'reference_images' => [
'<string>'
],
'size' => '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.budgetpixel.com/v1/images/mai-image-2.7"
payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"aspect_ratio\": \"auto\",\n \"background\": \"opaque\",\n \"num_images\": 1,\n \"output_format\": \"png\",\n \"reference_images\": [\n \"<string>\"\n ],\n \"size\": \"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.budgetpixel.com/v1/images/mai-image-2.7")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\",\n \"aspect_ratio\": \"auto\",\n \"background\": \"opaque\",\n \"num_images\": 1,\n \"output_format\": \"png\",\n \"reference_images\": [\n \"<string>\"\n ],\n \"size\": \"1K\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.budgetpixel.com/v1/images/mai-image-2.7")
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 \"prompt\": \"<string>\",\n \"aspect_ratio\": \"auto\",\n \"background\": \"opaque\",\n \"num_images\": 1,\n \"output_format\": \"png\",\n \"reference_images\": [\n \"<string>\"\n ],\n \"size\": \"1K\"\n}"
response = http.request(request)
puts response.read_body{
"characters": [
{
"handle": "barry",
"name": "Barry",
"official": true,
"page_url": "<string>"
}
],
"id": "img_a1b2c3d4e5f6",
"message": "<string>",
"model": "<string>",
"status": "pending"
}{
"error": {
"code": "model_not_available",
"message": "<string>",
"type": "invalid_request_error"
}
}{
"error": {
"code": "model_not_available",
"message": "<string>",
"type": "invalid_request_error"
}
}{
"error": {
"code": "model_not_available",
"message": "<string>",
"type": "invalid_request_error"
}
}{
"error": {
"code": "model_not_available",
"message": "<string>",
"type": "invalid_request_error"
}
}MAI Image 2.7 on BudgetPixel
Authorizations
Body
Text description of the image to generate, or of the edit to apply to the input images (up to 8000 characters). Write @handle to cast a character: a BudgetPixel AI influencer or one of your own (GET /v1/characters).
Output aspect ratio. "auto" (default): an edit keeps the first input image's frame and comes back aligned with it, and text-to-image is 1:1. On an edit, a ratio other than the input's own re-composes the picture into that shape.
auto, 1:1, 4:3, 3:4, 3:2, 2:3, 16:9, 9:16 Output background. "transparent" returns a cut-out with an alpha channel (PNG, or WebP when asked), made from a text prompt: with input images the model draws the subject anew rather than cutting out the input (it is not a background remover).
opaque, transparent Optional input images (up to 5) to edit or combine. Each item is a public image URL, a data URI, raw base64, or an uploaded-file URL from POST /v1/uploads. Omit for text-to-image. Each input image bills 11 credits at 1K or 45 at 2K, per generated image; at 1K an input over 1 megapixel is scaled down to 1 megapixel first.
5Output size: 1K is about 1 MP (1024x1024, or 1360x768 at 16:9) and bills 50 credits per image; 2K is about 4 MP (2048x2048, or 2720x1536 at 16:9) and bills 190. Input images add 11 each at 1K and 45 each at 2K. An edit that keeps its input's frame comes back at about 1 MP (1K) or with a 2048 px long edge (2K: 2048x1152 at 16:9).
1K, 2K Response
Job accepted.