Text To Prompt
curl --request POST \
--url https://api.example.com/v1/text-to-prompt \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data '
{
"text": "a cat"
}
'import requests
url = "https://api.example.com/v1/text-to-prompt"
payload = { "text": "a cat" }
headers = {
"x-api-key": "<x-api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({text: 'a cat'})
};
fetch('https://api.example.com/v1/text-to-prompt', 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.example.com/v1/text-to-prompt",
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([
'text' => 'a cat'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <x-api-key>"
],
]);
$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.example.com/v1/text-to-prompt"
payload := strings.NewReader("{\n \"text\": \"a cat\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<x-api-key>")
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.example.com/v1/text-to-prompt")
.header("x-api-key", "<x-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"a cat\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/text-to-prompt")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<x-api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"text\": \"a cat\"\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"message": "success",
"data": {
"prompt": "A sleek, ginger tabby cat, with emerald green eyes that shimmer in the dim light, crouches low to the ground. Its fur, a rich blend of orange and cream, feels soft and velvety to the touch, and a few strands of tawny fur stick out like whiskers. Dust motes dance in a single shaft of sunlight piercing a crack in the weathered wooden floorboards of a dimly lit, rustic barn. The cat’s tail flicks nervously, its pink nose twitching, as it listens intently to every rustle. A faint, musty smell of hay and old wood fills the air.\n"
}
}OpenAPI v1
Text To Prompt
Generate a prompt from a text
POST
/
v1
/
text-to-prompt
Text To Prompt
curl --request POST \
--url https://api.example.com/v1/text-to-prompt \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data '
{
"text": "a cat"
}
'import requests
url = "https://api.example.com/v1/text-to-prompt"
payload = { "text": "a cat" }
headers = {
"x-api-key": "<x-api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({text: 'a cat'})
};
fetch('https://api.example.com/v1/text-to-prompt', 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.example.com/v1/text-to-prompt",
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([
'text' => 'a cat'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <x-api-key>"
],
]);
$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.example.com/v1/text-to-prompt"
payload := strings.NewReader("{\n \"text\": \"a cat\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<x-api-key>")
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.example.com/v1/text-to-prompt")
.header("x-api-key", "<x-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"a cat\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/text-to-prompt")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<x-api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"text\": \"a cat\"\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"message": "success",
"data": {
"prompt": "A sleek, ginger tabby cat, with emerald green eyes that shimmer in the dim light, crouches low to the ground. Its fur, a rich blend of orange and cream, feels soft and velvety to the touch, and a few strands of tawny fur stick out like whiskers. Dust motes dance in a single shaft of sunlight piercing a crack in the weathered wooden floorboards of a dimly lit, rustic barn. The cat’s tail flicks nervously, its pink nose twitching, as it listens intently to every rustle. A faint, musty smell of hay and old wood fills the air.\n"
}
}