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

# Text Generation

Text Generation models receive text instructions, questions, or context and generate natural language responses. They are suitable for general language tasks such as open-ended conversation, knowledge Q\&A, content generation, summarization, rewriting, and task decomposition.

Representative models include:

* `DeepSeek-V4-Flash`
* `DeepSeek-V4-Pro`
* `Qwen/Qwen3-32B`
* `openai/gpt-oss-120b`

For the full model list and pricing, refer to [Models](https://console.scitix.ai/model-inference/models).

## Core Capabilities

Text Generation models are typically used for the following capability scenarios. Specific support and performance vary by model.

| Capability              | Description                                                                                                       | Recommendation                                                                                     |
| ----------------------- | ----------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| Text generation         | Supports multi-genre and multi-style natural language generation, covering both structured and long-form content. | Suitable for conversation, writing, summarization, and content generation.                         |
| Semantic understanding  | Supports multi-turn conversation and intent recognition, and can maintain conversational context.                 | For complex tasks, provide clear background and constraints.                                       |
| Knowledge Q\&A          | Covers many domains, including science, technology, culture, and history.                                         | Can be used for enterprise knowledge bases, document retrieval, and factual or procedural answers. |
| Instruction following   | Can accurately follow complex instructions, such as "compare plan A and plan B in a Markdown table."              | State formatting requirements clearly.                                                             |
| Style control           | Use system prompts to unify tone and style, such as academic, conversational, or poetic styles.                   | Suitable when responses need a consistent style.                                                   |
| Long-context processing | Some models support longer context, ranging from 4k to 131k tokens.                                               | Context length varies by model. Refer to Models for details.                                       |

<Tip>
  Code generation and mathematical reasoning, such as implementing functions from natural language, refactoring code, writing unit tests, and solving problems step by step, are usually also handled by these general-purpose models. We recommend using a lower `temperature`, such as 0.1-0.3, for more stable and predictable output.
</Tip>

## Use Cases

* **Open-ended conversation**: Customer support bots, FAQ assistants, and conversational agents.
* **Knowledge Q\&A**: Enterprise knowledge bases, document retrieval, and factual or procedural answers.
* **Content generation**: Marketing copy, summaries, long-form articles, and creative writing.
* **Instruction following**: Task decomposition, step-by-step guides, and structured outputs such as lists and tables.

## Message Structure

Text Generation models receive input through a list of messages. Common message roles are as follows:

| Role        | Description                                            | Example                                                                                |
| ----------- | ------------------------------------------------------ | -------------------------------------------------------------------------------------- |
| `system`    | Defines the model's role, boundaries, and output style | You are a programmer with ten years of experience.                                     |
| `user`      | End-user input or the current task                     | What configuration is missing if the service starts before the model finishes loading? |
| `assistant` | Historical replies or example replies used as context  | The liveness/readiness probe may be missing...                                         |

<Tip>
  Organizing prompts in layers such as `system > user > assistant history` usually makes output more stable. You can also try different prompt structures based on your scenario.
</Tip>

## Key Parameters

### Description

* **Parameters that control creativity**

  * `temperature`: Controls output randomness. The value range is 0.0-2.0, and the recommended range is 0.2-0.8 to balance creativity and stability.
  * `top_p`: Controls the sampling range. The value range is 0.0-1.0. It can be used together with `temperature` to adjust creativity and stability.

* **Parameters that control output**

  * `max_completion_tokens`: Limits generation length and helps avoid truncated output.

  * `stop`: Sets stop sequences. Used to control where the model stops generating.

  * `frequency_penalty`: Repetition penalty. If output is repetitive or garbled, try adjusting this value.

  * `stream=True`: Returns responses as a stream. Recommended for long responses to reduce timeout risk.

* **Context**

  The maximum context length supported by each model can be viewed in [Models](https://console.scitix.ai/model-inference/models).

### Recommendations

* If output is garbled, try adjusting `temperature`, `top_p`, and `frequency_penalty`.
* We recommend keeping `max_completion_tokens` within the maximum context length and leaving room for the input.
* If output is truncated, set a reasonable `max_completion_tokens`, enable `stream=True`, and increase the client timeout.

## Billing

* **Formula**: Total cost = (input tokens x input unit price) + (output tokens x output unit price).
* **Pricing**: Check the model detail page in [Models](https://console.scitix.ai/model-inference/models) for each model's pricing.
* **Recommendations**:
  * During development, prefer free or lower-cost models.
  * For long responses, use streaming output and set `max_completion_tokens` appropriately.
  * For high-QPS workloads, combine concurrency control and rate limiting strategies.

## Examples

The examples read the API key from an environment variable to avoid writing secrets into code.

```bash theme={null}
export API_KEY="YOUR_API_KEY"
```

### Multi-Turn Conversation

```python theme={null}
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["API_KEY"],
    base_url="https://api.scitix.ai/model-api",
)

response = client.chat.completions.create(
    model="Qwen/Qwen3-32B",
    messages=[
        {
            "role": "system",
            "content": "You are a helpful assistant. Keep answers concise.",
        },
        {
            "role": "user",
            "content": "What are the main benefits of microservices architecture?",
        },
    ],
    temperature=0.7,
    max_completion_tokens=1024,
)

print(response.choices[0].message.content)
```

### Data Analysis Content Generation

```python theme={null}
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["API_KEY"],
    base_url="https://api.scitix.ai/model-api",
)

response = client.chat.completions.create(
    model="MiniMaxAI/MiniMax-M2.7",
    messages=[
        {
            "role": "system",
            "content": "You are a data analysis expert. Output results in Markdown with clear sections and bullet points.",
        },
        {
            "role": "user",
            "content": "Summarize typical patterns in SaaS trial-to-paid conversion by cohort (e.g. by signup week). What metrics and recommendations would you highlight? Keep it under 300 words.",
        },
    ],
    temperature=0.5,
    max_completion_tokens=1024,
)

print(response.choices[0].message.content)
```

### Release Notes / Changelog

```python theme={null}
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["API_KEY"],
    base_url="https://api.scitix.ai/model-api",
)

response = client.chat.completions.create(
    model="glm-5.2",
    messages=[
        {
            "role": "system",
            "content": "You write concise release notes. Use a short intro and bullet points.",
        },
        {
            "role": "user",
            "content": "Draft release notes for v2.0 of a CLI tool. New in this version: added `config` and `run` subcommands, support for env-based config, and a `--dry-run` flag. Keep it under 150 words.",
        },
    ],
    temperature=0.5,
    max_completion_tokens=512,
)

print(response.choices[0].message.content)
```
