GPT Image 2 Light texto para imagem
curl --request POST \
--url https://api.highwayapi.ai/v3/gpt-image-2-light-text-to-image \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"size": "<string>",
"prompt": "<string>",
"background": "<string>",
"moderation": "<string>"
}
'import requests
url = "https://api.highwayapi.ai/v3/gpt-image-2-light-text-to-image"
payload = {
"size": "<string>",
"prompt": "<string>",
"background": "<string>",
"moderation": "<string>"
}
headers = {
"Content-Type": "<content-type>",
"Authorization": "<authorization>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': '<content-type>', Authorization: '<authorization>'},
body: JSON.stringify({
size: '<string>',
prompt: '<string>',
background: '<string>',
moderation: '<string>'
})
};
fetch('https://api.highwayapi.ai/v3/gpt-image-2-light-text-to-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.highwayapi.ai/v3/gpt-image-2-light-text-to-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([
'size' => '<string>',
'prompt' => '<string>',
'background' => '<string>',
'moderation' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>"
],
]);
$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.highwayapi.ai/v3/gpt-image-2-light-text-to-image"
payload := strings.NewReader("{\n \"size\": \"<string>\",\n \"prompt\": \"<string>\",\n \"background\": \"<string>\",\n \"moderation\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Authorization", "<authorization>")
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.highwayapi.ai/v3/gpt-image-2-light-text-to-image")
.header("Content-Type", "<content-type>")
.header("Authorization", "<authorization>")
.body("{\n \"size\": \"<string>\",\n \"prompt\": \"<string>\",\n \"background\": \"<string>\",\n \"moderation\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.highwayapi.ai/v3/gpt-image-2-light-text-to-image")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = '<content-type>'
request["Authorization"] = '<authorization>'
request.body = "{\n \"size\": \"<string>\",\n \"prompt\": \"<string>\",\n \"background\": \"<string>\",\n \"moderation\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"images": [
"<string>"
]
}Imagens
GPT Image 2 Light texto para imagem
POST
/
v3
/
gpt-image-2-light-text-to-image
GPT Image 2 Light texto para imagem
curl --request POST \
--url https://api.highwayapi.ai/v3/gpt-image-2-light-text-to-image \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"size": "<string>",
"prompt": "<string>",
"background": "<string>",
"moderation": "<string>"
}
'import requests
url = "https://api.highwayapi.ai/v3/gpt-image-2-light-text-to-image"
payload = {
"size": "<string>",
"prompt": "<string>",
"background": "<string>",
"moderation": "<string>"
}
headers = {
"Content-Type": "<content-type>",
"Authorization": "<authorization>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': '<content-type>', Authorization: '<authorization>'},
body: JSON.stringify({
size: '<string>',
prompt: '<string>',
background: '<string>',
moderation: '<string>'
})
};
fetch('https://api.highwayapi.ai/v3/gpt-image-2-light-text-to-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.highwayapi.ai/v3/gpt-image-2-light-text-to-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([
'size' => '<string>',
'prompt' => '<string>',
'background' => '<string>',
'moderation' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>"
],
]);
$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.highwayapi.ai/v3/gpt-image-2-light-text-to-image"
payload := strings.NewReader("{\n \"size\": \"<string>\",\n \"prompt\": \"<string>\",\n \"background\": \"<string>\",\n \"moderation\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Authorization", "<authorization>")
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.highwayapi.ai/v3/gpt-image-2-light-text-to-image")
.header("Content-Type", "<content-type>")
.header("Authorization", "<authorization>")
.body("{\n \"size\": \"<string>\",\n \"prompt\": \"<string>\",\n \"background\": \"<string>\",\n \"moderation\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.highwayapi.ai/v3/gpt-image-2-light-text-to-image")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = '<content-type>'
request["Authorization"] = '<authorization>'
request.body = "{\n \"size\": \"<string>\",\n \"prompt\": \"<string>\",\n \"background\": \"<string>\",\n \"moderation\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"images": [
"<string>"
]
}API de texto para imagem GPT Image 2 Light, cobrada de acordo com a resolução de saída.
Cabeçalhos da solicitação
string
obrigatório
Valores enumerados:
application/jsonstring
obrigatório
Formato de autenticação Bearer: Bearer {{API Key}}.
Corpo da solicitação
string
padrão:"1024x1024"
Tamanho da imagem de saída. O sistema associará o SKU de cobrança de acordo com essa resolução.Valores opcionais:
1024x1024, 1024x1536, 1536x1024, 2048x2048, 2048x1152, 1152x2048, 3840x2160, 2160x3840string
obrigatório
Descreve o conteúdo da imagem a ser criada.
string
padrão:"auto"
Modo de fundo da imagem de saída.Valores opcionais:
opaque, autostring
padrão:"auto"
Intensidade da moderação de conteúdo no modo de geração.Valores opcionais:
auto, lowInformações da resposta
string[]
Lista de URLs das imagens geradas.
⌘I