> ## Documentation Index
> Fetch the complete documentation index at: https://docs.elumenta.ru/llms.txt
> Use this file to discover all available pages before exploring further.

# Text Generation Guide

> How to generate text with GPT, Claude, Gemini, DeepSeek and other models via Elumenta API

## Basic Request

All text models use the same endpoint with an OpenAI-compatible message format:

```python theme={null}
import requests

response = requests.post(
    "https://elumenta.ru/api/v2/generate",
    headers={"Authorization": "Bearer nb_YOUR_API_KEY"},
    json={
        "model": "gpt-5",
        "messages": [
            {"role": "system", "content": "You are a helpful assistant."},
            {"role": "user", "content": "Explain quantum computing in simple terms."}
        ]
    }
)

print(response.json()["content"])
```

## Choosing the Right Model

| Task                     | Recommended model                | Cost              |
| ------------------------ | -------------------------------- | ----------------- |
| Quick Q\&A, drafts       | `gpt-5-nano`, `claude-haiku-4.5` | 1 token (Starter) |
| Fast reasoning           | `deepseek-r1`                    | 1 token           |
| Code generation          | `gpt-5`, `deepseek-r1`           | 1–2 tokens        |
| Long documents, analysis | `claude-sonnet-4.5`              | 4 tokens          |
| Complex reasoning        | `claude-opus-4.5`                | 6 tokens          |
| Creative writing         | `gpt-5`, `gpt-5.2`               | 2–4 tokens        |
| Multilingual             | `gemini-3-pro`                   | 3 tokens          |

<Tip>
  Starter models (`gpt-5-nano`, `claude-haiku-4.5`, `gemini-2.5-flash`, `deepseek-v3`, `grok-4-fast`) are available without a subscription. Switch to paid models when you need higher quality.
</Tip>

## Full Model Reference

| Slug                | Name              | Tier    | Tokens |
| ------------------- | ----------------- | ------- | ------ |
| `gpt-5-nano`        | GPT-5 Nano        | Starter | 1      |
| `claude-haiku-4.5`  | Claude Haiku 4.5  | Starter | 1      |
| `gemini-2.5-flash`  | Gemini 2.5 Flash  | Starter | 1      |
| `deepseek-v3`       | DeepSeek V3 Chat  | Starter | 1      |
| `grok-4-fast`       | Grok 4 Fast       | Starter | 1      |
| `gpt-5`             | GPT-5             | Basic+  | 2      |
| `deepseek-r1`       | DeepSeek R1       | Basic+  | 1      |
| `gpt-5.2`           | GPT-5.2           | Basic+  | 4      |
| `claude-sonnet-4.5` | Claude Sonnet 4.5 | Basic+  | 4      |
| `gemini-3-pro`      | Gemini 3 Pro      | Basic+  | 3      |
| `claude-opus-4.5`   | Claude Opus 4.5   | Basic+  | 6      |
| `gpt-5.2-pro`       | GPT-5.2 Pro       | Basic+  | 39     |

## System Prompts

Use the `system` role to set context and behaviour for the model:

```python theme={null}
messages = [
    {
        "role": "system",
        "content": "You are a professional copywriter. Write in a concise, engaging style. Always respond in the same language as the user."
    },
    {
        "role": "user",
        "content": "Write a tagline for a project management app."
    }
]
```

## Multi-turn Conversations

Pass the full conversation history in the `messages` array:

```python theme={null}
messages = [
    {"role": "user", "content": "What is the capital of France?"},
    {"role": "assistant", "content": "The capital of France is Paris."},
    {"role": "user", "content": "What's the population there?"}
]
```

## Streaming

Add `"stream": true` to receive tokens as they're generated:

```python theme={null}
response = requests.post(
    "https://elumenta.ru/api/v2/generate/stream",
    headers={"Authorization": "Bearer nb_YOUR_API_KEY"},
    json={
        "model": "claude-sonnet-4.5",
        "messages": [{"role": "user", "content": "Write a short story."}],
        "stream": True
    },
    stream=True
)

for line in response.iter_lines():
    if line:
        print(line.decode())
```

## Parameters Reference

| Parameter     | Type    | Default       | Description                                       |
| ------------- | ------- | ------------- | ------------------------------------------------- |
| `model`       | string  | required      | Model slug                                        |
| `messages`    | array   | required      | Conversation history                              |
| `max_tokens`  | integer | model default | Maximum tokens in response                        |
| `temperature` | float   | `1.0`         | Creativity (0 = deterministic, 2 = very creative) |
| `stream`      | boolean | `false`       | Enable streaming                                  |

## Response Format

```json theme={null}
{
  "id": "gen_01j9x2abc123",
  "status": "completed",
  "type": "text",
  "model": "gpt-5",
  "content": "Quantum computing uses quantum bits (qubits)...",
  "tokens_used": 2,
  "balance_remaining": 298,
  "created_at": "2026-03-01T12:00:00Z"
}
```
