Translate text to Spanish
curl --request POST \
--url https://api.httpayer.com/llm/translate \
--header 'Content-Type: application/json' \
--data '
{
"text": "Hello, how are you?"
}
'import requests
url = "https://api.httpayer.com/llm/translate"
payload = { "text": "Hello, how are you?" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({text: 'Hello, how are you?'})
};
fetch('https://api.httpayer.com/llm/translate', 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.httpayer.com/llm/translate",
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' => 'Hello, how are you?'
]),
CURLOPT_HTTPHEADER => [
"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.httpayer.com/llm/translate"
payload := strings.NewReader("{\n \"text\": \"Hello, how are you?\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.httpayer.com/llm/translate")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"Hello, how are you?\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.httpayer.com/llm/translate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"text\": \"Hello, how are you?\"\n}"
response = http.request(request)
puts response.read_body{
"original": "Hello, how are you?",
"translation": "Hola, ¿cómo estás?",
"model": "gpt-4o-mini-2024-07-18"
}{
"error": "Text field is required"
}{
"x402Version": 1,
"error": "Payment Required",
"accepts": [
{
"scheme": "exact",
"network": "base",
"payTo": "<string>",
"asset": "<string>",
"maxAmountRequired": "<string>"
}
]
}{
"error": "Translation failed",
"message": "<string>"
}LLM
Translate text to Spanish
Translates the provided text to Spanish using OpenAI.
Note: The AI model is configured server-side and cannot be specified in the request.
x402 Payment Required: This endpoint requires payment via the x402 protocol (version 1).
- First request: Returns 402 with payment requirements in
x-paymentheader - Second request: Include
X-Paymentheader with signed payment authorization
POST
/
llm
/
translate
Translate text to Spanish
curl --request POST \
--url https://api.httpayer.com/llm/translate \
--header 'Content-Type: application/json' \
--data '
{
"text": "Hello, how are you?"
}
'import requests
url = "https://api.httpayer.com/llm/translate"
payload = { "text": "Hello, how are you?" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({text: 'Hello, how are you?'})
};
fetch('https://api.httpayer.com/llm/translate', 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.httpayer.com/llm/translate",
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' => 'Hello, how are you?'
]),
CURLOPT_HTTPHEADER => [
"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.httpayer.com/llm/translate"
payload := strings.NewReader("{\n \"text\": \"Hello, how are you?\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.httpayer.com/llm/translate")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"Hello, how are you?\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.httpayer.com/llm/translate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"text\": \"Hello, how are you?\"\n}"
response = http.request(request)
puts response.read_body{
"original": "Hello, how are you?",
"translation": "Hola, ¿cómo estás?",
"model": "gpt-4o-mini-2024-07-18"
}{
"error": "Text field is required"
}{
"x402Version": 1,
"error": "Payment Required",
"accepts": [
{
"scheme": "exact",
"network": "base",
"payTo": "<string>",
"asset": "<string>",
"maxAmountRequired": "<string>"
}
]
}{
"error": "Translation failed",
"message": "<string>"
}Headers
x402 v1 payment authorization header (base64-encoded JSON). Include on second request after receiving 402.
Body
application/json
Text to translate to Spanish
Example:
"Hello, how are you?"

