---
title: "text-generation"
method: POST
path: "/models/v2/openai-community/gpt2"
---

# text-generation

`POST /models/v2/openai-community/gpt2`

Generate text from an initial prompt for applications like story generation, dialogue systems, and creative writing

## Request body

- object
  - `text` string, required — The input text prompt to generate text from.
  - `stream` boolean — Enable text streaming.
  - `params` object — Model-specific parameters.
    - `min_length` integer — Minimum length of the generated text.
    - `max_length` integer — Maximum length of the generated text.
    - `temperature` number, float — Sampling temperature. Higher values = more random output.

## Response `200`

Successful text-generation response.

- object
  - `error` string, nullable, required — Null on success; otherwise an error message.
  - `output` string, required — The generated text completion.

## Other responses

- `401` — Auth error - check your api key and how you're sending it.
- `429` — Too Many Requests – You have hit the rate limit.

---

[API](https://skmtc.net/bytez/apis/closed-source-model-api.md) · [All operations](https://skmtc.net/bytez/apis/closed-source-model-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/bytez/closed-source-model-api/versions/d64c9c733afe/schema)
