Generate Image
curl --request POST \
--url https://api-lr.agent.ai/v1/action/generate_image \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "A serene mountain lake at sunset",
"model": "DALL-E 3",
"model_style": "default",
"model_aspect_ratio": "9:16"
}
'import requests
url = "https://api-lr.agent.ai/v1/action/generate_image"
payload = {
"prompt": "A serene mountain lake at sunset",
"model": "DALL-E 3",
"model_style": "default",
"model_aspect_ratio": "9:16"
}
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: 'A serene mountain lake at sunset',
model: 'DALL-E 3',
model_style: 'default',
model_aspect_ratio: '9:16'
})
};
fetch('https://api-lr.agent.ai/v1/action/generate_image', 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-lr.agent.ai/v1/action/generate_image",
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' => 'A serene mountain lake at sunset',
'model' => 'DALL-E 3',
'model_style' => 'default',
'model_aspect_ratio' => '9:16'
]),
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-lr.agent.ai/v1/action/generate_image"
payload := strings.NewReader("{\n \"prompt\": \"A serene mountain lake at sunset\",\n \"model\": \"DALL-E 3\",\n \"model_style\": \"default\",\n \"model_aspect_ratio\": \"9:16\"\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-lr.agent.ai/v1/action/generate_image")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"A serene mountain lake at sunset\",\n \"model\": \"DALL-E 3\",\n \"model_style\": \"default\",\n \"model_aspect_ratio\": \"9:16\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-lr.agent.ai/v1/action/generate_image")
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\": \"A serene mountain lake at sunset\",\n \"model\": \"DALL-E 3\",\n \"model_style\": \"default\",\n \"model_aspect_ratio\": \"9:16\"\n}"
response = http.request(request)
puts response.read_body{
"metadata": {
"images": [
{
"prompt": "A serene mountain lake at sunset",
"url": "https://s3.us-east-2.amazonaws.com/asset-uploads.agent.ai/6b55e6923a78a17534d298e0708c764425dffc85fbd9c1c2d4f8fb3f_8af27bf1-c121-484f-a456-4c6c5628c5d0_20250217144148.jpg"
}
]
},
"response": "<img src=\"https://s3.us-east-2.amazonaws.com/asset-uploads.agent.ai/6b55e6923a78a17534d298e0708c764425dffc85fbd9c1c2d4f8fb3f_8af27bf1-c121-484f-a456-4c6c5628c5d0_20250217144148.jpg\" alt=\"A serene mountain lake at sunset\" /><br />",
"status": 200
}AI & Content Generation
Generate Image
Create images using AI models, with options for style and aspect ratio.
POST
/
action
/
generate_image
Generate Image
curl --request POST \
--url https://api-lr.agent.ai/v1/action/generate_image \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "A serene mountain lake at sunset",
"model": "DALL-E 3",
"model_style": "default",
"model_aspect_ratio": "9:16"
}
'import requests
url = "https://api-lr.agent.ai/v1/action/generate_image"
payload = {
"prompt": "A serene mountain lake at sunset",
"model": "DALL-E 3",
"model_style": "default",
"model_aspect_ratio": "9:16"
}
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: 'A serene mountain lake at sunset',
model: 'DALL-E 3',
model_style: 'default',
model_aspect_ratio: '9:16'
})
};
fetch('https://api-lr.agent.ai/v1/action/generate_image', 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-lr.agent.ai/v1/action/generate_image",
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' => 'A serene mountain lake at sunset',
'model' => 'DALL-E 3',
'model_style' => 'default',
'model_aspect_ratio' => '9:16'
]),
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-lr.agent.ai/v1/action/generate_image"
payload := strings.NewReader("{\n \"prompt\": \"A serene mountain lake at sunset\",\n \"model\": \"DALL-E 3\",\n \"model_style\": \"default\",\n \"model_aspect_ratio\": \"9:16\"\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-lr.agent.ai/v1/action/generate_image")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"A serene mountain lake at sunset\",\n \"model\": \"DALL-E 3\",\n \"model_style\": \"default\",\n \"model_aspect_ratio\": \"9:16\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-lr.agent.ai/v1/action/generate_image")
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\": \"A serene mountain lake at sunset\",\n \"model\": \"DALL-E 3\",\n \"model_style\": \"default\",\n \"model_aspect_ratio\": \"9:16\"\n}"
response = http.request(request)
puts response.read_body{
"metadata": {
"images": [
{
"prompt": "A serene mountain lake at sunset",
"url": "https://s3.us-east-2.amazonaws.com/asset-uploads.agent.ai/6b55e6923a78a17534d298e0708c764425dffc85fbd9c1c2d4f8fb3f_8af27bf1-c121-484f-a456-4c6c5628c5d0_20250217144148.jpg"
}
]
},
"response": "<img src=\"https://s3.us-east-2.amazonaws.com/asset-uploads.agent.ai/6b55e6923a78a17534d298e0708c764425dffc85fbd9c1c2d4f8fb3f_8af27bf1-c121-484f-a456-4c6c5628c5d0_20250217144148.jpg\" alt=\"A serene mountain lake at sunset\" /><br />",
"status": 200
}Authorizations
Bearer token from your account (https://agent.ai/user/integrations#api)
Body
application/json
Generates an image based on the provided text. Example user prompt: generate an image of a sunset using the DALL-E 3 model.
Example:
"A serene mountain lake at sunset"
LLM model to use for text generation.
Available options:
DALL-E 3, Playground v3, FLUX.1 [schnell], Ideogram Style
Available options:
default, photo, digital art, illustration, drawing Aspect Ratio
Available options:
9:16, 1:1, 4:3, 16:9 ⌘I

