Start a text generation
curl --request POST \
--url https://api.backapp.dev/v2/texts/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-App-Key: <api-key>' \
--header 'X-App-Version: <x-app-version>' \
--data '
{
"model": "openai:gpt-6-luna",
"prompt": "Translate Good morning into French. Return only the translation.",
"max_output_tokens": 64,
"reasoning_effort": "none",
"request_id": "translation-async-example-01"
}
'import requests
url = "https://api.backapp.dev/v2/texts/generations"
payload = {
"model": "openai:gpt-6-luna",
"prompt": "Translate Good morning into French. Return only the translation.",
"max_output_tokens": 64,
"reasoning_effort": "none",
"request_id": "translation-async-example-01"
}
headers = {
"X-App-Version": "<x-app-version>",
"X-App-Key": "<api-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-App-Version': '<x-app-version>',
'X-App-Key': '<api-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'openai:gpt-6-luna',
prompt: 'Translate Good morning into French. Return only the translation.',
max_output_tokens: 64,
reasoning_effort: 'none',
request_id: 'translation-async-example-01'
})
};
fetch('https://api.backapp.dev/v2/texts/generations', 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.backapp.dev/v2/texts/generations",
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([
'model' => 'openai:gpt-6-luna',
'prompt' => 'Translate Good morning into French. Return only the translation.',
'max_output_tokens' => 64,
'reasoning_effort' => 'none',
'request_id' => 'translation-async-example-01'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-App-Key: <api-key>",
"X-App-Version: <x-app-version>"
],
]);
$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.backapp.dev/v2/texts/generations"
payload := strings.NewReader("{\n \"model\": \"openai:gpt-6-luna\",\n \"prompt\": \"Translate Good morning into French. Return only the translation.\",\n \"max_output_tokens\": 64,\n \"reasoning_effort\": \"none\",\n \"request_id\": \"translation-async-example-01\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-App-Version", "<x-app-version>")
req.Header.Add("X-App-Key", "<api-key>")
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.backapp.dev/v2/texts/generations")
.header("X-App-Version", "<x-app-version>")
.header("X-App-Key", "<api-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"openai:gpt-6-luna\",\n \"prompt\": \"Translate Good morning into French. Return only the translation.\",\n \"max_output_tokens\": 64,\n \"reasoning_effort\": \"none\",\n \"request_id\": \"translation-async-example-01\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.backapp.dev/v2/texts/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-App-Version"] = '<x-app-version>'
request["X-App-Key"] = '<api-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"openai:gpt-6-luna\",\n \"prompt\": \"Translate Good morning into French. Return only the translation.\",\n \"max_output_tokens\": 64,\n \"reasoning_effort\": \"none\",\n \"request_id\": \"translation-async-example-01\"\n}"
response = http.request(request)
puts response.read_body{
"job_id": "20000000-0000-4000-8000-000000000002",
"operation": "text_to_text",
"status": "pending",
"input": {
"model": "openai:gpt-6-luna",
"prompt": "Translate Good morning into French. Return only the translation.",
"max_output_tokens": 64,
"reasoning_effort": "none"
},
"result": null,
"error": null,
"created_at": "2026-11-17T18:00:00.187766Z",
"finished_at": null
}{
"error": {
"code": "<string>",
"message": "<string>",
"fields": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"fields": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"fields": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"fields": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"fields": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"fields": {}
}
}Text to Text
Start a text generation
Queues a text generation or returns an existing job for the same request ID.
Start a text generation
curl --request POST \
--url https://api.backapp.dev/v2/texts/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-App-Key: <api-key>' \
--header 'X-App-Version: <x-app-version>' \
--data '
{
"model": "openai:gpt-6-luna",
"prompt": "Translate Good morning into French. Return only the translation.",
"max_output_tokens": 64,
"reasoning_effort": "none",
"request_id": "translation-async-example-01"
}
'import requests
url = "https://api.backapp.dev/v2/texts/generations"
payload = {
"model": "openai:gpt-6-luna",
"prompt": "Translate Good morning into French. Return only the translation.",
"max_output_tokens": 64,
"reasoning_effort": "none",
"request_id": "translation-async-example-01"
}
headers = {
"X-App-Version": "<x-app-version>",
"X-App-Key": "<api-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-App-Version': '<x-app-version>',
'X-App-Key': '<api-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'openai:gpt-6-luna',
prompt: 'Translate Good morning into French. Return only the translation.',
max_output_tokens: 64,
reasoning_effort: 'none',
request_id: 'translation-async-example-01'
})
};
fetch('https://api.backapp.dev/v2/texts/generations', 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.backapp.dev/v2/texts/generations",
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([
'model' => 'openai:gpt-6-luna',
'prompt' => 'Translate Good morning into French. Return only the translation.',
'max_output_tokens' => 64,
'reasoning_effort' => 'none',
'request_id' => 'translation-async-example-01'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-App-Key: <api-key>",
"X-App-Version: <x-app-version>"
],
]);
$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.backapp.dev/v2/texts/generations"
payload := strings.NewReader("{\n \"model\": \"openai:gpt-6-luna\",\n \"prompt\": \"Translate Good morning into French. Return only the translation.\",\n \"max_output_tokens\": 64,\n \"reasoning_effort\": \"none\",\n \"request_id\": \"translation-async-example-01\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-App-Version", "<x-app-version>")
req.Header.Add("X-App-Key", "<api-key>")
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.backapp.dev/v2/texts/generations")
.header("X-App-Version", "<x-app-version>")
.header("X-App-Key", "<api-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"openai:gpt-6-luna\",\n \"prompt\": \"Translate Good morning into French. Return only the translation.\",\n \"max_output_tokens\": 64,\n \"reasoning_effort\": \"none\",\n \"request_id\": \"translation-async-example-01\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.backapp.dev/v2/texts/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-App-Version"] = '<x-app-version>'
request["X-App-Key"] = '<api-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"openai:gpt-6-luna\",\n \"prompt\": \"Translate Good morning into French. Return only the translation.\",\n \"max_output_tokens\": 64,\n \"reasoning_effort\": \"none\",\n \"request_id\": \"translation-async-example-01\"\n}"
response = http.request(request)
puts response.read_body{
"job_id": "20000000-0000-4000-8000-000000000002",
"operation": "text_to_text",
"status": "pending",
"input": {
"model": "openai:gpt-6-luna",
"prompt": "Translate Good morning into French. Return only the translation.",
"max_output_tokens": 64,
"reasoning_effort": "none"
},
"result": null,
"error": null,
"created_at": "2026-11-17T18:00:00.187766Z",
"finished_at": null
}{
"error": {
"code": "<string>",
"message": "<string>",
"fields": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"fields": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"fields": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"fields": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"fields": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"fields": {}
}
}Authorizations
Body
application/json
Response
Text generation job

