Text Generation
curl --request POST \
--url https://api.example.com/api/v2/generate \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"messages": [
{}
],
"stream": true,
"temperature": 123,
"max_tokens": 123,
"system": "<string>"
}
'import requests
url = "https://api.example.com/api/v2/generate"
payload = {
"model": "<string>",
"messages": [{}],
"stream": True,
"temperature": 123,
"max_tokens": 123,
"system": "<string>"
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
messages: [{}],
stream: true,
temperature: 123,
max_tokens: 123,
system: '<string>'
})
};
fetch('https://api.example.com/api/v2/generate', 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/api/v2/generate",
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' => '<string>',
'messages' => [
[
]
],
'stream' => true,
'temperature' => 123,
'max_tokens' => 123,
'system' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"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.example.com/api/v2/generate"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"messages\": [\n {}\n ],\n \"stream\": true,\n \"temperature\": 123,\n \"max_tokens\": 123,\n \"system\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
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/api/v2/generate")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"messages\": [\n {}\n ],\n \"stream\": true,\n \"temperature\": 123,\n \"max_tokens\": 123,\n \"system\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v2/generate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"messages\": [\n {}\n ],\n \"stream\": true,\n \"temperature\": 123,\n \"max_tokens\": 123,\n \"system\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"status": "<string>",
"model": "<string>",
"content": "<string>",
"tokens_used": 123,
"balance_remaining": 123,
"usage": {},
"created_at": "<string>"
}Generations (results)
Text Generation
Generate text using LLMs — GPT, Claude, Gemini, DeepSeek, Grok
POST
/
api
/
v2
/
generate
Text Generation
curl --request POST \
--url https://api.example.com/api/v2/generate \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"messages": [
{}
],
"stream": true,
"temperature": 123,
"max_tokens": 123,
"system": "<string>"
}
'import requests
url = "https://api.example.com/api/v2/generate"
payload = {
"model": "<string>",
"messages": [{}],
"stream": True,
"temperature": 123,
"max_tokens": 123,
"system": "<string>"
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
messages: [{}],
stream: true,
temperature: 123,
max_tokens: 123,
system: '<string>'
})
};
fetch('https://api.example.com/api/v2/generate', 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/api/v2/generate",
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' => '<string>',
'messages' => [
[
]
],
'stream' => true,
'temperature' => 123,
'max_tokens' => 123,
'system' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"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.example.com/api/v2/generate"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"messages\": [\n {}\n ],\n \"stream\": true,\n \"temperature\": 123,\n \"max_tokens\": 123,\n \"system\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
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/api/v2/generate")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"messages\": [\n {}\n ],\n \"stream\": true,\n \"temperature\": 123,\n \"max_tokens\": 123,\n \"system\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v2/generate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"messages\": [\n {}\n ],\n \"stream\": true,\n \"temperature\": 123,\n \"max_tokens\": 123,\n \"system\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"status": "<string>",
"model": "<string>",
"content": "<string>",
"tokens_used": 123,
"balance_remaining": 123,
"usage": {},
"created_at": "<string>"
}Request
string
required
Bearer token:
Authorization: Bearer nb_YOUR_API_KEYstring
required
Model slug. See Text Models for all available slugs.Examples:
gpt-5, claude-sonnet-4.5, gemini-3-pro, deepseek-r1array
required
Array of message objects in OpenAI-compatible format.Supported roles:
[
{ "role": "system", "content": "You are a helpful assistant." },
{ "role": "user", "content": "Hello!" }
]
system, user, assistantboolean
default:"false"
Enable server-sent events streaming. See Streaming Guide.
number
default:"0.7"
Sampling temperature between
0.0 and 2.0. Higher values make output more random.integer
Maximum tokens to generate. Defaults vary by model. Pass
null to use model defaults.string
Shorthand for adding a system message. Equivalent to adding
{ "role": "system", "content": "..." } as the first message.Request Example
curl -X POST https://elumenta.ru/api/v2/generate \
-H "Authorization: Bearer nb_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-4.5",
"system": "You are a helpful coding assistant.",
"messages": [
{ "role": "user", "content": "Write a Python function to parse JSON safely" }
],
"temperature": 0.5
}'
import requests
res = requests.post(
"https://elumenta.ru/api/v2/generate",
headers={"Authorization": "Bearer nb_YOUR_API_KEY"},
json={
"model": "claude-sonnet-4.5",
"system": "You are a helpful coding assistant.",
"messages": [
{"role": "user", "content": "Write a Python function to parse JSON safely"}
],
"temperature": 0.5
}
)
print(res.json()["content"])
const res = await fetch("https://elumenta.ru/api/v2/generate", {
method: "POST",
headers: {
"Authorization": "Bearer nb_YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
model: "claude-sonnet-4.5",
system: "You are a helpful coding assistant.",
messages: [
{ role: "user", content: "Write a Python function to parse JSON safely" }
],
temperature: 0.5
})
});
const data = await res.json();
console.log(data.content);
Response
string
Unique generation ID. Use this to retrieve results via GET /generate/status.
string
completed | pending | failedstring
The model slug used for this generation.
string
The generated text.
integer
Elumenta tokens consumed by this request.
integer
Your token balance after this request.
object
Raw provider token usage (for reference only, not billed):
{
"prompt_tokens": 142,
"completion_tokens": 387,
"total_tokens": 529
}
string
ISO 8601 timestamp.
Response Example
{
"id": "gen_01j9x2abc123",
"status": "completed",
"model": "claude-sonnet-4.5",
"content": "Here's a safe JSON parsing function in Python:\n\n```python\nimport json\nfrom typing import Optional, Any\n\ndef parse_json_safe(text: str) -> Optional[Any]:\n try:\n return json.loads(text)\n except (json.JSONDecodeError, TypeError):\n return None\n```",
"tokens_used": 3,
"balance_remaining": 297,
"usage": {
"prompt_tokens": 142,
"completion_tokens": 387,
"total_tokens": 529
},
"created_at": "2026-03-08T12:00:00Z"
}
Vision (Image Input)
Text models that support vision (gpt-5, claude-sonnet-4.5, gemini-3-pro) accept images in messages:
{
"model": "gpt-5",
"messages": [
{
"role": "user",
"content": [
{
"type": "image_url",
"image_url": { "url": "https://example.com/image.jpg" }
},
{
"type": "text",
"text": "What's in this image?"
}
]
}
]
}
Multi-turn Conversations
Pass the full conversation history inmessages:
{
"model": "gpt-5",
"messages": [
{ "role": "user", "content": "My name is Ivan" },
{ "role": "assistant", "content": "Hello Ivan! How can I help you?" },
{ "role": "user", "content": "What's my name?" }
]
}
Elumenta does not store conversation state between requests. You must send the full history each time.
⌘I

