> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.videogen.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.videogen.io/_mcp/server.

# Generate text

POST https://api.videogen.io/v1/text/generate
Content-Type: application/json

Generate text from a prompt using a general-purpose language model. Choose a quality tier with `quality` (`LOW`, `STANDARD`, `HIGH`, or `MAX`). Synchronous: the response includes the generated text. Useful for drafting scripts, titles, descriptions, and other short copy before generating a video.

Reference: https://docs.videogen.io/rest-api-reference/text/generate-text

## Authentication

- `Authorization` header (bearer token, required) — API key from [app.videogen.io/api](https://app.videogen.io/api). The full key is only shown once when you create it.

## Request

### Body (application/json)

This endpoint expects a GenerateTextRequest.

- `prompt` (string, required) — The instruction or content to generate text from.
- `system` (string, optional, nullable) — Optional system instructions that steer the model's role, tone, and constraints.
- `quality` (enum, optional) — Text generation quality tier. Optional; when omitted, your account's Default AI quality for text is used (change it at https://app.videogen.io/settings/account).
  - Allowed values: `LOW`, `STANDARD`, `HIGH`, `MAX`
- `temperature` (double, optional) — Sampling temperature. Higher values produce more varied output. Defaults to the model's default.
- `maxOutputTokens` (integer, optional, default: 512) — Maximum number of tokens to generate. Defaults to 512.

## Response

### 200

Generated text.

- `text` (string, required) — The generated text.

## Examples

**Request**

```json
{
  "prompt": "Write a concise title for a video about staying hydrated.",
  "quality": "STANDARD",
  "maxOutputTokens": 32
}
```

**Response**

```json
{
  "text": "Stay Hydrated, Stay Energized"
}
```

**SDK Code**

```typescript
import { VideoGen } from "@videogen/sdk";

const client = new VideoGen({ apiKey: "sk_videogen_live_..." });

await client.text.generateText({
  prompt: "Write a concise title for a video about staying hydrated.",
  quality: "STANDARD",
  maxOutputTokens: 32,
});
```

```python
from videogen import VideoGen

client = VideoGen(api_key="sk_videogen_live_...")

client.text.generate_text(
    prompt="Write a concise title for a video about staying hydrated.",
    quality="STANDARD",
    max_output_tokens=32,
)
```